diff --git a/gcc/testsuite/c-c++-common/gomp/pr100450.c b/gcc/testsuite/c-c++-common/gomp/pr100450.c new file mode 100644 index 00000000000..a6d2a2829ff --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr100450.c @@ -0,0 +1,20 @@ +/* PR c/100450 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -save-temps -Wunknown-pragmas" } */ + +#define TEST(T) { \ + {T} \ +} +#define CLAUSES reduction(+:red) +#define PARALLEL_FOR(X) TEST({ \ +_Pragma("omp for CLAUSES") \ +X \ +}) + +void foo() +{ + int red = 0; + int A[3] = {}; + #pragma omp parallel shared(red) + PARALLEL_FOR( for(int i=0; i < 3; i++) red += A[i]; ) +} diff --git a/libcpp/lex.c b/libcpp/lex.c index 9662f1b8ca2..b7ce85a0331 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -3719,6 +3719,7 @@ cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1, case CPP_DEREF: return c == '*'; case CPP_DOT: return c == '.' || c == '%' || b == CPP_NUMBER; case CPP_HASH: return c == '#' || c == '%'; /* Digraph form. */ + case CPP_PRAGMA: case CPP_NAME: return ((b == CPP_NUMBER && name_p (pfile, &token2->val.str)) || b == CPP_NAME