diff --git a/core/BUILD b/core/BUILD index ee3abf3..fe2909d 100644 --- a/core/BUILD +++ b/core/BUILD @@ -42,6 +42,9 @@ instrument_hooks_cflags = [ "-Wno-unused-const-variable", "-Wno-type-limits", "-Wno-uninitialized", + # Older Clang lacks -Wunterminated-string-initialization; tolerate the unknown flag. + "-Wno-unknown-warning-option", + "-Wno-unterminated-string-initialization", # When cross-compiling: "-Wno-constant-conversion", "-Wno-incompatible-pointer-types", @@ -49,6 +52,7 @@ instrument_hooks_cflags = [ ] instrument_hooks_cflags_windows = [ + "/std:c11", "/wd4101", # unreferenced local variable (equivalent to -Wno-unused-variable) "/wd4189", # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable) "/wd4100", # unreferenced formal parameter (equivalent to -Wno-unused-parameter) @@ -66,8 +70,8 @@ cc_library( copts = select({ ":windows_strict_warnings": ["/W4","/WX"] + instrument_hooks_cflags_windows, ":windows": instrument_hooks_cflags_windows, - ":strict_warnings_enabled": ["-Wall", "-Werror"] + instrument_hooks_cflags, - "//conditions:default": instrument_hooks_cflags, + ":strict_warnings_enabled": ["-std=c11", "-Wall", "-Werror"] + instrument_hooks_cflags, + "//conditions:default": ["-std=c11"] + instrument_hooks_cflags, }), visibility = ["//visibility:public"], ) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 4ee7018..f0d5eb2 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -27,6 +27,13 @@ set(instrument_hooks_SOURCE_DIR ${instrument_hooks_repo_SOURCE_DIR}) # Add the instrument_hooks library add_library(instrument_hooks STATIC ${instrument_hooks_SOURCE_DIR}/dist/core.c) +# Pin C11: the Zig-generated core.c is rejected under C23 (e.g. GCC 15's default), +# which mangles [[noreturn]] placement in the embedded zig.h. +set_target_properties( + instrument_hooks + PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON +) + target_include_directories( instrument_hooks PUBLIC @@ -47,6 +54,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") -Wno-unused-const-variable -Wno-type-limits -Wno-uninitialized + # Older Clang lacks -Wunterminated-string-initialization; tolerate the unknown flag. + -Wno-unknown-warning-option + -Wno-unterminated-string-initialization # When cross-compiling: -Wno-constant-conversion -Wno-incompatible-pointer-types