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.
#endif
/* CPP's options. */
-static cpp_options *cpp_opts;
+cpp_options *cpp_opts;
/* Input filename. */
static const char *this_input_filename;
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
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;
}
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
--- /dev/null
+/* 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;
+}
--- /dev/null
+#define BIG_EXT __extension__(0x1b27da572ef3cd86ULL)
+
+#define BIG 0x1b27da572ef3cd86ULL
+
--- /dev/null
+/* 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" } */
+}
--- /dev/null
+#define _Complex_I_ext (__extension__ 1.0iF)
+
+#define _Complex_I (1.0iF)