* cppexp.c (parse_defined): Improve diagnostics for invalid
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Feb 2001 20:07:07 +0000 (20:07 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Feb 2001 20:07:07 +0000 (20:07 +0000)
        syntax.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39500 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cppexp.c

index b53f80a..6273b2a 100644 (file)
@@ -1,5 +1,10 @@
 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.
 
 2001-02-06  Mark Mitchell  <mark@codesourcery.com>
index 3031997..bea20a2 100644 (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;