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 /gcc | |
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 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-2.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr69558.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/plugin/pragma_plugin.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr61817-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr61817-2.c | 6 |
7 files changed, 43 insertions, 18 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95c58fb..37354f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +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. + 2018-07-18 Janus Weil <janus@gcc.gnu.org> PR fortran/85599 diff --git a/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-2.c b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-2.c new file mode 100644 index 0000000..1163bbe --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +#define B _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wattributes\"") +#define E _Pragma("GCC diagnostic pop") + +#define X() B int __attribute((unknown_attr)) x; E /* { dg-bogus "attribute directive ignored" } */ +#define Y B int __attribute((unknown_attr)) y; E /* { dg-bogus "attribute directive ignored" } */ + +void test1(void) +{ + X() /* { dg-bogus "in expansion of macro" } */ + Y /* { dg-bogus "in expansion of macro" } */ +} diff --git a/gcc/testsuite/c-c++-common/pr69558.c b/gcc/testsuite/c-c++-common/pr69558.c index 4c6d498..a930653 100644 --- a/gcc/testsuite/c-c++-common/pr69558.c +++ b/gcc/testsuite/c-c++-common/pr69558.c @@ -11,9 +11,9 @@ _Pragma ("GCC diagnostic pop") #define C(x) \ A \ - static inline void bar (void) { x (); } /* { dg-bogus "in definition of|deprecated" "" { xfail { c++ } } } */ \ + static inline void bar (void) { x (); } /* { dg-bogus "in definition of|deprecated" "" } */ \ B -__attribute__((deprecated)) void foo (void); /* { dg-bogus "declared here" "" { xfail { c++ } } } */ +__attribute__((deprecated)) void foo (void); /* { dg-bogus "declared here" "" } */ C (foo) /* { dg-bogus "is deprecated" } */ diff --git a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c index 6f47398..d72842f 100644 --- a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c @@ -33,14 +33,15 @@ handle_pragma_sayhello (cpp_reader *dummy) } if (TREE_STRING_LENGTH (message) > 1) { + location_t loc = expansion_point_location (input_location); if (cfun) - warning (OPT_Wpragmas, - "%<pragma GCCPLUGIN sayhello%> from function %qE: %s", - cfun->decl, TREE_STRING_POINTER (message)); + warning_at (loc, OPT_Wpragmas, + "%<pragma GCCPLUGIN sayhello%> from function %qE: %s", + cfun->decl, TREE_STRING_POINTER (message)); else - warning (OPT_Wpragmas, - "%<pragma GCCPLUGIN sayhello%> outside of function: %s", - TREE_STRING_POINTER (message)); + warning_at (loc, OPT_Wpragmas, + "%<pragma GCCPLUGIN sayhello%> outside of function: %s", + TREE_STRING_POINTER (message)); } } diff --git a/gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c b/gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c index 90c2883..0f95003 100644 --- a/gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c +++ b/gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c @@ -1,8 +1,8 @@ /* Origin PR preprocessor/64803 This test ensures that the value the __LINE__ macro expands to is - constant and corresponds to the line of the closing parenthesis of - the top-most function-like macro expansion it's part of. + constant and corresponds to the line of the macro expansion point + the function-like macro expansion it's part of. { dg-do run } { do-options -no-integrated-cpp } */ @@ -19,8 +19,8 @@ main() M(a ); - assert(L20 == 20); /* 20 is the line number of the - closing parenthesis of the + assert(L19 == 19); /* 19 is the line number of the + macro expansion point of the invocation of the M macro. Please adjust in case the layout of this file changes. */ diff --git a/gcc/testsuite/gcc.dg/pr61817-1.c b/gcc/testsuite/gcc.dg/pr61817-1.c index 4230485..d58497f 100644 --- a/gcc/testsuite/gcc.dg/pr61817-1.c +++ b/gcc/testsuite/gcc.dg/pr61817-1.c @@ -14,6 +14,6 @@ enum { ) }; -A(a == 15); -A(b == 15); -A(c == 15); +A(a == 10); +A(b == 10); +A(c == 10); diff --git a/gcc/testsuite/gcc.dg/pr61817-2.c b/gcc/testsuite/gcc.dg/pr61817-2.c index e4326b8..b7a860b 100644 --- a/gcc/testsuite/gcc.dg/pr61817-2.c +++ b/gcc/testsuite/gcc.dg/pr61817-2.c @@ -14,6 +14,6 @@ enum { ) }; -A(a == 15); -A(b == 15); -A(c == 15); +A(a == 10); +A(b == 10); +A(c == 14); |