re PR preprocessor/7263 (__extension__ keyword doesn't suppress warning on LL or ULL constants)

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.
testsuite/
	* 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.

From-SVN: r139194
parent cbe5f3b3
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.
......
......@@ -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;
......
......@@ -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. */
......
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
......
/* 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;
}
#define BIG_EXT __extension__(0x1b27da572ef3cd86ULL)
#define BIG 0x1b27da572ef3cd86ULL
/* 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" } */
}
#define _Complex_I_ext (__extension__ 1.0iF)
#define _Complex_I (1.0iF)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment