diff options
author | Jakub Jelinek <jakub@redhat.com> | 2000-06-08 00:27:57 +0200 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-06-07 22:27:57 +0000 |
commit | 5af7e2c2e1949e500d44d78d25f98cd3cfdf3e3c (patch) | |
tree | f7aa6b7905149647216d26d181d5e60eb5b4e9cf /gcc/cpplib.c | |
parent | 69197e7e5ead2bebae71ed62532a9d422222684a (diff) | |
download | gcc-5af7e2c2e1949e500d44d78d25f98cd3cfdf3e3c.zip gcc-5af7e2c2e1949e500d44d78d25f98cd3cfdf3e3c.tar.gz gcc-5af7e2c2e1949e500d44d78d25f98cd3cfdf3e3c.tar.bz2 |
cpplib.c (do_ifdef, do_ifndef): Don't segfault if parse_ifdef returned NULL.
2000-06-06 Jakub Jelinek <jakub@redhat.com>
* cpplib.c (do_ifdef, do_ifndef): Don't segfault if parse_ifdef
returned NULL.
From-SVN: r34448
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 529d1bb..60dfbdd 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -1126,10 +1126,13 @@ do_ifdef (pfile) { int def = 0; const cpp_hashnode *node = parse_ifdef (pfile, dtable[T_IFDEF].name); - if (node->type == T_POISON) - cpp_error (pfile, "attempt to use poisoned `%s'", node->name); - else - def = (node->type != T_VOID); + if (node) + { + if (node->type == T_POISON) + cpp_error (pfile, "attempt to use poisoned `%s'", node->name); + else + def = (node->type != T_VOID); + } push_conditional (pfile, !def, T_IFDEF, 0); return 0; } @@ -1147,11 +1150,13 @@ do_ifndef (pfile) start_of_file = pfile->only_seen_white == 2; cmacro = parse_ifdef (pfile, dtable[T_IFNDEF].name); - if (cmacro->type == T_POISON) - cpp_error (pfile, "attempt to use poisoned `%s'", cmacro->name); - else - def = (cmacro->type != T_VOID); - + if (cmacro) + { + if (cmacro->type == T_POISON) + cpp_error (pfile, "attempt to use poisoned `%s'", cmacro->name); + else + def = (cmacro->type != T_VOID); + } push_conditional (pfile, def, T_IFNDEF, start_of_file ? cmacro : 0); return 0; |