Skip to content

Conversation

@theuni
Copy link
Member

@theuni theuni commented Feb 17, 2017

There are few compelling reasons to allow these.

Note that travis should fail with this as-is, because clang produces a few VLA's in hash.h. This can be merged once those are cleaned up.

@paveljanik
Copy link
Contributor

after two hash.h VLAs fixed:
ACK e1cea61

Copy link
Contributor

@gmaxwell gmaxwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please warn instead of error, the hash.h behavior showed that the ability to consistently give the same results here depends on how effective the optimizer is at turning things constant.

@laanwj
Copy link
Member

laanwj commented Feb 21, 2017

For Travis this should be a hard error, to avoid VLAs (as detected by our compiler) from getting into the code base. For user builds I'm fine with making it just a warning.

@theuni
Copy link
Member Author

theuni commented Feb 21, 2017

@laanwj I like the idea of having Travis yell about new warnings. Not just this one.

Many projects have an --enable-werror setting. How about we keep this as a warning, add a --enable-werror, and turn it on for travis (after cleaning up the straggler warnings we have)? We can always disable them case-by-case as they come up, and that keeps Werror from affecting regular user builds.

@laanwj
Copy link
Member

laanwj commented Feb 21, 2017

Sounds good to me.

@theuni theuni changed the title build: disallow variable length arrays build: add --enable-werror and warn on vla's Feb 22, 2017
@theuni
Copy link
Member Author

theuni commented Feb 22, 2017

Updated. Split into 2 commits in case we want to backport the vla warning.

We'll definitely have to do some housecleaning if we enable Werror wholesale for Travis, and I suspect that will cause some grumbles about changing code for the sake of shutting up the compiler.

So maybe instead we should begin to slowly add warnings we definitely want Travis to error on?

@shyii
Copy link

shyii commented Feb 22, 2017

OK

@JeremyRubin
Copy link
Contributor

Cory and I talked a bit about this in IRC.

My 2¢:

I think that the usefulness of travis is somewhat finicky. If builds are failing for some large set of style reasons, then this is going to really slow down feature branch development, where this can be fixed up later but getting functional results are more important. Or people will place lower value on red-x's from Travis during development if errors are frequent. Furthermore, just building locally isn't really an option as I think I'm not in the minority that use Travis to test against whatever build platforms travis tests. Ideally, Travis would have multi-axis failures, where you can say code passes functional tests but not style tests. Code that passes functional tests could be ready for review from others, and in some cases, nudging the compiler in the right direction is non-obvious (as is the case with some of the VLA things)! This could be done by only running style checks on bitcoin/bitcoin.

One problem with just enabling style checks on bitcoin/bitcoin (and not on forks) is that it will be really frustrating if you pass travis on your fork, and then you PR master and then it fails due to style checks you didn't run yourself.

I think one way to do this is to add another (few?) travis build targets where strong-er flags are tested. That way, you can see easily if your build fail was from styler errors or from functional errors. It's not ideal in that a style failed build will still get an overall red-x, but at least one can see that a build fail was caused by style & not functionality without needing to muck around in the travis logs.

Another nice way to do this would be to add a style-check branch that has the style checks enabled, that one can PR-against on their own branch before PR'ing master, and only enable the style checks on any PR in bitcoin/bitcoin OR on PR to any branch named style-check.

@laanwj
Copy link
Member

laanwj commented Feb 22, 2017

@JeremyRubin I agree in general but please, let's not get into that discussion here. This is not merely a style check! VLAs cause stack-protection to not work for that function, so effectively decrease the hardening of the code. I'm fine with making it the only warning that stops travis, but it should do that.

This turns some compiler warnings into errors. Useful for c-i.
@theuni
Copy link
Member Author

theuni commented Feb 23, 2017

Ok, I narrowed werror to only vla's for now. We can add to the list as we come up with more obvious errors.

As @JeremyRubin had a few concerns about how to actually hook this up to travis, I left that out here. We can do that as a next step.

@laanwj
Copy link
Member

laanwj commented Feb 23, 2017

utACK 205830a

@laanwj laanwj merged commit 205830a into bitcoin:master Feb 23, 2017
laanwj added a commit that referenced this pull request Feb 23, 2017
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
laanwj pushed a commit that referenced this pull request Feb 23, 2017
laanwj pushed a commit that referenced this pull request Feb 23, 2017
This turns some compiler warnings into errors. Useful for c-i.

Github-Pull: #9789
Rebased-From: 205830a
zkbot added a commit to zcash/zcash that referenced this pull request Dec 1, 2017
Build system improvements

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6978
  - Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
  - Only the first commit (the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
  - Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
  - Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766

Part of #2074.
zkbot added a commit to zcash/zcash that referenced this pull request Dec 15, 2017
Build system improvements

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6978
  - Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
  - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
  - Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
  - Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766

Part of #2074.
kotodev pushed a commit to koto-dev/koto.old that referenced this pull request Jan 25, 2018
Build system improvements

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6978
  - Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
  - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
  - Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
  - Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766

Part of #2074.
codablock pushed a commit to codablock/dash that referenced this pull request Jan 26, 2018
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
renium9 added a commit to koto-dev/koto.old that referenced this pull request Feb 6, 2018
Build system improvements

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6978
  - Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
  - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
  - Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
  - Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766

Part of #2074.

# Conflicts:
#	configure.ac
#	src/Makefile.am
#	src/Makefile.gtest.include
#	src/Makefile.test.include
#	zcutil/build.sh
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 27, 2019
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants