Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support treating warnings as errors (-Werror) #3980

Closed
benesch opened this issue Nov 30, 2017 · 8 comments
Closed

support treating warnings as errors (-Werror) #3980

benesch opened this issue Nov 30, 2017 · 8 comments

Comments

@benesch
Copy link
Contributor

benesch commented Nov 30, 2017

Compiler warnings from protoc can get lost, especially when part of a large build system, and there's no flag—at least, not one that I can find—to upgrade those warnings into fatal errors, like the -Werror flag does for GCC.

It would also be nice to provide plugins with an interface for indicating when a warning has been produced, so that protoc can exit with a failing exit status if -Werror has been passed. Our Go protobuf generator produces some warnings that we'd like to treat as errors, for example: gogo/protobuf/issues/356

@liujisi
Copy link
Contributor

liujisi commented Dec 1, 2017

I'd happy to review if you could put together a PR. It would look like:

  1. Add a boolean to track warnings, just like found_errors in: https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/command_line_interface.cc#L290
  2. Parse the flag in https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/command_line_interface.cc#L1370 (need to change several other places in the same file)
  3. Exit when found_warnings is set, similar to (https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/command_line_interface.cc#L956).

benesch added a commit to benesch/protobuf that referenced this issue Feb 26, 2018
Add a --fatal_warnings flag that requests that protoc exit with a
failing status code if any warnings are generated during compilation.

Partially address protocolbuffers#3980.
@benesch
Copy link
Contributor Author

benesch commented Jun 12, 2019

Sorry, but why is this being closed? I’m still interested in this. The PR was similarly closed without comment. A bit of insight would be much appreciated!

@TeBoring
Copy link
Contributor

Sorry, I thought it has been solved by #4336

@TeBoring TeBoring reopened this Jun 12, 2019
@jlisee
Copy link

jlisee commented Dec 2, 2019

Sorry, but why is this being closed? I’m still interested in this. The PR was similarly closed without comment. A bit of insight would be much appreciated!

Looks like the PR (#4336) had an issue with one of the tests so was not approved. Then since it got no attention was closed out in a cleanup pass or something similar. I would rebase, double check the tests, and give it another try.

Others, including me, are excited for this feature.

@kalbasit
Copy link

It would be great to get this done! @benesch are you planning to resubmit your pull request?

@benesch
Copy link
Contributor Author

benesch commented Aug 12, 2020

I'm afraid I'm busy with other stuff these days. You should feel free to take up the mantle, though!

perlun pushed a commit to perlun/protobuf that referenced this issue Dec 9, 2020
Add a --fatal_warnings flag that requests that protoc exit with a
failing status code if any warnings are generated during compilation.

Partially address protocolbuffers#3980.
@perlun
Copy link
Contributor

perlun commented Dec 9, 2020

I'm afraid I'm busy with other stuff these days. You should feel free to take up the mantle, though!

Challenge accepted, Admiral! 😎 #8131

perlun pushed a commit to perlun/protobuf that referenced this issue Mar 7, 2021
Add a --fatal_warnings flag that requests that protoc exit with a
failing status code if any warnings are generated during compilation.

Partially address protocolbuffers#3980.
perlun pushed a commit to perlun/protobuf that referenced this issue Mar 9, 2021
Add a --fatal_warnings flag that requests that protoc exit with a
failing status code if any warnings are generated during compilation.

Partially address protocolbuffers#3980.
acozzette pushed a commit that referenced this issue Mar 9, 2021
Add a --fatal_warnings flag that requests that protoc exit with a
failing status code if any warnings are generated during compilation.

Partially address #3980.
@nate-aurora
Copy link

Should this issue be closed now? #8131 seems to have been merged in.

@perezd perezd closed this as completed Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants