diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2026-02-27 15:14:25 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-02-27 20:17:33 -0800 |
| commit | 83b4c5d233b1df459fbbd12bfda1194f567a422f (patch) | |
| tree | 6ecf2bdc17b3be2c46e231bfc0a320721590e3fc /src/runtime | |
| parent | f5479628d36e6cdd63c39784b58fa7241abd3295 (diff) | |
| download | go-83b4c5d233b1df459fbbd12bfda1194f567a422f.tar.xz | |
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/cgo/gcc_clearenv.c | 2 |
1 files changed, 1 insertions, 1 deletions
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(); |
