aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-04-13 12:49:45 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1997-04-13 12:49:45 -0400
commit69375a37dead5fb85418ed6f652902a3d310bf2f (patch)
treec7a4b057d177059ee52a1cd51006af2d845f5eb9 /gcc
parent10c1b9f6899886fade41f1fc8c896d7143c4c18c (diff)
downloadgcc-69375a37dead5fb85418ed6f652902a3d310bf2f.zip
gcc-69375a37dead5fb85418ed6f652902a3d310bf2f.tar.gz
gcc-69375a37dead5fb85418ed6f652902a3d310bf2f.tar.bz2
cexp.y (warn_undef): New variable.
(exp): Optionally warn about undefined identifiers that evaluate to 0. From-SVN: r13877
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cexp.y8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cexp.y b/gcc/cexp.y
index 2d2d34f..133539f 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; }
;