Skip to content

Conversation

hzzb
Copy link
Contributor

@hzzb hzzb commented May 25, 2021

Applying -Werror compiler option to request warnings is an usual
way to discover potential errors. Go user may put a cgo directive
in preamble: // #cgo CFLAGS: -Werror=unused-parameter.

However, the directive also takes effect on the cgo generated files.
I cleaned _cgo_main.c to help Go user only concentrate on warnings
of their own file.

Fixes #43639

hzzb added 4 commits January 12, 2021 17:15
Applying -Werror compiler option to request warnings is an usual
way to discover potential errors. Go user may put a cgo directive
in preamble: `// #cgo CFLAGS: -Werror=unused-parameter`.

However, the directive also takes effect on the cgo generated files.
I cleaned _cgo_main.c to help Go user only concentrate on warnings
of their own file.

Fixes golang#43639
@google-cla google-cla bot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label May 25, 2021
@gopherbot
Copy link
Contributor

This PR (HEAD: f09d172) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/322232 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@hzzb hzzb changed the title Cmd/cgo/fix unused parameter warning cmd/cgo: fix unused parameter warnings in generated _cgo_main.c Jul 30, 2021
@gopherbot
Copy link
Contributor

Message from Bryan C. Mills:

Patch Set 3: Run-TryBot+1 Code-Review+1 Trust+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 3: TryBot-Result-1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Hans Allen:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Ian Lance Taylor:

Patch Set 4: Patch Set 3 was rebased


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Ian Lance Taylor:

Patch Set 4: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/322232.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Aug 16, 2021
Applying -Werror compiler option to request warnings is an usual
way to discover potential errors. Go user may put a cgo directive
in preamble: `// #cgo CFLAGS: -Werror=unused-parameter`.

However, the directive also takes effect on the cgo generated files.
I cleaned _cgo_main.c to help Go user only concentrate on warnings
of their own file.

Fixes #43639

Change-Id: I9112f02ae5226f2fc87a8650d19faee59cddd588
GitHub-Last-Rev: f09d172
GitHub-Pull-Request: #46358
Reviewed-on: https://go-review.googlesource.com/c/go/+/322232
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Trust: Bryan C. Mills <[email protected]>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/322232 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd/cgo: go build failed on _cgo_main.c if there's '#cgo CFLAGS: -W -Werror' in cgo preamble

2 participants