aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma7.c14
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/directives.c8
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fd5b350..d34a5c1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-25 Dodji Seketeli <dodji@redhat.com>
+
+ PR preprocessor/53469
+ * gcc.dg/cpp/_Pragma7.c: New test case.
+
2012-08-27 Tobias Burnus <burnus@net-b.de>
PR fortran/54370
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma7.c b/gcc/testsuite/gcc.dg/cpp/_Pragma7.c
new file mode 100644
index 0000000..a7a5b1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma7.c
@@ -0,0 +1,14 @@
+/*
+ Origin: PR preprocessor/53469
+ { dg-do compile }
+ */
+
+#define STRINGIFY(x) #x
+#define TEST(x) \
+ _Pragma(STRINGIFY(GCC diagnostic ignored "-Wunused-local-typedefs")) \
+ typedef int myint;
+
+void bar ()
+{
+ TEST(myint)
+}
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index e4da6ef..7c11fdd0 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-25 Dodji Seketeli <dodji@redhat.com>
+
+ PR preprocessor/53469
+ * directives.c (do_pragma): Use the virtual location for the
+ pragma token, instead of its spelling location.
+
2012-08-14 Diego Novillo <dnovillo@google.com>
Merge from cxx-conversion branch. Configury.
diff --git a/libcpp/directives.c b/libcpp/directives.c
index e37b148..a8f2cc4 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1347,13 +1347,15 @@ static void
do_pragma (cpp_reader *pfile)
{
const struct pragma_entry *p = NULL;
- const cpp_token *token, *pragma_token = pfile->cur_token;
+ const cpp_token *token, *pragma_token;
+ source_location pragma_token_virt_loc = 0;
cpp_token ns_token;
unsigned int count = 1;
pfile->state.prevent_expansion++;
- token = cpp_get_token (pfile);
+ pragma_token = token = cpp_get_token_with_location (pfile,
+ &pragma_token_virt_loc);
ns_token = *token;
if (token->type == CPP_NAME)
{
@@ -1379,7 +1381,7 @@ do_pragma (cpp_reader *pfile)
{
if (p->is_deferred)
{
- pfile->directive_result.src_loc = pragma_token->src_loc;
+ pfile->directive_result.src_loc = pragma_token_virt_loc;
pfile->directive_result.type = CPP_PRAGMA;
pfile->directive_result.flags = pragma_token->flags;
pfile->directive_result.val.pragma = p->u.ident;