Compiler option updates
- Add -fdiagnostics-color so that compiler warnings are colorized. The
way Ninja invokes GCC disables colors by default.
- Move -Wno-psabi up to the arm_gcc_toolchain template so that it
doesn't have to be specified for each arm_gcc_toolchain instance.
- Add -Werror to the strict_warnings config to prevent warnings from
slipping through. Exempt a few warnings that should actually be
warnings.
Change-Id: I8656d6690b488f7b004f15abd7100b62e1945cfd
diff --git a/pw_build/BUILD.gn b/pw_build/BUILD.gn
index 75003fa..efac792 100644
--- a/pw_build/BUILD.gn
+++ b/pw_build/BUILD.gn
@@ -28,13 +28,20 @@
"-Wall",
"-Wextra",
- # Warn when a switch on an enum does not cover all the cases.
- "-Wswitch",
+ # Make all warnings errors, except for the exemptions below.
+ "-Werror",
+ "-Wno-error=cpp", # preprocessor #warning statement
+ "-Wno-error=deprecated-declarations", # [[deprecated]] attribute
]
}
config("cpp17") {
- cflags_cc = [ "-std=c++17" ]
+ cflags_cc = [
+ "-std=c++17",
+
+ # Allow uses of the register keyword, which may appear in C headers.
+ "-Wno-register",
+ ]
}
# Default C++ version for Pigweed modules.