Skip to content

Commit

Permalink
pw_toolchain: Color diagnostics in Bazel
Browse files Browse the repository at this point in the history
- Enable color compiler diagnostics in Bazel.
- Update comment referring to duplicate bug.

Change-Id: I8bace84e60eec992e2bfd1ee83336902878a5728
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/217715
Presubmit-Verified: CQ Bot Account <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Armando Montanez <[email protected]>
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Jun 24, 2024
1 parent 3bf60a7 commit 519f0b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions pw_toolchain/arm_gcc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ pw_cc_toolchain(
"@pw_toolchain//flag_sets:wno_register",
"@pw_toolchain//flag_sets:wnon_virtual_dtor",
"//pw_toolchain/cc:common_warnings",
"//pw_toolchain/cc:color_diagnostics",
] + select({
"@pw_toolchain//constraints/arm_mcpu:cortex-m0": [":cortex-m0"],
"@pw_toolchain//constraints/arm_mcpu:cortex-m0plus": [":cortex-m0plus"],
Expand Down
17 changes: 15 additions & 2 deletions pw_toolchain/cc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,28 @@ pw_cc_flag_set(
"-Wpointer-arith",
"-Wshadow",
"-Wredundant-decls",
# TODO: b/332954913 - enable once code fixed
# "-Wsign-conversion",
# TODO: b/259746255 - Enable implicit conversion warnings once fixed.
# "-Wconversion",
# Make all warnings errors, except for the exemptions below.
"-Werror",
"-Wno-error=cpp", # preprocessor #warning statement
"-Wno-error=deprecated-declarations", # [[deprecated]] attribute
],
)

# Enables colors in compiler diagnostics. This uses the GCC spelling of the
# flag, which Clang supports as an undocumented extension.
pw_cc_flag_set(
name = "color_diagnostics",
actions = [
"@pw_toolchain//actions:all_asm_actions",
"@pw_toolchain//actions:all_c_compiler_actions",
"@pw_toolchain//actions:all_cpp_compiler_actions",
"@pw_toolchain//actions:all_link_actions",
],
flags = ["-fdiagnostics-color"],
)

# This config contains warnings that are enabled for upstream Pigweed.
# This config MUST NOT be used downstream to allow for warnings to be
# added in the future without breaking downstream.
Expand Down
1 change: 1 addition & 0 deletions pw_toolchain/host_clang/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pw_cc_toolchain(
"@pw_toolchain//flag_sets:wno_register",
"@pw_toolchain//flag_sets:wnon_virtual_dtor",
"//pw_toolchain/cc:common_warnings",
"//pw_toolchain/cc:color_diagnostics",
] + select({
"//pw_build:kythe": [":no_unknown_warning_option"],
"//conditions:default": [],
Expand Down

0 comments on commit 519f0b7

Please sign in to comment.