diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-01-27 18:57:51 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-01-27 18:57:51 +0000 |
commit | 0afff540e652c77b409ce094f64cc2b033495785 (patch) | |
tree | f6cecd18c9211abd83605d0385a9448c4f50e786 /gcc | |
parent | b45285fc2ee430b675f57e8c92310aaf77ba031e (diff) | |
download | gcc-0afff540e652c77b409ce094f64cc2b033495785.zip gcc-0afff540e652c77b409ce094f64cc2b033495785.tar.gz gcc-0afff540e652c77b409ce094f64cc2b033495785.tar.bz2 |
libcpp: use better locations for _Pragma tokens (preprocessor/69126)
gcc/testsuite/ChangeLog:
PR preprocessor/69126
* c-c++-common/pr69126.c: New test case.
libcpp/ChangeLog:
PR preprocessor/69126
* directives.c (destringize_and_run): Add expansion_loc param; use
it when handling unexpanded pragmas to fixup the locations of the
synthesized tokens.
(_cpp_do__Pragma): Add expansion_loc param and use it when calling
destringize_and_run.
* internal.h (_cpp_do__Pragma): Add expansion_loc param.
* macro.c (builtin_macro): Pass expansion location of _Pragma to
_cpp_do__Pragma.
From-SVN: r232893
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr69126.c | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3af22c..e674bf4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-27 David Malcolm <dmalcolm@redhat.com> + + PR preprocessor/69126 + * c-c++-common/pr69126.c: New test case. + 2016-01-27 Ian Lance Taylor <iant@google.com> * gcc.dg/tree-ssa/ivopt_5.c: New test. diff --git a/gcc/testsuite/c-c++-common/pr69126.c b/gcc/testsuite/c-c++-common/pr69126.c new file mode 100644 index 0000000..fb4dcfb --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr69126.c @@ -0,0 +1,22 @@ +/* { dg-options "-Wunused-variable" } */ + +#pragma GCC diagnostic push +int f() +{ + _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") + int x; + return 0; +} +#pragma GCC diagnostic pop + +#pragma GCC diagnostic push +#define MACRO \ + _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ + int x; + +int g() +{ + MACRO; + return 0; +} +#pragma GCC diagnostic pop |