https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71183

            Bug ID: 71183
           Summary: gcc -E always gives __DATE__ and __TIME__ as Jan  1
                    1970 00:00:00
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jrtc27 at jrtc27 dot com
  Target Milestone: ---

The inclusion of the SOURCE_DATE_EPOCH patch (SVN revision 235550) broke
__DATE__ and __TIME__ when running the preprocessor on its own, as
pfile->source_date_epoch is only initialised in c_lex_with_flags, so
pfile->source_date_epoch is 0 when _cpp_builtin_macro_text is called, rather
than -1 (telling it to use the current time) or the true value of
SOURCE_DATE_EPOCH.

$ echo '__DATE__ __TIME__' | gcc -E -
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
"Jan  1 1970" "00:00:00"

Reply via email to