diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-04-13 16:49:45 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-04-13 16:49:45 +0000 |
commit | 545b55154c7d752a4ac1844ff9e770174a7a8ae9 (patch) | |
tree | c7a4b057d177059ee52a1cd51006af2d845f5eb9 /gcc/cexp.y | |
parent | 830f902d877f1893176d042aa756de26e1904b4f (diff) | |
download | gcc-545b55154c7d752a4ac1844ff9e770174a7a8ae9.tar.gz |
cexp.y (warn_undef): New variable.
(exp): Optionally warn about undefined identifiers that evaluate to 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cexp.y')
-rw-r--r-- | gcc/cexp.y | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cexp.y b/gcc/cexp.y index 2d2d34f8b28..133539f6c5d 100644 --- a/gcc/cexp.y +++ b/gcc/cexp.y @@ -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; } ; |