aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.c
diff options
context:
space:
mode:
authorEdward Smith-Rowland <3dw4rd@verizon.net>2014-07-10 22:26:50 +0000
committerEdward Smith-Rowland <emsr@gcc.gnu.org>2014-07-10 22:26:50 +0000
commit3976796b6ded6ef5c84c087ab880ec8d2fcfa48a (patch)
tree85c3bdc9927029974392deb0bbf99aa974e8fcbb /libcpp/lex.c
parenta25b76d802c2df2b082b874f242d089d1a2bb42a (diff)
downloadgcc-3976796b6ded6ef5c84c087ab880ec8d2fcfa48a.zip
gcc-3976796b6ded6ef5c84c087ab880ec8d2fcfa48a.tar.gz
gcc-3976796b6ded6ef5c84c087ab880ec8d2fcfa48a.tar.bz2
re PR preprocessor/61389 (libcpp diagnostics shouldn't talk about ISO C99 for C++ input files)
2014-07-10 Edward Smith-Rowland <3dw4rd@verizon.net> Jonathan Wakely <jwakely@redhat.com> PR CPP/61389 * macro.c (_cpp_arguments_ok, parse_params, create_iso_definition): Warning messages mention C++11 in c++ mode and C99 in c mode. * lex.c (lex_identifier_intern, lex_identifier): Ditto Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r212441
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r--libcpp/lex.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 9130cbc..7e2db64 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1175,9 +1175,16 @@ lex_identifier_intern (cpp_reader *pfile, const uchar *base)
replacement list of a variadic macro. */
if (result == pfile->spec_nodes.n__VA_ARGS__
&& !pfile->state.va_args_ok)
- cpp_error (pfile, CPP_DL_PEDWARN,
- "__VA_ARGS__ can only appear in the expansion"
- " of a C99 variadic macro");
+ {
+ if (CPP_OPTION (pfile, cplusplus))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "__VA_ARGS__ can only appear in the expansion"
+ " of a C++11 variadic macro");
+ else
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "__VA_ARGS__ can only appear in the expansion"
+ " of a C99 variadic macro");
+ }
/* For -Wc++-compat, warn about use of C++ named operators. */
if (result->flags & NODE_WARN_OPERATOR)
@@ -1255,9 +1262,16 @@ lex_identifier (cpp_reader *pfile, const uchar *base, bool starts_ucn,
replacement list of a variadic macro. */
if (result == pfile->spec_nodes.n__VA_ARGS__
&& !pfile->state.va_args_ok)
- cpp_error (pfile, CPP_DL_PEDWARN,
- "__VA_ARGS__ can only appear in the expansion"
- " of a C99 variadic macro");
+ {
+ if (CPP_OPTION (pfile, cplusplus))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "__VA_ARGS__ can only appear in the expansion"
+ " of a C++11 variadic macro");
+ else
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "__VA_ARGS__ can only appear in the expansion"
+ " of a C99 variadic macro");
+ }
/* For -Wc++-compat, warn about use of C++ named operators. */
if (result->flags & NODE_WARN_OPERATOR)