Bug#1143443: gcc: -Wdate-time and -Werror=date-time should be ignored when SOURCE_DATE_TIME is set

Gioele Barabucci <[email protected]> Sun, 2 Aug 2026 00:59:08 +0200
Newsgroups gmane.linux.debian.devel.gcc
Message-ID <13c462ab-54e3-453e-ac81-87cf1b5ff313__18852.4302256823$1785625283$gmane$org@debian.org>
Package: gcc
Version: 4:16.1.0-2
User: [email protected]
Usertag: timestamps toolchain
Debbugs-Cc: [email protected]

Dear gcc maintainers,

the gcc option `-Wdate-time` makes gcc produce a warning whenever the 
macros `__DATE__`, `__TIME__`, or `__TIMESTAMP__` are used. This is done 
because «‘__DATE__’ might prevent reproducible builds».

This warning is, however, moot when `SOURCE_DATE_EPOCH` is used. In that 
case all these macros will be set to whatever S_D_E says, making the 
build reproducible even in the presence of __DATE__ & Co.

At the same time, `-Wdate-time` becomes an hindrance when `-Werror` is 
set: The build will fail, even though it is, in fact, reproducible.

Could you please make gcc ignore `-Wdate-time`, or at least not fail 
when `-Werror` is active, if `SOURCE_DATE_EPOCH` is set?

Regards,