summaryrefslogtreecommitdiffstats
path: root/libcpp/macro.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-05 20:27:22 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-05 20:27:22 +0000
commit9148bda34df16c7d191cddbe5553bf013b1a7bd8 (patch)
tree61e37f9572a53a1c03ae93e5c3d39f8427a2be96 /libcpp/macro.c
parent063d85f46074cecfaf693f5a0aea19a2dcfa546e (diff)
downloadppe42-gcc-9148bda34df16c7d191cddbe5553bf013b1a7bd8.tar.gz
ppe42-gcc-9148bda34df16c7d191cddbe5553bf013b1a7bd8.zip
2013-11-05 Tobias Burnus <burnus@net-b.de>
gcc/c-family/ * c.opt (-Wdate-time): New option * c-opts.c (sanitize_cpp_opts): Pass on to libcpp. gcc/ * doc/invoke.texi (-Wdate-time): Document. gcc/fortran * lang.opt (-Wdate-time): New option * cpp.c (gfc_cpp_option_data): Add warn_date_time. (gfc_cpp_init_options, gfc_cpp_handle_option, gfc_cpp_post_options): Handle it and pass on to libcpp. gcc/testsuite/ * g++.dg/warn/wdate-time.C: New. * gcc.dg/wdate-time.c: New. * gfortran.dg/wdate-time.F90: New. libcpp/ * include/cpplib.h (CPP_W_DATE_TIME): Added. (cpp_options): Add warn_date_time. * init.c (cpp_create_reader): Init it. * macro.c (_cpp_builtin_macro_text): Warn when __DATE__/__TIME__/__TIMESTAMP__ is used. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 6d46027e4ea..3a1728d6663 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -232,6 +232,10 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
case BT_TIMESTAMP:
{
+ if (CPP_OPTION (pfile, warn_date_time))
+ cpp_warning (pfile, CPP_W_DATE_TIME, "Macro \"%s\" might prevent "
+ "reproduce builds", NODE_NAME (node));
+
cpp_buffer *pbuffer = cpp_get_buffer (pfile);
if (pbuffer->timestamp == NULL)
{
@@ -325,6 +329,9 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
case BT_DATE:
case BT_TIME:
+ if (CPP_OPTION (pfile, warn_date_time))
+ cpp_warning (pfile, CPP_W_DATE_TIME, "Macro \"%s\" might prevent "
+ "reproduce builds", NODE_NAME (node));
if (pfile->date == NULL)
{
/* Allocate __DATE__ and __TIME__ strings from permanent
OpenPOWER on IntegriCloud