diff options
author | Ted Pudlik <tpudlik@google.com> | 2023-11-01 19:31:18 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-11-01 19:31:18 +0000 |
commit | ef859eb5d832bb9d6659b8afbc0d3ff134363466 (patch) | |
tree | facec799ffc6734f1f8e16cd32ec322d96ec19c7 /pw_build | |
parent | 4ec74d4107594c3aaa4257064ebf8bbeec7351ce (diff) | |
download | pigweed-ef859eb5d832bb9d6659b8afbc0d3ff134363466.tar.gz |
bazel: Move warnings to toolchain configuration
Bug: b/240466562
Change-Id: I6e98acea7b45c8cdb32075161109a013ca4dba9f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/178557
Reviewed-by: Armando Montanez <amontanez@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Diffstat (limited to 'pw_build')
-rw-r--r-- | pw_build/bazel.rst | 1 | ||||
-rw-r--r-- | pw_build/bazel_internal/BUILD.bazel | 3 | ||||
-rw-r--r-- | pw_build/bazel_internal/pigweed_internal.bzl | 13 | ||||
-rw-r--r-- | pw_build/pigweed.bzl | 2 |
4 files changed, 4 insertions, 15 deletions
diff --git a/pw_build/bazel.rst b/pw_build/bazel.rst index abec75ff2..46b518d9b 100644 --- a/pw_build/bazel.rst +++ b/pw_build/bazel.rst @@ -12,7 +12,6 @@ Wrapper rules The common configuration for Bazel for all modules is in the ``pigweed.bzl`` file. The built-in Bazel rules ``cc_binary``, ``cc_library``, and ``cc_test`` are wrapped with ``pw_cc_binary``, ``pw_cc_library``, and ``pw_cc_test``. -These wrappers add parameters to calls to the compiler and linker. .. _module-pw_build-bazel-pw_linker_script: diff --git a/pw_build/bazel_internal/BUILD.bazel b/pw_build/bazel_internal/BUILD.bazel index ccf02ce38..822ee7da9 100644 --- a/pw_build/bazel_internal/BUILD.bazel +++ b/pw_build/bazel_internal/BUILD.bazel @@ -34,6 +34,7 @@ pw_linker_script( cc_binary( name = "test_linker_script", srcs = ["test.cc"], + copts = ["-Wno-unused-variable"], # Only compatible with platforms that support linker scripts. target_compatible_with = select({ "@platforms//os:macos": ["@platforms//:incompatible"], @@ -53,6 +54,7 @@ cc_library( cc_binary( name = "test_transitive_linker_script", srcs = ["test.cc"], + copts = ["-Wno-unused-variable"], # Only compatible with platforms that support linker scripts. target_compatible_with = select({ "@platforms//os:macos": ["@platforms//:incompatible"], @@ -67,6 +69,7 @@ cc_binary( name = "test_direct_linker_script", srcs = ["test.cc"], additional_linker_inputs = [":linker_script_test"], + copts = ["-Wno-unused-variable"], linkopts = ["-T $(location :linker_script_test)"], # Only compatible with platforms that support linker scripts. target_compatible_with = select({ diff --git a/pw_build/bazel_internal/pigweed_internal.bzl b/pw_build/bazel_internal/pigweed_internal.bzl index d7ce6df20..bdb79bc55 100644 --- a/pw_build/bazel_internal/pigweed_internal.bzl +++ b/pw_build/bazel_internal/pigweed_internal.bzl @@ -17,17 +17,6 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") -STRICT_WARNINGS_COPTS = [ - "-Wall", - "-Wextra", - # Make all warnings errors, except for the exemptions below. - "-Werror", - "-Wno-error=cpp", # preprocessor #warning statement - "-Wno-error=deprecated-declarations", # [[deprecated]] attribute -] - -PW_DEFAULT_COPTS = STRICT_WARNINGS_COPTS - KYTHE_COPTS = [ "-Wno-unknown-warning-option", ] @@ -39,7 +28,7 @@ def add_defaults(kwargs): kwargs: cc_* arguments to be modified. """ - copts = PW_DEFAULT_COPTS + kwargs.get("copts", []) + copts = kwargs.get("copts", []) kwargs["copts"] = select({ "@pigweed//pw_build:kythe": copts + KYTHE_COPTS, "//conditions:default": copts, diff --git a/pw_build/pigweed.bzl b/pw_build/pigweed.bzl index 1e793905c..d6c1cf80d 100644 --- a/pw_build/pigweed.bzl +++ b/pw_build/pigweed.bzl @@ -18,7 +18,6 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_c load("@rules_cc//cc:action_names.bzl", "C_COMPILE_ACTION_NAME") load( "//pw_build/bazel_internal:pigweed_internal.bzl", - "PW_DEFAULT_COPTS", _add_defaults = "add_defaults", _compile_cc = "compile_cc", ) @@ -262,7 +261,6 @@ def _pw_cc_blob_library_impl(ctx): deps = ctx.attr.deps, includes = [ctx.bin_dir.path + "/" + ctx.label.package], defines = [], - user_compile_flags = PW_DEFAULT_COPTS, ) pw_cc_blob_library = rule( |