summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.h
diff options
context:
space:
mode:
authordoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-01 16:42:41 +0000
committerdoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-01 16:42:41 +0000
commitdfa5c0d3f3e23e4fdb14857a42de376d9ff8601c (patch)
tree6111e9d43417c0a01997f03f171b4d3df5f399a5 /gcc/c-family/c-common.h
parentabce4377d7432967c98ad2bcb831bed92ccee3a2 (diff)
downloadgcc-dfa5c0d3f3e23e4fdb14857a42de376d9ff8601c.tar.gz
gcc/c-family/ChangeLog:
2016-05-13 Eduard Sanou <dhole@openmailbox.org> * 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 <dhole@openmailbox.org> * 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 <dhole@openmailbox.org> * 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 <dhole@openmailbox.org> * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237001 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-common.h')
-rw-r--r--gcc/c-family/c-common.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 0295532d3ea..4e6aa0051fa 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1088,6 +1088,16 @@ extern vec<tree, va_gc> *make_tree_vector_copy (const vec<tree, va_gc> *);
c_register_builtin_type. */
extern GTY(()) tree registered_builtin_types;
+/* Read SOURCE_DATE_EPOCH from environment to have a deterministic
+ timestamp to replace embedded current dates to get reproducible
+ results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */
+extern time_t cb_get_source_date_epoch (cpp_reader *pfile);
+
+/* The value (as a unix timestamp) corresponds to date
+ "Dec 31 9999 23:59:59 UTC", which is the latest date that __DATE__ and
+ __TIME__ can store. */
+#define MAX_SOURCE_DATE_EPOCH HOST_WIDE_INT_C (253402300799)
+
/* In c-gimplify.c */
extern void c_genericize (tree);
extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
@@ -1482,9 +1492,4 @@ extern bool valid_array_size_p (location_t, tree, tree);
extern bool cilk_ignorable_spawn_rhs_op (tree);
extern bool cilk_recognize_spawn (tree, tree *);
-/* Read SOURCE_DATE_EPOCH from environment to have a deterministic
- timestamp to replace embedded current dates to get reproducible
- results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */
-extern time_t get_source_date_epoch (void);
-
#endif /* ! GCC_C_COMMON_H */