cexp.y (warn_undef): New variable.

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

From-SVN: r13877
This commit is contained in:
Richard Kenner 1997-04-13 12:49:45 -04:00
parent 10c1b9f689
commit 69375a37de

View File

@ -164,6 +164,9 @@ extern int traditional;
/* Flag for -lang-c89. */
extern int c89;
/* Flag for -Wundef. */
extern int warn_undef;
#ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif
@ -445,7 +448,10 @@ exp : exp '*' exp
| CHAR
{ $$ = yylval.integer; }
| NAME
{ $$.value = 0;
{ if (warn_undef && !skip_evaluation)
warning ("`%.*s' is not defined",
$1.length, $1.address);
$$.value = 0;
$$.signedp = SIGNED; }
;