diff options
author | Eduard Sanou <dhole@openmailbox.org> | 2016-04-28 09:12:05 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2016-04-28 09:12:05 +0000 |
commit | 174f66220d4d39ed503ded1ec3e7ba514cc4283e (patch) | |
tree | a72db5c4b6147a63f588b215e341061ba7b18de5 /gcc/doc/cppenv.texi | |
parent | a564d350951a990136fe6a5010b7eaa165f17c58 (diff) | |
download | gcc-174f66220d4d39ed503ded1ec3e7ba514cc4283e.zip gcc-174f66220d4d39ed503ded1ec3e7ba514cc4283e.tar.gz gcc-174f66220d4d39ed503ded1ec3e7ba514cc4283e.tar.bz2 |
c-common.c (get_source_date_epoch): New function...
gcc/c-family/ChangeLog:
2016-04-28 Eduard Sanou <dhole@openmailbox.org>
Matthias Klose <doko@debian.org>
* c-common.c (get_source_date_epoch): New function, gets the environment
variable SOURCE_DATE_EPOCH and parses it as long long with error
handling.
* c-common.h (get_source_date_epoch): Prototype.
* c-lex.c (c_lex_with_flags): set parse_in->source_date_epoch.
gcc/ChangeLog:
2016-04-28 Eduard Sanou <dhole@openmailbox.org>
Matthias Klose <doko@debian.org>
* doc/cppenv.texi: Document SOURCE_DATE_EPOCH environment variable.
libcpp/ChangeLog:
2016-04-28 Eduard Sanou <dhole@openmailbox.org>
Matthias Klose <doko@debian.org>
* include/cpplib.h (cpp_init_source_date_epoch): Prototype.
* init.c (cpp_init_source_date_epoch): New function.
* internal.h: Added source_date_epoch variable to struct
cpp_reader to store a reproducible date.
* macro.c (_cpp_builtin_macro_text): Set pfile->date timestamp from
pfile->source_date_epoch instead of localtime if source_date_epoch is
set, to be used for __DATE__ and __TIME__ macros to help reproducible
builds.
Co-Authored-By: Matthias Klose <doko@debian.org>
From-SVN: r235550
Diffstat (limited to 'gcc/doc/cppenv.texi')
-rw-r--r-- | gcc/doc/cppenv.texi | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/doc/cppenv.texi b/gcc/doc/cppenv.texi index 22c8cb3..e958e93 100644 --- a/gcc/doc/cppenv.texi +++ b/gcc/doc/cppenv.texi @@ -79,4 +79,21 @@ main input file is omitted. @ifclear cppmanual @xref{Preprocessor Options}. @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 +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}}. + +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 +process. + @end vtable |