From 6f13b088ea39478047295e2da3a674d402a32b99 Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 1 Feb 2016 22:36:07 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233058 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 7 +++++++ gcc/c-family/c-pragma.c | 5 ++++- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.dg/pr69543.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.dg/pr69558.c | 17 +++++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr69543.c create mode 100644 gcc/testsuite/gcc.dg/pr69558.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 5bd7d3b..abe9701 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2016-02-01 Jakub Jelinek + + PR preprocessor/69543 + PR c/69558 + * c-pragma.c (handle_pragma_diagnostic): Pass input_location + instead of loc to control_warning_option. + 2016-02-01 Nathan Sidwell * c.opt (fopenacc-dim=): New option. diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 4e72f65..38aabc0 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -817,9 +817,12 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy)) const char *arg = NULL; if (cl_options[option_index].flags & CL_JOINED) arg = option_string + 1 + cl_options[option_index].opt_len; + /* FIXME: input_location isn't the best location here, but it is + what we used to do here before and changing it breaks e.g. + PR69543 and PR69558. */ 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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e356e6e..73b0ce8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-02-01 Jakub Jelinek + + PR preprocessor/69543 + PR c/69558 + * gcc.dg/pr69543.c: New test. + * gcc.dg/pr69558.c: New test. + 2016-02-01 Uros Bizjak PR testsuite/65940 diff --git a/gcc/testsuite/gcc.dg/pr69543.c b/gcc/testsuite/gcc.dg/pr69543.c new file mode 100644 index 0000000..0bb5da0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69543.c @@ -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 +} diff --git a/gcc/testsuite/gcc.dg/pr69558.c b/gcc/testsuite/gcc.dg/pr69558.c new file mode 100644 index 0000000..3be8cf9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69558.c @@ -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" } */ -- 2.7.4