-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Add --fatal_warnings flag to treat warnings as errors #8131
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
@benesch Do you happen to know what the process is for getting someone to review this? It doesn't seem to be moving incredibly fast at the moment. 😅 |
The process is: find someone you know at Google, and ask them to internally ping someone on the protobuf team 😄. Only a little bit kidding. |
It looks like the
|
Thanks @acozzette, will give it a look. 👍 |
@acozzette There we go, I edited the test in question like this: diff --git src/google/protobuf/compiler/command_line_interface_unittest.cc src/google/protobuf/compiler/command_line_interface_unittest.cc
index 15c9170a3..d1d14b81a 100644
--- src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -2330,7 +2330,7 @@ TEST_F(CommandLineInterfaceTest, InvalidErrorFormat) {
Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir foo.proto");
- ExpectErrorText("Unknown error format: invalid\n");
+ ExpectErrorText("foo.proto:2:1: Expected top-level statement (e.g. \"message\").\n");
}
TEST_F(CommandLineInterfaceTest, Warnings) { This is admittedly quite naïve, I don't really understand why the semantics for this error changes because of the (seemingly unrelated) changes in this MR. If you understand it better, please let me know. (I couldn't access the |
eb36f3e
to
cfc668c
Compare
I think I got it now. The test was changed in the original commit by @benesch (by mistake/intentionally? Hard to tell). I reverted that change back now and the original test assertion now succeeds, so we can minimize the impact of this PR (and hopefully get it merged soon). @acozzette - please trigger a new |
Thanks; there still seems to be some build failures (but the logs are still inaccessible to me, so slightly hard to see what they are). 😅 |
@perlun Sorry for the trouble, something's wrong with the permissions on our test logs. Here is the relevant error, though:
|
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.
No probs. 👍 Thanks for that. Interestingly enough, I don't think I'm able to reproduce this locally (not 100% sure since I started editing the code a bit too fast...). Anyhow, I made the new field default to @acozzette please get the CI started one more time, maybe we're good to go this time. 🤞 😄 |
The Python errors look to be unrelated, so I will go ahead and merge this. Thanks, @perlun! |
Thanks for the merge @acozzette, greatly appreciated! 🙏 👍 |
Woohoo! Thanks very much for the persistence @perlun! |
New attempt at #4336, building on top of the nice groundwork already provided by @benesch (appreciated!). Hoping we can get it to an approvable state this time. 😄
Because this builds on top of an existing MR, I decided to keep it as two separate commits - one for the rebased commit by @benesch and another one with my fixes. (There were some rebase conflicts that were amended into the original commit. One particular rebase conflict that I'm a bit hesitant about is https://github.com/protocolbuffers/protobuf/pull/4336/files#diff-cd3d05a33a7e35e0eeeff7b01f65d8744f20f08b1b179bb7ea3dc7e36e202d08R794; the constructor call looked differently here now so I removed that field setting altogether. Unsure if this is correct or not so please do advise.)
The newly added test runs fine locally with CLion but I'm not fully sure on how to run all the tests, so I'm hoping for the CI to tell me if the other tests pass or not with this change now. 🙂