summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/atomic_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-23 02:27:21 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-23 02:27:21 +0000
commitf98b00c33e83cb507c21107e8c56961a4b043509 (patch)
treeb8df40845ba99247ce32566d7297478b0830225b /clang/test/OpenMP/atomic_messages.cpp
parent6310757568fa3e6433435206102bf2d0cc4300e2 (diff)
downloadbcm5719-llvm-f98b00c33e83cb507c21107e8c56961a4b043509.tar.gz
bcm5719-llvm-f98b00c33e83cb507c21107e8c56961a4b043509.zip
[OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
Diffstat (limited to 'clang/test/OpenMP/atomic_messages.cpp')
-rw-r--r--clang/test/OpenMP/atomic_messages.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp
index 6eef8f227df..7b35e42dc79 100644
--- a/clang/test/OpenMP/atomic_messages.cpp
+++ b/clang/test/OpenMP/atomic_messages.cpp
@@ -1,20 +1,47 @@
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
int foo() {
- L1:
- foo();
- #pragma omp atomic
+L1:
+ foo();
+#pragma omp atomic
{
foo();
goto L1; // expected-error {{use of undeclared label 'L1'}}
}
goto L2; // expected-error {{use of undeclared label 'L2'}}
- #pragma omp atomic
+#pragma omp atomic
{
foo();
- L2:
+ L2:
foo();
}
return 0;
}
+
+template <class T>
+T read() {
+ T a, b = 0;
+// Test for atomic read
+#pragma omp atomic read
+// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
+#pragma omp atomic read read
+ a = b;
+
+ return T();
+}
+
+int read() {
+ int a, b = 0;
+// Test for atomic read
+#pragma omp atomic read
+// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
+#pragma omp atomic read read
+ a = b;
+
+ return read<int>();
+}
OpenPOWER on IntegriCloud