gcc/gcc6-pr69558.patch

63 lines
2.0 KiB
Diff

2016-01-29 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/69543
PR c/69558
* c-pragma.c (handle_pragma_diagnostic): Pass input_location
instead of loc to control_warning_option.
* gcc.dg/pr69543.c: New test.
* gcc.dg/pr69558.c: New test.
--- gcc/c-family/c-pragma.c.jj 2016-01-15 21:57:00.000000000 +0100
+++ gcc/c-family/c-pragma.c 2016-01-29 18:34:51.743943283 +0100
@@ -819,7 +819,7 @@ handle_pragma_diagnostic(cpp_reader *ARG
arg = option_string + 1 + cl_options[option_index].opt_len;
control_warning_option (option_index, (int) kind,
arg, kind != DK_IGNORED,
- loc, lang_mask, &handlers,
+ input_location, lang_mask, &handlers,
&global_options, &global_options_set,
global_dc);
}
--- gcc/testsuite/gcc.dg/pr69558.c.jj 2016-01-29 18:43:32.191665058 +0100
+++ gcc/testsuite/gcc.dg/pr69558.c 2016-01-29 18:40:05.000000000 +0100
@@ -0,0 +1,17 @@
+/* PR c/69558 */
+/* { dg-do compile } */
+/* { dg-options "-Wdeprecated-declarations" } */
+
+#define A \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define B \
+ _Pragma ("GCC diagnostic pop")
+#define C(x) \
+ A \
+ static inline void bar (void) { x (); } \
+ B
+
+__attribute__((deprecated)) void foo (void); /* { dg-bogus "declared here" } */
+
+C (foo) /* { dg-bogus "is deprecated" } */
--- gcc/testsuite/gcc.dg/pr69543.c.jj 2016-01-29 18:45:09.520323395 +0100
+++ gcc/testsuite/gcc.dg/pr69543.c 2016-01-29 18:44:56.000000000 +0100
@@ -0,0 +1,18 @@
+/* PR preprocessor/69543 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+
+void test (char yylval)
+{
+ char *yyvsp;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}