-
Notifications
You must be signed in to change notification settings - Fork 154
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
Enable -Werror #1026
Enable -Werror #1026
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow is used for our normal PR's. So we still want to disable-bootstrap otherwise our PR build/test is going to take way too long. I think all we want to do is --enable-werror or add -Werror to our flags in our rust Makefile
But didn't @/tschwinge said gcc is only supposed to be warning free when using the bootstrap process? I'm talking about this comment. Maybe |
Bootstrap is not wanted for every PR (waste of time/resources), and |
I don't really know, I just wanted to fix the issue. But maybe it could be useful in |
@CastilloDel We want to avoid regressions by making sure that our bootstrapped build does not stop working silently at some point. We can do this two ways:
I personally think the first option would be preferable. To show you that you can't use ../../gcc/rust/rust-session-manager.cc:1011:19: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} [-Wformat=]
1011 | rust_debug ("had to implicitly enable feature '%s'!", feature);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/rust/rust-diagnostics.h:143:54: note: in definition of macro ‘rust_debug’
143 | #define rust_debug(...) rust_debug_loc (Location (), __VA_ARGS__)
| ^~~~~~~~~~~
../../gcc/rust/rust-session-manager.cc:1011:55: note: format string is defined here
1011 | rust_debug ("had to implicitly enable feature '%s'!", feature);
| ~^
| |
| char* I configured the build directory like so: |
I did the first option, but now it doesn't compile :(. Doesn't this have to do with what @/tschwinge said in the issue and I referenced before? I understood that the build process isn't warning free when the bootstrap is disabled. |
I'd be fine with the second solution too. The only thing I don't like is that it can fail silently. You can also maybe look into how to add an extra step for our merging bot, bors, so that it runs an extra file before merging to master. This way contributors that open PRs still have reasonably fast feedback where bootstrapping is disabled, but bors performs a full check before merging it to master? |
I think all that has been said here is correct... ;'-) I thought I'd seen this suggested somewhere, but now I can't find it anymore: to just enable Just to throw in yet another option (but I'm not convinced that I like it...): bors is running in a mostly stable setup (meaning, here: known GCC version used to build GCC/Rust). We could generate a baseline expected warnings file containing That way, we don't get any noticeable overhead for the bors CI runs, and the only downside is that we have to update the baseline expected warnings file if the bors GCC version changes, and when doing merges from GCC upstream. (... which seems reasonable.) |
138b3f1
to
a6d3917
Compare
@CastilloDel to debug the CI failure I can recommend the tmate github action! I think in your case it might just be because of the missing newline at the end of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CastilloDel, aha, so you're indeed experimenting with my diff
suggestion, nice. :-)
I think I convinced myself to "like" it sufficiently. ;-)
Now that's of course a (solvable) problem if the warnings are not deterministic... |
Okay. I read all the comments (you guys have been really helpful!) and now I think I didn't miss anything and it should work.
I think that was a human error on my part. The warnings do seem to be deterministic, but you were right that the sort was needed. I didn't realize the build uses concurrency. Edit:
Okay, I missed this. I'll fix it right now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks nice! I think it would be better to keep the bors_log_expected_warnings
file inside the .github/
directory: When we try to upstream the project, this a directory we're sure to skip, and this file only has a purpose for github actions, meaning it shouldn't get upstreamed either
This should prevent new warnings from appearing silently Signed-off-by: Daniel del Castillo delcastillodelarosadaniel@gmail.com
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@CastilloDel , I'm looking into this now, thanks! Still would like to tune a few things, documentation, and try to find a way to make this usable for local "workflows" (standard Otherwise, I'll now have to route any merges from upstream GCC (#247) through bors/CI. (Which would be fine, too.) First I've now got some learning to do about https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions, etc. ;-) I see "Add more commits by pushing to the master branch on CastilloDel/gccrs", so for simplicity, I'll use that branch and this PR #1026 for my work. (Hope you don't mind...) ;-D |
.github/workflows/ccpp.yml
Outdated
|
||
- name: Check for new warnings | ||
run: | | ||
grep 'warning:' gccrs-build/log | sort > log_warnings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step will fail in case that grep
doesn't find a single warning. We shall defer that latent problem until relevant... ;-)
…w warnings' step Run it in scratch directory, too, to not pollute the pristine sources directory. Point to <Rust-GCC#1026> in case of failure.
…obs.build-and-check' That's what I use in my local development enviroment, and I suppose I'll be the main one touching this file semi-regularly in context of <Rust-GCC#247> "Rebasing against GCC".
…uild-and-check' This avoids the supposed issue that in case that 'make' fails, the whole 'jobs.build-and-check' stops, and 'Build logs' isn't executed, and thus there's no indication in the GitHub UI why 'make' failed. Using a shell pipeline is OK; the exit code of 'make' isn't lost, as per <https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell>, 'bash' is being run with '-o pipefail'.
…w warnings' step Run it in scratch directory, too, to not pollute the pristine sources directory. Point to <Rust-GCC#1026> in case of failure.
80ebc0f
to
121a647
Compare
@CastilloDel, many thanks again for your work on this! Please don't feel bad that I've put some more changes on top -- instead understand this to mean that we're actually building on top of your work. :-)
As I've now (tried and then) documented, that's not really feasible, so...
... this is it. Unless I've now missed or broken anything, or anyone has any other comments (please review the commits I've added!), I think we're ready to put this into production? |
Simple question. IIUC, we want to use GHA to get a new reference in case of new diagnostic(s). Is there a file left as an artifact that can be used to update the reference ? i.e.:
Is my understanding correct? |
@dkm, ah good point. Indeed that's currently not implemented, and |
I guess if we can copy/paste and use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not having the expected warnings file updated automatically is fine. We probably just have to watch out for new warnings when merging gcc's upstream into us, which is a rare-ish occurence
if diff -U0 ../.github/bors_log_expected_warnings log_warnings; then | ||
: | ||
else | ||
echo 'See <https://github.com/Rust-GCC/gccrs/pull/1026>.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this! This way it will be clear why it failed
bors: merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing work guys!
bors: merge
... once again.
|
Build succeeded: |
As discussed in <https://inbox.sourceware.org/gcc-patches/871qpjtmd8.fsf@euler.schwinge.homeip.net>: > '-Werror=overloaded-virtual' is implied as by default, we have > '-Woverloaded-virtual' and '-Werror' [for '--enable-bootstrap' builds]. > ([...]) > (Maybe that isn't active for '--disable-bootstrap' builds, but that's > "OK".) For '--disable-bootstrap' builds, we still have '-Woverloaded-virtual', and any new such diagnostics will be caught by the #1026 "check for new warnings" machinery, so effectively that does implement '-Werror', too. > '-Wno-unused-parameter' [did] move into > 'rust-warn' This reverts #1585 commit a32ef7a.
Fixes #694
make check-rust
passes locallyclang-format
gcc/testsuite/rust/
The last three ones shouldn't be necessary for this change.
Update the CI to use the bootstrap build process and enable -Werror
Signed-off-by: Daniel del Castillo delcastillodelarosadaniel@gmail.com