diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2018-07-18 19:36:01 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2018-07-18 19:36:01 +0000 |
commit | 6f41f92bebfb0b5eb3a3859b1c3bb7710d1cb48b (patch) | |
tree | 2b8cce2b14c4b6bdf5c483562bfbf676ff3cab6e /libcpp | |
parent | 6457b1f096d216ca742f8e1f2a93462ecb24b38d (diff) | |
download | gcc-6f41f92bebfb0b5eb3a3859b1c3bb7710d1cb48b.zip gcc-6f41f92bebfb0b5eb3a3859b1c3bb7710d1cb48b.tar.gz gcc-6f41f92bebfb0b5eb3a3859b1c3bb7710d1cb48b.tar.bz2 |
re PR c/69558 (glib2 warning pragmas stopped working)
libcpp:
2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de>
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 <bernd.edlinger@hotmail.de>
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.
From-SVN: r262861
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 7 | ||||
-rw-r--r-- | libcpp/macro.c | 32 |
2 files changed, 21 insertions, 18 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 3fef9c9..c57d546 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,10 @@ +2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de> + + 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. + 2018-07-17 Jason Franklin <j_fra@fastmail.us> Jakub Jelinek <jakub@redhat.com> diff --git a/libcpp/macro.c b/libcpp/macro.c index 776af7b..683f918 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1410,29 +1410,25 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node, pfile->about_to_expand_macro_p = false; /* Handle built-in macros and the _Pragma operator. */ { - source_location loc, expand_loc; + source_location expand_loc; if (/* The top-level macro invocation that triggered the expansion - we are looking at is with a standard macro ...*/ + we are looking at is with a standard macro ... */ !(pfile->top_most_macro_node->flags & NODE_BUILTIN) - /* ... and it's a function-like macro invocation. */ - && pfile->top_most_macro_node->value.macro->fun_like) - { - /* Then the location of the end of the macro invocation is the - location of the closing parenthesis. */ - loc = pfile->cur_token[-1].src_loc; - expand_loc = loc; - } + /* ... and it's a function-like macro invocation, */ + && pfile->top_most_macro_node->value.macro->fun_like + /* ... and we are tracking the macro expansion. */ + && CPP_OPTION (pfile, track_macro_expansion)) + /* Then the location of the end of the macro invocation is the + location of the expansion point of this macro. */ + expand_loc = location; else - { - /* Otherwise, the location of the end of the macro invocation is - the location of the expansion point of that top-level macro - invocation. */ - loc = location; - expand_loc = pfile->invocation_location; - } + /* Otherwise, the location of the end of the macro invocation is + the location of the expansion point of that top-level macro + invocation. */ + expand_loc = pfile->invocation_location; - return builtin_macro (pfile, node, loc, expand_loc); + return builtin_macro (pfile, node, location, expand_loc); } } |