build: add -Wdate-time to Werror flags#17880
Conversation
-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
|
Concept ACK! |
|
ACK b0a2540 -- diff looks correct and guarding against potential non-reproducibility is good :) |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
|
Concept ACK. |
|
Last use was removed in d096d22. I can't imagine they ever get added back in, but I don't mind this warning either if others find it useful. |
Gitian builds
|
promag
left a comment
There was a problem hiding this comment.
Just to confirm, this change makes the compiler emit just a warning?
Yes. Unless you —enable-werror. |
|
Tested ACK b0a2540 on macos with clang. Already had |
|
ACK b0a2540 |
b0a2540 build: add Wdate-time to Werror flags (fanquake) Pull request description: `-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](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html) and [Clang](https://clang.llvm.org/docs/DiagnosticsReference.html#wdate-time). Example output: ```bash 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. ``` ACKs for top commit: practicalswift: ACK b0a2540 -- diff looks correct and guarding against potential non-reproducibility is good :) promag: Tested ACK b0a2540 on macos with clang. Already had `--enable-werror`, added a wild `printf("%s\n", __TIMESTAMP__)` and got the following error: laanwj: ACK b0a2540 hebasto: ACK b0a2540 Tree-SHA512: b3a0b426e06dcd0c0baa94118c31158760b9690a8d0a15b5a2d544cb0879522e02817e134ef7346c707de09719818fc7e4bad1b3ad6b2dfe5e3c4169cdf5cb0d
merge bitcoin#18914, bitcoin#13306, bitcoin#16424, bitcoin#13899, bitcoin#17486, bitcoin#17880, bitcoin#18145, bitcoin#18843, bitcoin#16710: split warnings out of CXXFLAGS, add more flags
-Wdate-timeWarn 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: