From 9a88d808632d3288f9be085b7c907ef69aefa372 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Mon, 22 Jun 2026 13:56:14 +0200 Subject: [PATCH 1/2] build: pin -std=c11 for instrument-hooks core.c The Zig-generated dist/core.c is rejected under C23 (GCC 15's default), so pin C11 in both the Bazel and CMake builds. --- core/BUILD | 5 +++-- core/CMakeLists.txt | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/BUILD b/core/BUILD index ee3abf3..71d2234 100644 --- a/core/BUILD +++ b/core/BUILD @@ -49,6 +49,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 +67,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..e88a0fc 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 From 76985b6f02c49fe70393c50fcca6e9748f300caa Mon Sep 17 00:00:00 2001 From: not-matthias Date: Wed, 24 Jun 2026 11:59:18 +0200 Subject: [PATCH 2/2] build: suppress -Wunterminated-string-initialization for instrument-hooks core.c --- core/BUILD | 3 +++ core/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/core/BUILD b/core/BUILD index 71d2234..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", diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e88a0fc..f0d5eb2 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -54,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