[go] runtime/cgo: avoid unused parameter warning

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Feb 27, 2026, 11:17:37 PM (18 hours ago) Feb 27
to Tamir Duberstein, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, David Chase, Ian Lance Taylor, Go LUCI, Cherry Mui, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
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-by: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: Cherry Mui <cher...@google.com>
Auto-Submit: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: David Chase <drc...@google.com>
Files:
  • M src/runtime/cgo/gcc_clearenv.c
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Ian Lance Taylor, +1 by David Chase, +2 by Cherry Mui
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I8c805962b88af480839f8662a1fcf4ed1e5d574d
Gerrit-Change-Number: 749840
Gerrit-PatchSet: 3
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Tamir Duberstein <tam...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages