aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-08-08 19:41:47 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-08-08 19:41:47 -0400
commitfbcd3360678c348338fefdf6767dcdf376835e80 (patch)
tree48684bc5bf99bafc53c299518553afc39cbf9905 /gcc
parent73b2ad9e646a0fd610eaad04faca02f8b34eb143 (diff)
downloadgcc-fbcd3360678c348338fefdf6767dcdf376835e80.zip
gcc-fbcd3360678c348338fefdf6767dcdf376835e80.tar.gz
gcc-fbcd3360678c348338fefdf6767dcdf376835e80.tar.bz2
(create_definition): Warn about `#define a@'...
(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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index a35336d..c0678d0 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -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 *) "";