Commit 69375a37 by Richard Kenner

cexp.y (warn_undef): New variable.

(exp): Optionally warn about undefined identifiers that evaluate to 0.

From-SVN: r13877
parent 10c1b9f6
...@@ -164,6 +164,9 @@ extern int traditional; ...@@ -164,6 +164,9 @@ extern int traditional;
/* Flag for -lang-c89. */ /* Flag for -lang-c89. */
extern int c89; extern int c89;
/* Flag for -Wundef. */
extern int warn_undef;
#ifndef CHAR_TYPE_SIZE #ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT #define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif #endif
...@@ -445,7 +448,10 @@ exp : exp '*' exp ...@@ -445,7 +448,10 @@ exp : exp '*' exp
| CHAR | CHAR
{ $$ = yylval.integer; } { $$ = yylval.integer; }
| NAME | NAME
{ $$.value = 0; { if (warn_undef && !skip_evaluation)
warning ("`%.*s' is not defined",
$1.length, $1.address);
$$.value = 0;
$$.signedp = SIGNED; } $$.signedp = SIGNED; }
; ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment