@@ -23,6 +23,12 @@ config_setting(
2323 flag_values = {":strict_warnings" : "on" },
2424)
2525
26+ config_setting (
27+ name = "windows_strict_warnings" ,
28+ constraint_values = ["@platforms//os:windows" ],
29+ flag_values = {":strict_warnings" : "on" },
30+ )
31+
2632# IMPORTANT: Keep in sync with instrument-hooks/ci.yml (COMMON_CFLAGS)
2733instrument_hooks_cflags = [
2834 "-Wno-format" ,
@@ -37,21 +43,24 @@ instrument_hooks_cflags = [
3743 "-Wno-unused-function" ,
3844]
3945
46+ instrument_hooks_cflags_windows = [
47+ "/wd4101" , # unreferenced local variable (equivalent to -Wno-unused-variable)
48+ "/wd4189" , # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
49+ "/wd4100" , # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
50+ "/wd4245" , # signed/unsigned mismatch
51+ "/wd4132" , # const object should be initialized
52+ "/wd4146" , # unary minus operator applied to unsigned type
53+ ]
54+
4055# Instrument-hooks library with warning suppressions
4156cc_library (
4257 name = "instrument_hooks" ,
4358 srcs = ["instrument-hooks/dist/core.c" ],
4459 hdrs = glob (["instrument-hooks/includes/*.h" ]),
4560 includes = ["instrument-hooks/includes" ],
4661 copts = select ({
47- ":windows" : [
48- "/wd4101" , # unreferenced local variable (equivalent to -Wno-unused-variable)
49- "/wd4189" , # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
50- "/wd4100" , # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
51- "/wd4245" , # signed/unsigned mismatch
52- "/wd4132" , # const object should be initialized
53- "/wd4146" , # unary minus operator applied to unsigned type
54- ],
62+ ":windows_strict_warnings" : ["/W4" ,"/WX" ] + instrument_hooks_cflags_windows ,
63+ ":windows" : instrument_hooks_cflags_windows ,
5564 ":strict_warnings_enabled" : ["-Wall" , "-Werror" ] + instrument_hooks_cflags ,
5665 "//conditions:default" : instrument_hooks_cflags ,
5766 }),
0 commit comments