diff options
author | Armando Montanez <amontanez@google.com> | 2023-10-21 02:30:53 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-21 02:30:53 +0000 |
commit | 35460f87885e0a56724a79c9523e600766e417f5 (patch) | |
tree | e6cda0ab5b6f68cc1782fd216a06e0dd8f730954 /pw_build | |
parent | 26ccfc66c181be7da3580cc44bf017732b73c4ab (diff) | |
download | pigweed-35460f87885e0a56724a79c9523e600766e417f5.tar.gz |
pw_build: Only use -Wextra-semi on C++ files with GCC
GCC doesn't like it when -Wextra-semi is a C flag, and only allows it
when compiling C++.
Bug: b/306734552, b/301262374
Change-Id: Ic6407823843134defd3485e143a5d138249f6bec
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/177171
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'pw_build')
-rw-r--r-- | pw_build/BUILD.gn | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pw_build/BUILD.gn b/pw_build/BUILD.gn index d8258baca..55b0f8305 100644 --- a/pw_build/BUILD.gn +++ b/pw_build/BUILD.gn @@ -18,6 +18,7 @@ import("$dir_pw_build/cc_blob_library.gni") import("$dir_pw_build/python.gni") import("$dir_pw_build/relative_source_file_names.gni") import("$dir_pw_docgen/docs.gni") +import("$dir_pw_toolchain/generate_toolchain.gni") import("$dir_pw_toolchain/traits.gni") import("$dir_pw_unit_test/test.gni") import("target_types.gni") @@ -138,10 +139,16 @@ config("extra_strict_warnings") { # This config MUST NOT be used downstream to allow for warnings to be # added in the future without breaking downstream. config("internal_strict_warnings") { - cflags = [ - "-Wextra-semi", - "-Wswitch-enum", - ] + cflags = [ "-Wswitch-enum" ] + + # TODO: b/301262374 - Provide a better way to detect the compiler type. + if (defined(pw_toolchain_SCOPE.cc) && + get_path_info(pw_toolchain_SCOPE.cc, "file") == "clang") { + cflags += [ "-Wextra-semi" ] + } else { + # TODO: b/306734552 - On GCC, this only works as a C++ flag. + cflags_cc = [ "-Wextra-semi" ] + } # TODO: b/243069432 - Enable pedantic warnings on Windows when they pass. if (host_os != "win") { |