[Bug c/69558] [6/7/8/9 Regression] glib2 warning pragmas stopped working

2018-07-18 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69558

--- Comment #25 from Bernd Edlinger  ---
Author: edlinger
Date: Wed Jul 18 19:36:01 2018
New Revision: 262861

URL: https://gcc.gnu.org/viewcvs?rev=262861=gcc=rev
Log:
libcpp:
2018-07-18  Bernd Edlinger  

PR 69558
* macro.c (enter_macro_context): Change the location info for builtin
macros and _Pragma from location of the closing parenthesis to location
of the macro expansion point.

testsuite:
2018-07-18  Bernd Edlinger  

PR 69558
* c-c++-common/cpp/diagnostic-pragma-2.c: New test.
* c-c++-common/pr69558.c: Remove xfail.
* gcc.dg/cpp/builtin-macro-1.c: Adjust test expectations.
* gcc.dg/pr61817-1.c: Likewise.
* gcc.dg/pr61817-2.c: Likewise.
* g++.dg/plugin/pragma_plugin.c: Warn at expansion_point_location.

Added:
trunk/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-2.c
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/pr69558.c
trunk/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
trunk/gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c
trunk/gcc/testsuite/gcc.dg/pr61817-1.c
trunk/gcc/testsuite/gcc.dg/pr61817-2.c
trunk/libcpp/ChangeLog
trunk/libcpp/macro.c

[Bug c/69558] [6/7/8/9 Regression] glib2 warning pragmas stopped working

2018-07-04 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69558

Bernd Edlinger  changed:

   What|Removed |Added

 CC||bernd.edlinger at hotmail dot 
de

--- Comment #24 from Bernd Edlinger  ---
(In reply to Jakub Jelinek from comment #4)
> Reverting one minor part of those changes fixes both of the PRs though:
> --- gcc/c-family/c-pragma.c.jj2016-01-15 21:57:00.0 +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, ,
> +   input_location, lang_mask, ,
> _options, _options_set,
> global_dc);
>  }
> I have no idea why, but if it doesn't break anything else, I think it would
> be better to revert it.  The ChangeLog nor gcc-patches post doesn't mention
> that change anywhere.

FYI, I was there as well, and found the following.
loc points to the location of ")" in "C (foo)",
while input_location points to "C" in the C FE and to ")" in the C++ FE :-)

The reason why this does still not work in C++ is, that
the source code is sorted by location in this way:
"void foo (void) _Pragma ("GCC diagnostic push")
 Pragma ("GCC diagnostic ignored")"

at the time when the warning is issued.
while your patch fixed the C FE, by using the location of the macro expansion
pint for the _Pragma,
and therefore the stack looked again way:
"_Pragma ("push") _Pragma ("ignored") void foo (void)"
This works only because the warning is printed immediately.
For late warnings the situation would look like
"_Pragma ("push") _Pragma ("ignored") _Pragma ("pop") warning_location"

[Bug c/69558] [6/7/8/9 Regression] glib2 warning pragmas stopped working

2018-05-28 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69558

--- Comment #23 from Eric Gallager  ---
(In reply to David Malcolm from comment #22)
> Assigning this to me in the hope that I'll get to it in gcc 9 stage 1.

It's gcc 9 stage 1 now.

[Bug c/69558] [6/7/8/9 Regression] glib2 warning pragmas stopped working

2018-02-07 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69558

David Malcolm  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |dmalcolm at gcc dot 
gnu.org

--- Comment #22 from David Malcolm  ---
Assigning this to me in the hope that I'll get to it in gcc 9 stage 1.

[Bug c/69558] [6/7/8/9 Regression] glib2 warning pragmas stopped working

2018-01-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69558

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.0 |9.0
Summary|[6/7/8 Regression] glib2|[6/7/8/9 Regression] glib2
   |warning pragmas stopped |warning pragmas stopped
   |working |working

--- Comment #21 from Jakub Jelinek  ---
Same arguments that deferred this to gcc-8 apply now to defer it to gcc-9.
David, do you think you could handle this for GCC9?