bazel icon indicating copy to clipboard operation
bazel copied to clipboard

/Zc:inline should be set on by default in the MSVC Windows toolchain

Open matt-sm opened this issue 1 year ago • 2 comments

Description of the bug:

Since Visual Studio 14, /Zc:inline has been turned on by default:

https://devblogs.microsoft.com/cppblog/feedback-making-zcinline-default-for-debugrelease-configs-in-14/

But this flag seems to be missing from the default windows toolchain config:

https://github.com/bazelbuild/bazel/blob/master/tools/cpp/windows_cc_toolchain_config.bzl#L659

Migrating an existing VS project to cc_ toolchain can cause a regression.

Which category does this issue belong to?

C++ Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Create a VS (2015 or greater) project and check Configuration Properties -> C/C++ -> Command Line. /Zc:inline is set.

or alternatively

Use the VS generator with a CMake project and open the generated vcproj file in VS. The same flag is set.

Now create a cc_library and bazel build -S //.... This flag is not set.

Which operating system are you running Bazel on?

Windows 10

What is the output of bazel info release?

release 7.1.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

matt-sm avatar May 15 '24 00:05 matt-sm

We could make this possibly breaking change for Bazel 8. Ideally, we would have a feature toggling this behavior so that users broken by it can easily disable it.

Would you be interested in sending a PR?

fmeum avatar May 15 '24 08:05 fmeum

Created https://github.com/bazelbuild/bazel/pull/22392

matt-sm avatar May 16 '24 02:05 matt-sm