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

ci: Set -Werror for all CI builds #938

Closed

Conversation

real-or-random
Copy link
Contributor

Let's see if that passes...

@real-or-random
Copy link
Contributor Author

real-or-random commented May 6, 2021

Uff ok, this is failing for multiple reasons:

  • setting CFLAGS=-Werror during configure is a bad idea because then all the compilation checks run by configure use this and produce wrong results (these are the DISTCHECK and x86 asm failures)
  • the mingw libtool build produces warnings that are not our responsibility, see mingw builds #923...

Fixing the first item is a little bit annoying. We could simply patch the generated Makefile but that's pretty ugly. So we'll better add some logic.

It would be nice to call ./configure normally but then make CFLAGS=-Werror but this would override all the other settings in CFLAGS. According to https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html, it would anyway be cleaner to set our -Wall etc in AM_CFLAGS but even then CFLAGS=-Werror would override -O2 for example.

I believe a better way would be to have some maintainer variable with additional flags that can be set from the outside like make EXTRACFLAGS=-Werror. Or have some --enable-werror or --enable-maintainer-mode for configure. I'll probably try one of those options. Happy to hear opinions.

@gmaxwell
Copy link
Contributor

gmaxwell commented May 9, 2021

An enable-werror is the sort of thing I'd expect (maintainer mode sounds like it would get confused with AM_MAINTAINER_MODE).

The only concern I have with EXTRACFLAGS is just that it gets into my environment and then messes up my tests but is weird enough that I don't think to look for it. :P Is there any particular reason it needs to rerun both ways such that rerunning configure is a concern?

However its setup it should be done in a way that makes it relatively easy to drop on some CI builds. Because if some build starts throwing false positives it may be best to ignore it (e.g. if it's S390 or some other weird config and silencing it requires hurting performance or crapping up the codebase), or maybe not, but the decision shouldn't be driven by having to all-or-nothing the Werror or dropping the build.

@real-or-random real-or-random force-pushed the 202105-ci-werror branch 2 times, most recently from e5cc5d9 to 2026df0 Compare May 12, 2021 09:40
@real-or-random
Copy link
Contributor Author

The only concern I have with EXTRACFLAGS is just that it gets into my environment and then messes up my tests but is weird enough that I don't think to look for it.

I ended up doing this (naming it WERROR_CFLAGS) because we anyway need some free text variable for specifying fine-grained -Wno-error flags, and having a user-facing configure option is not tremendously helpful anyway. If users want -Werror they can always set CFLAGS.

Let's see what Cirrus says.

Fixes one of the items in bitcoin-core#923, namely the warnings of the form
    '_putenv' redeclared without dllimport attribute:
    previous dllimport ignored [-Wattributes]

This also cleans up the way we add CFLAGS, in particular flags enabling
warnings. Now we perform some more fine-grained checking for flag
support, which is not strictly necessary but the changes also help to
document autoconf.ac.
This also tidies the list of environment variables in .cirrus.yml.
@real-or-random
Copy link
Contributor Author

Closed in favor of #944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants