build: add -Wdate-time to Werror flags #17880

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:add_Werror_date_time changing 1 files +2 −0
  1. fanquake commented at 5:10 AM on January 6, 2020: member

    -Wdate-time Warn when macros TIME, DATE or TIMESTAMP are encountered as they might prevent bit-wise-identical reproducible compilations.

    This is supported by GCC and Clang.

    Example output:

      CXX      bitcoind-bitcoind.o
    bitcoind.cpp:48:20: warning: expansion of date or time macro is not reproducible [-Wdate-time]
        printf("%s\n", __TIMESTAMP__);
                       ^
    bitcoind.cpp:49:20: warning: expansion of date or time macro is not reproducible [-Wdate-time]
        printf("%s\n", __TIME__);
                       ^
    bitcoind.cpp:50:20: warning: expansion of date or time macro is not reproducible [-Wdate-time]
        printf("%s\n", __DATE__);
                       ^
    3 warnings generated.
    
  2. build: add Wdate-time to Werror flags
    -Wdate-time
    
        Warn when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered as 
        they might prevent bit-wise-identical reproducible compilations.
    
    This is supported by GCC and Clang.
    https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
    https://clang.llvm.org/docs/DiagnosticsReference.html#wdate-time
    b0a254019c
  3. fanquake added the label Build system on Jan 6, 2020
  4. fanquake added the label Needs gitian build on Jan 6, 2020
  5. dongcarl commented at 5:11 AM on January 6, 2020: member

    Concept ACK!

  6. practicalswift commented at 8:10 AM on January 6, 2020: contributor

    ACK b0a254019c3bc8a353c1304ee65a55cfb3d4ecac -- diff looks correct and guarding against potential non-reproducibility is good :)

  7. DrahtBot commented at 8:19 AM on January 6, 2020: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15382 (util: add runCommandParseJSON by Sjors)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  8. promag commented at 8:31 AM on January 6, 2020: member

    Concept ACK.

  9. hebasto approved
  10. hebasto commented at 9:02 AM on January 6, 2020: member

    ACK b0a254019c3bc8a353c1304ee65a55cfb3d4ecac

  11. MarcoFalke commented at 6:57 PM on January 6, 2020: member

    Last use was removed in d096d22446a1d126ea78170f37a148ce0ca43df2. I can't imagine they ever get added back in, but I don't mind this warning either if others find it useful.

  12. DrahtBot commented at 11:03 PM on January 6, 2020: member

    <!--a722867cd34abeea1fadc8d60700f111-->

    Gitian builds

    File commit b949ac9697a6cfe087f60a16c063ab9c5bf1e81f<br>(master) commit 1964fe6b8b079ef504554a87ac661320d19a57ed<br>(master and this pull)
    bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz a14207517d25fece... 97978b864c832627...
    bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 51fd58ca7f14c4bb... 03b2d7fcdb1ed36c...
    bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz 0c13785557c412cb... c36722c9c1782f44...
    bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz d717d387941a6f52... 97c21e223f28af42...
    bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz 485858210efe05c2... 71625a6c514c33cc...
    bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz 69a1cf3b9bf79fbe... 0461c4dce9f66d5d...
    bitcoin-0.19.99-osx-unsigned.dmg c876fb9db3d4d189... 979c194e7b7941c2...
    bitcoin-0.19.99-osx64.tar.gz dd8a3ebd540cc66c... a8f368d8437eb08a...
    bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz 6642fc1c8d1635d1... a697223a5950dc2a...
    bitcoin-0.19.99-riscv64-linux-gnu.tar.gz 6cccb448a4262e7b... 63b9b2ba5ef6a51c...
    bitcoin-0.19.99-win64-debug.zip f94ba1033e8cc317... 4106d6ffeac35c5c...
    bitcoin-0.19.99-win64-setup-unsigned.exe 8b59c3214bfb6a46... f7edd163f772677c...
    bitcoin-0.19.99-win64.zip a23d7c88ff460d78... 29ec1d072e952d4b...
    bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz 62a5918ebf22fc21... 30fe566c60efad33...
    bitcoin-0.19.99-x86_64-linux-gnu.tar.gz 98cd19fe59bc6eff... 9b7f191b2d7a5284...
    bitcoin-0.19.99.tar.gz 5a211d09899b034c... 7cbc81a7b15f898d...
    bitcoin-core-linux-0.20-res.yml 7ed024b81ed9b639... 8e38087d74e030d3...
    bitcoin-core-osx-0.20-res.yml 5947a980f2b74084... ad20c4cb76cfea3d...
    bitcoin-core-win-0.20-res.yml 9e64f2d02f143a21... dec85693cdd1649b...
    linux-build.log ef1f26008e10e842... b90d34bc115d72b9...
    osx-build.log 4ab5188b79e2e50c... 3914214927f38de3...
    win-build.log 0567536136b41af8... 64c3472f30743fd6...
    bitcoin-core-linux-0.20-res.yml.diff dcbda83ade9604ac...
    bitcoin-core-osx-0.20-res.yml.diff 6cc626e6ab14c364...
    bitcoin-core-win-0.20-res.yml.diff ffa28ab12ba9f0f1...
    linux-build.log.diff c9b200f7caf63a10...
    osx-build.log.diff 8f5138075948e6ce...
    win-build.log.diff 28422ee61fb64c33...
  13. DrahtBot removed the label Needs gitian build on Jan 6, 2020
  14. promag commented at 6:42 PM on January 7, 2020: member

    Just to confirm, this change makes the compiler emit just a warning?

  15. fanquake commented at 7:06 PM on January 7, 2020: member

    Just to confirm, this change makes the compiler emit just a warning?

    Yes. Unless you —enable-werror.

  16. promag commented at 1:14 AM on January 8, 2020: member

    Tested ACK b0a254019c3bc8a353c1304ee65a55cfb3d4ecac on macos with clang. Already had --enable-werror, added a wild printf("%s\n", __TIMESTAMP__) and got the following error:

    error: expansion of date or time macro is not reproducible [-Werror,-Wdate-time]
    printf("%s\n", __TIMESTAMP__);
                   ^
    1 error generated.
    
  17. laanwj commented at 1:40 PM on January 8, 2020: member

    ACK b0a254019c3bc8a353c1304ee65a55cfb3d4ecac

  18. laanwj referenced this in commit b065df803c on Jan 8, 2020
  19. laanwj merged this on Jan 8, 2020
  20. laanwj closed this on Jan 8, 2020

  21. fanquake deleted the branch on Jan 8, 2020
  22. kittywhiskers referenced this in commit 4091a81e24 on Jun 17, 2021
  23. kittywhiskers referenced this in commit 3d2c4608cd on Jun 17, 2021
  24. kittywhiskers referenced this in commit 01b0fc9763 on Jun 17, 2021
  25. UdjinM6 referenced this in commit 988fa6a235 on Jun 23, 2021
  26. DrahtBot locked this on Feb 15, 2022

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-26 06:14 UTC

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