From 15c98b2e0d51511893baaf477beb496ed425bae8 Mon Sep 17 00:00:00 2001 From: Eduard Sanou Date: Wed, 1 Jun 2016 16:42:41 +0000 Subject: c-common.c (get_source_date_epoch): Rename to cb_get_source_date_epoch. gcc/c-family/ChangeLog: 2016-05-13 Eduard Sanou * c-common.c (get_source_date_epoch): Rename to cb_get_source_date_epoch. * c-common.c (cb_get_source_date_epoch): Use a single generic erorr message when the parsing fails. Use error_at instead of fatal_error. * c-common.h (get_source_date_epoch): Rename to cb_get_source_date_epoch. * c-common.h (cb_get_source_date_epoch): Prototype. * c-common.h (MAX_SOURCE_DATE_EPOCH): Define. * c-common.h (c_omp_region_type): Remove trailing comma. * c-lex.c (init_c_lex): Set cb->get_source_date_epoch callback. * c-lex.c (c_lex_with_flags): Remove initialization of pfile->source_date_epoch. gcc/ChangeLog: 2016-05-13 Eduard Sanou * doc/cppenv.texi: Note that the `%s` in `date` is a non-standard extension. * gcc.c (driver_handle_option): Call set_source_date_epoch_envvar. * gcc.c (set_source_date_epoch_envvar): New function, sets the SOURCE_DATE_EPOCH environment variable to the current time. gcc/testsuite/ChangeLog: 2016-05-13 Eduard Sanou * gcc.dg/cpp/source_date_epoch-1.c: New file, test the proper behaviour of the macros __DATE__ and __TIME__ when SOURCE_DATE_EPOCH env var is set. * gcc.dg/cpp/source_date_epoch-2.c: New file, test the error output when parsing the SOURCE_DATE_EPOCH env var, and make sure it is only shown once. * lib/gcc-dg.exp (dg-set-compiler-env-var): New function, set env vars during compilation. * lib/gcc-dg.exp (restore-compiler-env-var): New function, restore env vars set by dg-set-compiler-env-var. libcpp/ChangeLog: 2016-05-13 Eduard Sanou * include/cpplib.h (cpp_callbacks): Add get_source_date_epoch callback. * include/cpplib.h (cpp_init_source_date_epoch): Remove prototype. * init.c (cpp_init_source_date_epoch): Remove function. * init.c (cpp_create_reader): Initialize pfile->source_date_epoch. * internal.h (cpp_reader): Extend comment about source_date_epoch. * macro.c (_cpp_builtin_macro_text): Use get_source_date_epoch callback only once, read pfile->source_date_epoch on future passes. Check that get_source_date_epoch callback is not NULL. From-SVN: r237001 --- gcc/doc/cppenv.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/doc/cppenv.texi') diff --git a/gcc/doc/cppenv.texi b/gcc/doc/cppenv.texi index e958e93..8cefd52 100644 --- a/gcc/doc/cppenv.texi +++ b/gcc/doc/cppenv.texi @@ -81,7 +81,6 @@ main input file is omitted. @end ifclear @item SOURCE_DATE_EPOCH - If this variable is set, its value specifies a UNIX timestamp to be used in replacement of the current date and time in the @code{__DATE__} and @code{__TIME__} macros, so that the embedded timestamps become @@ -89,8 +88,9 @@ reproducible. The value of @env{SOURCE_DATE_EPOCH} must be a UNIX timestamp, defined as the number of seconds (excluding leap seconds) since -01 Jan 1970 00:00:00 represented in ASCII, identical to the output of -@samp{@command{date +%s}}. +01 Jan 1970 00:00:00 represented in ASCII; identical to the output of +@samp{@command{date +%s}} on GNU/Linux and other systems that support the +@code{%s} extension in the @code{date} command. The value should be a known timestamp such as the last modification time of the source or package and it should be set by the build -- cgit v1.1