build: add --enable-werror and warn on vla's #9789

pull theuni wants to merge 2 commits into bitcoin:master from theuni:no-vla changing 2 files +19 −1
  1. theuni commented at 9:28 PM on February 17, 2017: member

    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.

  2. paveljanik commented at 9:50 PM on February 17, 2017: contributor
  3. gmaxwell changes_requested
  4. gmaxwell commented at 11:47 PM on February 17, 2017: contributor

    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.

  5. fanquake added the label Build system on Feb 18, 2017
  6. laanwj commented at 1:35 PM on February 21, 2017: member

    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.

  7. theuni commented at 3:37 PM on February 21, 2017: member

    @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.

  8. laanwj commented at 4:03 PM on February 21, 2017: member

    Sounds good to me.

  9. build: warn about variable length arrays b602fe0f73
  10. theuni force-pushed on Feb 22, 2017
  11. theuni renamed this:
    build: disallow variable length arrays
    build: add --enable-werror and warn on vla's
    on Feb 22, 2017
  12. theuni commented at 6:58 AM on February 22, 2017: member

    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?

  13. shyii commented at 7:01 AM on February 22, 2017: none

    OK

  14. JeremyRubin commented at 7:32 AM on February 22, 2017: 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.

  15. laanwj commented at 8:28 AM on February 22, 2017: member

    @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.

  16. build: add --enable-werror option
    This turns some compiler warnings into errors. Useful for c-i.
    205830a37b
  17. theuni force-pushed on Feb 23, 2017
  18. theuni commented at 6:08 AM on February 23, 2017: member

    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.

  19. laanwj commented at 9:48 AM on February 23, 2017: member

    utACK 205830a

  20. laanwj merged this on Feb 23, 2017
  21. laanwj closed this on Feb 23, 2017

  22. laanwj referenced this in commit e68c266f3d on Feb 23, 2017
  23. laanwj referenced this in commit 749fe95fdc on Feb 23, 2017
  24. laanwj referenced this in commit 05e906dbc6 on Feb 23, 2017
  25. zkbot referenced this in commit 75604363cc on Dec 1, 2017
  26. zkbot referenced this in commit 6aef4033a7 on Dec 1, 2017
  27. zkbot referenced this in commit 83af270002 on Dec 15, 2017
  28. kotodev referenced this in commit c8a979fc92 on Jan 25, 2018
  29. codablock referenced this in commit af006a36ef on Jan 26, 2018
  30. renium9 referenced this in commit 23640da445 on Feb 6, 2018
  31. andvgal referenced this in commit e66154fbca on Jan 6, 2019
  32. CryptoCentric referenced this in commit 7c3e0373c3 on Feb 27, 2019
  33. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me