re PR preprocessor/71183 (gcc -E always gives __DATE__ and __TIME__ as Jan 1 1970...
authorJakub Jelinek <jakub@redhat.com>
Mon, 13 Jun 2016 21:00:07 +0000 (23:00 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 13 Jun 2016 21:00:07 +0000 (23:00 +0200)
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
gcc/c-family/c-ppoutput.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c [new file with mode: 0644]

index a53fc9cceb57e510259dd499172ed55d2bf12fba..69ba05ca49f093ff06fe765dc6dedf154787fba1 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-13  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c/68657
index cc433c9a40b389d47a905afb4c83300c8ac0cd67..1f812a55f8840da498c9ad02729f2ca90e70c682 100644 (file)
@@ -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;
index 6ba9050d1666ea3588aff27b0c64d883c8f74d9e..33ff1268159f54da029f87ee82ef09f8efe7ecde 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR preprocessor/71183
+       * gcc.dg/cpp/source_date_epoch-3.c: New test.
+
 2016-06-13  Jeff Law  <law@redhat.com>
 
        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 (file)
index 0000000..95a105b
--- /dev/null
@@ -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" } } */