* [PATCH] Fix SOURCE_DATE_EPOCH handling with -E (PR preprocessor/71183)
@ 2016-06-13 18:28 Jakub Jelinek
2016-06-13 20:10 ` Joseph Myers
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-06-13 18:28 UTC (permalink / raw)
To: Joseph S. Myers, Jason Merrill, Marek Polacek; +Cc: gcc-patches
Hi!
The SOURCE_DATE_EPOCH env var is ignored during -E, which is undesirable
and inconsistent. The problem is that the appropriate callback for
libcpp is only installed when compiling and not when preprocessing only.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
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.
* gcc.dg/cpp/source_date_epoch-3.c: New test.
--- gcc/c-family/c-ppoutput.c.jj 2016-01-04 14:55:58.000000000 +0100
+++ gcc/c-family/c-ppoutput.c 2016-06-12 19:49:50.932112947 +0200
@@ -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;
--- gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c.jj 2016-06-12 19:56:49.988696438 +0200
+++ gcc/testsuite/gcc.dg/cpp/source_date_epoch-3.c 2016-06-12 19:57:36.648093343 +0200
@@ -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" } } */
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix SOURCE_DATE_EPOCH handling with -E (PR preprocessor/71183)
2016-06-13 18:28 [PATCH] Fix SOURCE_DATE_EPOCH handling with -E (PR preprocessor/71183) Jakub Jelinek
@ 2016-06-13 20:10 ` Joseph Myers
0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2016-06-13 20:10 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, Marek Polacek, gcc-patches
On Mon, 13 Jun 2016, Jakub Jelinek wrote:
> Hi!
>
> The SOURCE_DATE_EPOCH env var is ignored during -E, which is undesirable
> and inconsistent. The problem is that the appropriate callback for
> libcpp is only installed when compiling and not when preprocessing only.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-13 20:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 18:28 [PATCH] Fix SOURCE_DATE_EPOCH handling with -E (PR preprocessor/71183) Jakub Jelinek
2016-06-13 20:10 ` Joseph Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).