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

Matthias Klose <[email protected]> Sun, 2 Aug 2026 16:08:25 +0200
Newsgroups gmane.linux.debian.devel.gcc
Message-ID <daf89b4e-5903-4870-b2ce-695bffe69529__24279.5157524355$1785679886$gmane$org@debian.org>
On 8/2/26 00:59, Gioele Barabucci wrote:
> 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?

sure, please prepare a patch and get it approved upstream. I won't carry 
something like that locally.