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

Package:
gcc
Source:
gcc
Description:
GNU C compiler
Submitter:
Gioele Barabucci
Date:
2026-08-02 14:11:02 UTC
Severity:
normal
#1143443#5
Date:
2026-08-01 22:59:08 UTC
From:
To:
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,

#1143443#10
Date:
2026-08-02 14:08:25 UTC
From:
To:
sure, please prepare a patch and get it approved upstream. I won't carry
something like that locally.