From ef7cf206b6f9fd93ac41393829f79164b8adad1b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 13 Jun 2016 23:00:07 +0200 Subject: [PATCH] re PR preprocessor/71183 (gcc -E always gives __DATE__ and __TIME__ as Jan 1 1970 00:00:00) PR preprocessor/71183 * c-ppoutput.c (init_pp_output): Set cb->get_source_date_epoch to cb_get_source_date_epoch. * gcc.dg/cpp/source_date_epoch-3.c: New test. From-SVN: r237408 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-ppoutput.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c | 9 +++++++++ 4 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a53fc9cceb5..69ba05ca49f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Jakub Jelinek + + PR preprocessor/71183 + * c-ppoutput.c (init_pp_output): Set cb->get_source_date_epoch + to cb_get_source_date_epoch. + 2016-06-10 Jakub Jelinek PR c/68657 diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c index cc433c9a40b..1f812a55f88 100644 --- a/gcc/c-family/c-ppoutput.c +++ b/gcc/c-family/c-ppoutput.c @@ -150,6 +150,7 @@ init_pp_output (FILE *out_stream) } cb->has_attribute = c_common_has_attribute; + cb->get_source_date_epoch = cb_get_source_date_epoch; /* Initialize the print structure. */ print.src_line = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ba9050d166..33ff1268159 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Jakub Jelinek + + PR preprocessor/71183 + * gcc.dg/cpp/source_date_epoch-3.c: New test. + 2016-06-13 Jeff Law PR tree-optimization/71403 diff --git a/gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c b/gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c new file mode 100644 index 00000000000..95a105bb071 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c @@ -0,0 +1,9 @@ +/* PR preprocessor/71183 */ +/* { dg-do preprocess } */ +/* { dg-set-compiler-env-var SOURCE_DATE_EPOCH "630333296" } */ + +const char *date = __DATE__; +const char *time = __TIME__; + +/* { dg-final { scan-file source_date_epoch-3.i "Dec 22 1989" } } */ +/* { dg-final { scan-file source_date_epoch-3.i "12:34:56" } } */ -- 2.30.2