cppexp.c (parse_defined): Improve diagnostics for invalid syntax.

* cppexp.c (parse_defined): Improve diagnostics for invalid
        syntax.

From-SVN: r39500
This commit is contained in:
Neil Booth 2001-02-06 20:07:07 +00:00 committed by Neil Booth
parent f2f7ac4038
commit 3c8465d077
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk>
* cppexp.c (parse_defined): Improve diagnostics for invalid
syntax.
2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk>
* cppmacro.c (cpp_get_token): Avoid pasting after a builtin.

View File

@ -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;