aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>1999-09-09 04:00:37 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>1999-09-09 04:00:37 +0000
commitfc009f966c98317401b51127f59de4ad37bb7d19 (patch)
treeadfb849ae0813b5bacab43fb7a7ab5ec23bc7fb6 /gcc/cppexp.c
parentd60f72aec57414b8339eecb25c33b423af7e6946 (diff)
downloadgcc-fc009f966c98317401b51127f59de4ad37bb7d19.zip
gcc-fc009f966c98317401b51127f59de4ad37bb7d19.tar.gz
gcc-fc009f966c98317401b51127f59de4ad37bb7d19.tar.bz2
Makefile.in (cppexp.o): Depend on cpphash.h.
* Makefile.in (cppexp.o): Depend on cpphash.h. * cppexp.c (cpp_lex): Handle `defined (xxx)' for poisoned xxx. Include cpphash.h. * cpphash.c (special_symbol): Handle plain `xxx' for poisoned xxx. * cpplib.c (do_define): Generalise to handle poisoned definitions, redefining poisoned identifiers, etc. (do_undef): Don't allow poisoned identifiers to be undefined. (do_pragma): Add #pragma poison. (do_xifdef): Handle `#ifdef xxx' for poisoned xxx. * cccp.c: Add T_POISON node type. (special_symbol): Handle `defined(xxx)' and plain `xxx' for poisoned xxx. (do_define): Generalise to handle poisoned definitions, redefining poisoned identifiers, etc. (do_undef): Don't allow poisoned identifiers to be undefined. (do_pragma): Add #pragma poison. (do_xifdef): Handle `#ifdef xxx' for poisoned xxx. * c-pragma.c (handle_pragma_token): Ignore #pragma poison. * c-pragma.h: Add ps_poison state. We now always have generic pragmas. From-SVN: r29224
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 330236e..f037924 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -27,6 +27,7 @@ Written by Per Bothner 1994. */
#include "config.h"
#include "system.h"
#include "cpplib.h"
+#include "cpphash.h"
#ifdef MULTIBYTE_CHARS
#include <locale.h>
@@ -445,6 +446,7 @@ cpp_lex (pfile, skip_evaluation)
int paren = 0, len;
cpp_buffer *ip = CPP_BUFFER (pfile);
U_CHAR *tok;
+ HASHNODE *hp;
cpp_skip_hspace (pfile);
if (*ip->cur == '(')
@@ -469,9 +471,14 @@ cpp_lex (pfile, skip_evaluation)
goto oops;
++ip->cur;
}
- if (cpp_lookup (pfile, tok, len, -1))
- op.value = 1;
-
+ hp = cpp_lookup (pfile, tok, len, -1);
+ if (hp != NULL)
+ {
+ if (hp->type == T_POISON)
+ cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
+ else
+ op.value = 1;
+ }
}
return op;