summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseDecl.cpp8
-rw-r--r--clang/test/OpenMP/openmp_common.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 40687d8f27b..debbd50d668 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3615,6 +3615,14 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
continue;
}
+ if (Tok.is(tok::annot_pragma_openmp)) {
+ // Result can be ignored, because it must be always empty.
+ auto Res = ParseOpenMPDeclarativeDirective();
+ assert(!Res);
+ // Silence possible warnings.
+ (void)Res;
+ continue;
+ }
if (!Tok.is(tok::at)) {
auto CFieldCallback = [&](ParsingFieldDeclarator &FD) {
// Install the declarator into the current TagDecl.
diff --git a/clang/test/OpenMP/openmp_common.c b/clang/test/OpenMP/openmp_common.c
index 3765f4c5dc1..ed55796b337 100644
--- a/clang/test/OpenMP/openmp_common.c
+++ b/clang/test/OpenMP/openmp_common.c
@@ -7,3 +7,8 @@ void foo() {
#pragma omp // expected-error {{expected an OpenMP directive}}
#pragma omp unknown_directive // expected-error {{expected an OpenMP directive}}
}
+
+typedef struct S {
+#pragma omp parallel for private(j) schedule(static) if (tree1->totleaf > 1024) // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}}
+} St;
+
OpenPOWER on IntegriCloud