diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2011-03-21 16:21:30 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2011-03-21 16:21:30 +0000 |
commit | f3c33d9dc88ca9b2452a9ea3d42d9a6363b66663 (patch) | |
tree | a11038042e07218234e45c1da1c876bdbdf8c2d5 /libcpp | |
parent | ac43f774369194320ba2368b21550d4aa5ca97b9 (diff) | |
download | gcc-f3c33d9dc88ca9b2452a9ea3d42d9a6363b66663.tar.gz |
Make UNSPEC/UNSPECV constants use the enum; Fix 48192; Add test case for 48053
From-SVN: r171247
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/directives.c | 14 | ||||
-rw-r--r-- | libcpp/expr.c | 7 |
3 files changed, 26 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 6ef4788d99a..c08e6fe139b 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2011-03-21 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR preprocessor/48192 + * directives.c (do_ifdef): Do not consider conditional macros as + being defined. + (do_ifndef): Ditto. + * expr.c (parse_defined): Ditto. + 2011-03-18 Richard Henderson <rth@redhat.com> PR bootstrap/45381 diff --git a/libcpp/directives.c b/libcpp/directives.c index 85a17b146c2..f244ae5b5b2 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -1819,7 +1819,12 @@ do_ifdef (cpp_reader *pfile) if (node) { - skip = node->type != NT_MACRO; + /* Do not treat conditional macros as being defined. This is due to + the powerpc and spu ports using conditional macros for 'vector', + 'bool', and 'pixel' to act as conditional keywords. This messes + up tests like #ifndef bool. */ + skip = (node->type != NT_MACRO + || ((node->flags & NODE_CONDITIONAL) != 0)); _cpp_mark_macro_used (node); if (!(node->flags & NODE_USED)) { @@ -1860,7 +1865,12 @@ do_ifndef (cpp_reader *pfile) if (node) { - skip = node->type == NT_MACRO; + /* Do not treat conditional macros as being defined. This is due to + the powerpc and spu ports using conditional macros for 'vector', + 'bool', and 'pixel' to act as conditional keywords. This messes + up tests like #ifndef bool. */ + skip = (node->type == NT_MACRO + && ((node->flags & NODE_CONDITIONAL) == 0)); _cpp_mark_macro_used (node); if (!(node->flags & NODE_USED)) { diff --git a/libcpp/expr.c b/libcpp/expr.c index d2fec2a56a6..3c36127b54f 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -720,10 +720,15 @@ parse_defined (cpp_reader *pfile) pfile->state.prevent_expansion--; + /* Do not treat conditional macros as being defined. This is due to the + powerpc and spu ports using conditional macros for 'vector', 'bool', and + 'pixel' to act as conditional keywords. This messes up tests like #ifndef + bool. */ result.unsignedp = false; result.high = 0; result.overflow = false; - result.low = node && node->type == NT_MACRO; + result.low = (node && node->type == NT_MACRO + && (node->flags & NODE_CONDITIONAL) == 0); return result; } |