@@ -18,7 +18,7 @@ Flags specified here must not impact ABI. Code compiled with and without these
1818opts will be linked together, and in some cases headers compiled with and
1919without these options will be part of the same program.
2020
21- We use the same flags as absl.
21+ We use the same flags as absl, plus turn some warnings into errors .
2222"""
2323
2424load (
@@ -31,18 +31,16 @@ load(
3131 "MSVC_TEST_FLAGS" ,
3232)
3333
34+ WERROR = ["-Werror=return-type" , "-Werror=switch" ]
35+
3436DEFAULT_COPTS = select ({
35- "//opencensus:llvm_compiler" : LLVM_FLAGS ,
36- # Disable "not all control paths return a value"; functions that return
37- # out of a switch on an enum cause build errors otherwise.
38- "//opencensus:windows" : MSVC_FLAGS + ["/wd4715" ],
39- "//conditions:default" : GCC_FLAGS ,
37+ "//opencensus:llvm_compiler" : LLVM_FLAGS + WERROR ,
38+ "//opencensus:windows" : MSVC_FLAGS ,
39+ "//conditions:default" : GCC_FLAGS + WERROR ,
4040})
4141
4242TEST_COPTS = DEFAULT_COPTS + select ({
43- "//opencensus:llvm_compiler" : LLVM_TEST_FLAGS ,
44- # Disable "not all control paths return a value"; functions that return
45- # out of a switch on an enum cause build errors otherwise.
46- "//opencensus:windows" : MSVC_TEST_FLAGS + ["/wd4715" ],
47- "//conditions:default" : GCC_TEST_FLAGS ,
43+ "//opencensus:llvm_compiler" : LLVM_TEST_FLAGS + WERROR ,
44+ "//opencensus:windows" : MSVC_TEST_FLAGS ,
45+ "//conditions:default" : GCC_TEST_FLAGS + WERROR ,
4846})
0 commit comments