(create_definition): Warn about `#define a@'...
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 8 Aug 1994 23:41:47 +0000 (19:41 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 8 Aug 1994 23:41:47 +0000 (19:41 -0400)
(create_definition): Warn about `#define a@', since a diagnostic is
now required (see ISO TC1's addition to subclause 6.8).  Also warn
about `#define is-empty(x) (!x)'.

From-SVN: r7877

gcc/cccp.c

index a35336d761045a6a8de9373a368fe71989f36d0b..c0678d01f2f8e4fac7b83fc76d4500c55db6ae53 100644 (file)
@@ -5368,9 +5368,31 @@ create_definition (buf, limit, op)
   } else {
     /* Simple expansion or empty definition.  */
 
-    /* Skip spaces and tabs if any.  */
-    while (bp < limit && (*bp == ' ' || *bp == '\t'))
-      ++bp;
+    if (bp < limit)
+      {
+       switch (*bp)
+         {
+           case '\t': case ' ':
+             /* Skip spaces and tabs.  */
+             while (++bp < limit && (*bp == ' ' || *bp == '\t'))
+               continue;
+             break;
+
+           case '!':  case '"':  case '#':  case '%':  case '&':  case '\'':
+           case ')':  case '*':  case '+':  case ',':  case '-':  case '.':
+           case '/':  case ':':  case ';':  case '<':  case '=':  case '>':
+           case '?':  case '[':  case '\\': case ']':  case '^':  case '{':
+           case '|':  case '}':  case '~':
+             warning ("missing white space after `#define %.*s'",
+                      sym_length, symname);
+             break;
+
+           default:
+             pedwarn ("missing white space after `#define %.*s'",
+                      sym_length, symname);
+             break;
+         }
+      }
     /* Now everything from bp before limit is the definition. */
     defn = collect_expansion (bp, limit, -1, NULL_PTR);
     defn->args.argnames = (U_CHAR *) "";