summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-25 09:01:27 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-25 09:01:27 +0000
commit45f9f14027303630c96496f59f8ad25b1f0a693f (patch)
treebd03a307239e9c5c965e1cf60415fca9659096aa /gcc
parent009b0c6d5fb90abf297a43339071fa5e403003d1 (diff)
downloadgcc-45f9f14027303630c96496f59f8ad25b1f0a693f.tar.gz
PR preprocessor/34692
* macro.c (collect_args): Add pragma_buff argument. Push CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather than into arguments. Reset prevent_expansion and parsing_args state at CPP_PRAGMA_EOL/CPP_EOF. (funlike_invocation_p): Add pragma_buff argument, pass it through to collect_args. (enter_macro_context): Add result argument. Adjust funlike_invocation_p caller. Emit all deferred pragma tokens gathered during collect_args before the expansion, add a padding token. Return 2 instead of 1 if any pragma tokens were prepended. (cpp_get_token): If enter_macro_context returns 2, don't return a padding token, instead cycle to grab CPP_PRAGMA token. * directives.c (_cpp_handle_directive): If was_parsing_args in deferred pragma, leave parsing_args and prevent_expansion as is. * gcc.dg/cpp/pr34692.c: New test. * gcc.dg/gomp/pr34692.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131819 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr34692.c35
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr34692.c26
3 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8705d66744b..a722cb3b309 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/34692
+ * gcc.dg/cpp/pr34692.c: New test.
+ * gcc.dg/gomp/pr34692.c: New test.
+
2008-01-25 Olga Golovanevsky <olga@il.ibm.com>
* gcc.dg/struct/wo_prof_malloc_size_var.c: UnXFAIL.
diff --git a/gcc/testsuite/gcc.dg/cpp/pr34692.c b/gcc/testsuite/gcc.dg/cpp/pr34692.c
new file mode 100644
index 00000000000..bcb0ca33d24
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr34692.c
@@ -0,0 +1,35 @@
+/* PR preprocessor/34692 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-require-visibility "" } */
+/* { dg-final { scan-hidden "vara" } } */
+/* { dg-final { scan-hidden "varb" } } */
+/* { dg-final { scan-hidden "varc" } } */
+/* { dg-final { scan-hidden "vard" } } */
+/* { dg-final { scan-assembler "a b cde f g h" } } */
+
+#define FOO(y, x) y #x
+#define BAR(x) x
+#define BAZ(x) x
+FOO (const char *vara =,
+a
+#pragma GCC visibility push(hidden)
+b
+#pragma GCC visibility push(hidden)
+cde f g h);
+int varb = 6;
+#pragma GCC visibility pop
+#pragma GCC visibility pop
+FOO (
+BAR (
+#pragma GCC visibility push(hidden)
+const) char *varc =,);
+#pragma GCC visibility pop
+FOO (
+BAR (
+BAZ (
+#pragma GCC visibility push(hidden)
+#pragma GCC visibility push(hidden)
+const) char) *vard =,);
+#pragma GCC visibility pop
+#pragma GCC visibility pop
diff --git a/gcc/testsuite/gcc.dg/gomp/pr34692.c b/gcc/testsuite/gcc.dg/gomp/pr34692.c
new file mode 100644
index 00000000000..0e1a1eb827f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr34692.c
@@ -0,0 +1,26 @@
+/* PR preprocessor/34692 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+/* { dg-final { scan-tree-dump-times "#pragma omp parallel" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp for private" 1 "gimple" } } */
+
+void
+foo (void)
+{
+ int i;
+#define FOO(y, x) y #x
+#define BAR(x) x
+#define BAZ(x) x
+FOO (for (i = 0; i < 10; i++) { const char *vara =,
+a
+#define P parallel
+#pragma omp P
+#undef P
+#define P for
+b
+#pragma omp P
+#undef P
+#define parallel atomic
+cde f g h);
+ }
+}