From 69375a37dead5fb85418ed6f652902a3d310bf2f Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 13 Apr 1997 12:49:45 -0400 Subject: [PATCH] cexp.y (warn_undef): New variable. (exp): Optionally warn about undefined identifiers that evaluate to 0. From-SVN: r13877 --- gcc/cexp.y | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } ; -- 2.30.2