diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-opts.c | 2 | ||||
-rw-r--r-- | gcc/c-parser.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/pr7263-2.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/pr7263-2.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/pr7263-3.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/pr7263-3.h | 3 |
8 files changed, 85 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 514915f..747e45b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + PR cpp/7263 + * c-opts.c (cpp_opts): Remove static. + * c-parser.c (cpp_opts): Declare it extern. + (disable_extension_diagnostics): Handle cpp options. + (enable_extension_diagnostics): Likewise. + +2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + * diagnostics.c (permerror_at): Rename as permerror. (permerror): Delete. * toplev.h: Likewise. diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 300bf14..dccb45e 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -54,7 +54,7 @@ along with GCC; see the file COPYING3. If not see #endif /* CPP's options. */ -static cpp_options *cpp_opts; +cpp_options *cpp_opts; /* Input filename. */ static const char *this_input_filename; diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 1ea9d07..ccec660 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -805,6 +805,9 @@ c_parser_skip_to_end_of_block_or_statement (c_parser *parser) parser->error = false; } +/* CPP's options (initialized by c-opts.c). */ +extern cpp_options *cpp_opts; + /* Save the warning flags which are controlled by __extension__. */ static inline int @@ -813,11 +816,15 @@ disable_extension_diagnostics (void) int ret = (pedantic | (warn_pointer_arith << 1) | (warn_traditional << 2) - | (flag_iso << 3)); - pedantic = 0; + | (flag_iso << 3) + | (warn_long_long << 4) + | (cpp_opts->warn_long_long << 5)); + cpp_opts->pedantic = pedantic = 0; warn_pointer_arith = 0; - warn_traditional = 0; + cpp_opts->warn_traditional = warn_traditional = 0; flag_iso = 0; + warn_long_long = 0; + cpp_opts->warn_long_long = 0; return ret; } @@ -827,10 +834,12 @@ disable_extension_diagnostics (void) static inline void restore_extension_diagnostics (int flags) { - pedantic = flags & 1; + cpp_opts->pedantic = pedantic = flags & 1; warn_pointer_arith = (flags >> 1) & 1; - warn_traditional = (flags >> 2) & 1; + cpp_opts->warn_traditional = warn_traditional = (flags >> 2) & 1; flag_iso = (flags >> 3) & 1; + warn_long_long = (flags >> 4) & 1; + cpp_opts->warn_long_long = (flags >> 5) & 1; } /* Possibly kinds of declarator to parse. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 56cd326..ff5dcd9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR cpp/7263 + * gcc.dg/cpp/pr7263-2.c: New. + * gcc.dg/cpp/pr7263-2.h: New. + * gcc.dg/cpp/pr7263-3.c: New. + * gcc.dg/cpp/pr7263-3.h: New. + 2008-08-18 Robert Dewar <dewar@adacore.com> PR ada/30827 diff --git a/gcc/testsuite/gcc.dg/cpp/pr7263-2.c b/gcc/testsuite/gcc.dg/cpp/pr7263-2.c new file mode 100644 index 0000000..5ed10d0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr7263-2.c @@ -0,0 +1,28 @@ +/* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */ +/* { dg-do compile } */ +/* { dg-options "-std=c89 -pedantic-errors" } */ +#include "pr7263-2.h" +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar () +{ + return BIG_EXT; +} + +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar2 () +{ + return 0x1b27da572ef3cd86ULL; /* { dg-error "use of C99 long long integer constant" } */ +} + + +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar3 () +{ + return __extension__ (0x1b27da572ef3cd86ULL); +} + +__extension__ unsigned long long +bar4 () +{ + return BIG; +} diff --git a/gcc/testsuite/gcc.dg/cpp/pr7263-2.h b/gcc/testsuite/gcc.dg/cpp/pr7263-2.h new file mode 100644 index 0000000..54f1757 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr7263-2.h @@ -0,0 +1,4 @@ +#define BIG_EXT __extension__(0x1b27da572ef3cd86ULL) + +#define BIG 0x1b27da572ef3cd86ULL + diff --git a/gcc/testsuite/gcc.dg/cpp/pr7263-3.c b/gcc/testsuite/gcc.dg/cpp/pr7263-3.c new file mode 100644 index 0000000..efa619a --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr7263-3.c @@ -0,0 +1,19 @@ +/* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ +#include "pr7263-3.h" +__complex__ bar () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */ +{ + return _Complex_I_ext; +} + +__extension__ __complex__ +bar2 () +{ + return _Complex_I; +} + +__complex__ bar3 () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */ +{ + return _Complex_I; /* { dg-error "imaginary constants are a GCC extension" } */ +} diff --git a/gcc/testsuite/gcc.dg/cpp/pr7263-3.h b/gcc/testsuite/gcc.dg/cpp/pr7263-3.h new file mode 100644 index 0000000..ad6690e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr7263-3.h @@ -0,0 +1,3 @@ +#define _Complex_I_ext (__extension__ 1.0iF) + +#define _Complex_I (1.0iF) |