Commit 5b01512e by Derek Mauro Committed by Copybara-Service

Add a case to detect when the Bazel compiler string is explicitly set to "gcc",

instead of just detecting Bazel's default "compiler" string.

When Bazel auto-configures GCC, it sets the compiler string to
"compiler", probably for backwards compatibility. Some users manually
set the string to "gcc".

This should address the backwards compatibility issues described in
https://github.com/bazelbuild/bazel/issues/12707 and hopefully fix
https://github.com/abseil/abseil-cpp/issues/1263

PiperOrigin-RevId: 473069817
Change-Id: I8a24721f63f9d61447b22b3b05b06a9dde7d34d8
parent 2594f855
...@@ -28,6 +28,14 @@ config_setting( ...@@ -28,6 +28,14 @@ config_setting(
) )
config_setting( config_setting(
name = "gcc_compiler",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "gcc",
},
visibility = [":__subpackages__"],
)
config_setting(
name = "msvc_compiler", name = "msvc_compiler",
flag_values = { flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl", "@bazel_tools//tools/cpp:compiler": "msvc-cl",
......
...@@ -25,6 +25,7 @@ ABSL_DEFAULT_COPTS = select({ ...@@ -25,6 +25,7 @@ ABSL_DEFAULT_COPTS = select({
"//absl:msvc_compiler": ABSL_MSVC_FLAGS, "//absl:msvc_compiler": ABSL_MSVC_FLAGS,
"//absl:clang-cl_compiler": ABSL_CLANG_CL_FLAGS, "//absl:clang-cl_compiler": ABSL_CLANG_CL_FLAGS,
"//absl:clang_compiler": ABSL_LLVM_FLAGS, "//absl:clang_compiler": ABSL_LLVM_FLAGS,
"//absl:gcc_compiler": ABSL_GCC_FLAGS,
"//conditions:default": ABSL_GCC_FLAGS, "//conditions:default": ABSL_GCC_FLAGS,
}) })
...@@ -32,6 +33,7 @@ ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({ ...@@ -32,6 +33,7 @@ ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({
"//absl:msvc_compiler": ABSL_MSVC_TEST_FLAGS, "//absl:msvc_compiler": ABSL_MSVC_TEST_FLAGS,
"//absl:clang-cl_compiler": ABSL_CLANG_CL_TEST_FLAGS, "//absl:clang-cl_compiler": ABSL_CLANG_CL_TEST_FLAGS,
"//absl:clang_compiler": ABSL_LLVM_TEST_FLAGS, "//absl:clang_compiler": ABSL_LLVM_TEST_FLAGS,
"//absl:gcc_compiler": ABSL_GCC_TEST_FLAGS,
"//conditions:default": ABSL_GCC_TEST_FLAGS, "//conditions:default": ABSL_GCC_TEST_FLAGS,
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment