From: Neil Booth Date: Tue, 6 Feb 2001 20:07:07 +0000 (+0000) Subject: cppexp.c (parse_defined): Improve diagnostics for invalid syntax. X-Git-Tag: prereleases/libstdc++-2.92~1085 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c8465d07749a7f4ce6337d65f609bcef43ef890;p=thirdparty%2Fgcc.git cppexp.c (parse_defined): Improve diagnostics for invalid syntax. * cppexp.c (parse_defined): Improve diagnostics for invalid syntax. From-SVN: r39500 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b53f80adb0fb..6273b2ae5a4d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-02-06 Neil Booth + + * cppexp.c (parse_defined): Improve diagnostics for invalid + syntax. + 2001-02-06 Neil Booth * cppmacro.c (cpp_get_token): Avoid pasting after a builtin. diff --git a/gcc/cppexp.c b/gcc/cppexp.c index 3031997b0aa1..bea20a22ce5d 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -344,7 +344,20 @@ parse_defined (pfile) } } else - cpp_error (pfile, "\"defined\" without an identifier"); + { + cpp_error (pfile, "operator \"defined\" requires an identifier"); + if (token.flags & NAMED_OP) + { + cpp_token op; + + op.flags = 0; + op.type = token.type; + cpp_error (pfile, + "(\"%s\" is an alternative token for \"%s\" in C++)", + cpp_token_as_text (pfile, &token), + cpp_token_as_text (pfile, &op)); + } + } if (!node) op.op = CPP_ERROR;