summaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1997-04-13 16:50:58 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1997-04-13 16:50:58 +0000
commit62f190d9a8ce7f3f65fe2ef68cfc5880850e6427 (patch)
tree8037e1d99ae956e3c158179b4b9047694ea939e4 /gcc/cppexp.c
parentd004374db681a03e7da50d8b71fee62ab405a738 (diff)
downloadgcc-62f190d9a8ce7f3f65fe2ef68cfc5880850e6427.tar.gz
(cpp_lex) New arg skip_evaluation.
(cpp_parse_expr): Pass skip_evaluation to cpp_lex. Abort if cpp_lex returns NAME. (cpp_lex): Optionally warn about undefined identifiers that evaluate to 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13880 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 471818a9a91..e4a0dcd5bff 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -278,8 +278,9 @@ static struct token tokentab2[] = {
/* Read one token. */
struct operation
-cpp_lex (pfile)
+cpp_lex (pfile, skip_evaluation)
cpp_reader *pfile;
+ int skip_evaluation;
{
register int c;
register int namelen;
@@ -443,6 +444,9 @@ cpp_lex (pfile)
return op;
case CPP_NAME:
+ if (CPP_WARN_UNDEF (pfile) && !skip_evaluation)
+ cpp_warning (pfile, "`%.*s' is not defined",
+ (int) (tok_end - tok_start), tok_start);
return parse_number (pfile, "0", 0);
case CPP_OTHER:
@@ -684,7 +688,7 @@ cpp_parse_expr (pfile)
char flags = 0;
/* Read a token */
- op = cpp_lex (pfile);
+ op = cpp_lex (pfile, skip_evaluation);
/* See if the token is an operand, in which case go to set_value.
If the token is an operator, figure out its left and right
@@ -693,8 +697,7 @@ cpp_parse_expr (pfile)
switch (op.op)
{
case NAME:
- top->value = 0, top->unsignedp = 0;
- goto set_value;
+ abort ();
case INT: case CHAR:
top->value = op.value;
top->unsignedp = op.unsignedp;