From 83b4c5d233b1df459fbbd12bfda1194f567a422f Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 27 Feb 2026 15:14:25 +0000 Subject: [PATCH] runtime/cgo: avoid unused parameter warning Annotate the unused parameter with `__attribute__((unused))` to avoid build failures in environments that treat unused parameters as errors. We see this when using `rules_go`: ``` @@rules_go+//:stdlib builder failed: error executing GoStdlib command (from stdlib rule target @@rules_go+//:stdlib) bazel-out/linux_host_platform-opt-exec-ST-f2d1f3f5d18d/bin/external/rules_go++go_sdk+main___download_0/builder_reset/builder stdlib -sdk external/rules_go++go_sdk+main___download_0 -goroot ... (remaining 16 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging stderr: # runtime/cgo gcc_clearenv.c:13:23: error: unused parameter '_unused' [-Werror,-Wunused-parameter] stdlib: error running subcommand external/rules_go++go_sdk+main___download_0/bin/go: exit status 1 ``` This matches the style used in `src/runtime/cgo/gcc_libinit.c` since dc2ae2886fbcd2297d2a0ea67a5d220ae2c74152 which fixed an identical issue. Change-Id: I8c805962b88af480839f8662a1fcf4ed1e5d574d GitHub-Last-Rev: b99fbda4f6fe7a199a59af425e997111137262a4 GitHub-Pull-Request: golang/go#77847 Reviewed-on: https://go-review.googlesource.com/c/go/+/749840 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Cherry Mui Auto-Submit: Ian Lance Taylor Reviewed-by: David Chase --- src/runtime/cgo/gcc_clearenv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/cgo/gcc_clearenv.c b/src/runtime/cgo/gcc_clearenv.c index 7657e3562d..c4f69c1e00 100644 --- a/src/runtime/cgo/gcc_clearenv.c +++ b/src/runtime/cgo/gcc_clearenv.c @@ -10,7 +10,7 @@ /* Stub for calling clearenv */ void -x_cgo_clearenv(void **_unused) +x_cgo_clearenv(void **env __attribute__((unused))) { _cgo_tsan_acquire(); clearenv();