summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/distribute_collapse_messages.cpp
diff options
context:
space:
mode:
authorCharles Li <charles.li@sony.com>2017-02-03 18:58:34 +0000
committerCharles Li <charles.li@sony.com>2017-02-03 18:58:34 +0000
commitbd1961d2bff69a1d0f3a20fbce4950ff24d6528a (patch)
tree56c3aa5233373500580faec139befeac895ff666 /clang/test/OpenMP/distribute_collapse_messages.cpp
parent05d382c5f7f2b912cd4cfb9c1164b3384bab33b4 (diff)
downloadbcm5719-llvm-bd1961d2bff69a1d0f3a20fbce4950ff24d6528a.tar.gz
bcm5719-llvm-bd1961d2bff69a1d0f3a20fbce4950ff24d6528a.zip
[Lit Test] Make tests C++11 compatible - OpenMP constant expressions
C++11 introduced constexpr, hence the change in diagnostics. Differential Revision: https://reviews.llvm.org/D29480 llvm-svn: 294025
Diffstat (limited to 'clang/test/OpenMP/distribute_collapse_messages.cpp')
-rw-r--r--clang/test/OpenMP/distribute_collapse_messages.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/clang/test/OpenMP/distribute_collapse_messages.cpp b/clang/test/OpenMP/distribute_collapse_messages.cpp
index 8818d659d44..4897e6931d2 100644
--- a/clang/test/OpenMP/distribute_collapse_messages.cpp
+++ b/clang/test/OpenMP/distribute_collapse_messages.cpp
@@ -1,8 +1,13 @@
// RUN: %clang_cc1 -verify -fopenmp %s
+// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s
void foo() {
}
+#if __cplusplus >= 201103L
+ // expected-note@+2 4 {{declared here}}
+#endif
bool foobool(int argc) {
return argc;
}
@@ -29,6 +34,9 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp distribute collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp distribute', but found only 1}}
+#if __cplusplus >= 201103L
+ // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
+#endif
// expected-error@+3 2 {{directive '#pragma omp distribute' cannot contain more than one 'collapse' clause}}
// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
// expected-error@+1 2 {{expression is not an integral constant expression}}
@@ -36,7 +44,11 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp distribute collapse (S) // expected-error {{'S' does not refer to a value}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
- // expected-error@+1 2 {{expression is not an integral constant expression}}
+#if __cplusplus <= 199711L
+ // expected-error@+4 2 {{expression is not an integral constant expression}}
+#else
+ // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
+#endif
#pragma omp distribute collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp distribute collapse (1)
@@ -59,8 +71,14 @@ int main(int argc, char **argv) {
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp distribute', but found only 1}}
#pragma omp distribute collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute' are ignored}} expected-note {{as specified in 'collapse' clause}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp distribute', but found only 1}}
+#if __cplusplus >= 201103L
+ // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
+#endif
#pragma omp distribute collapse (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
+#if __cplusplus >= 201103L
+ // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
+#endif
// expected-error@+3 {{expression is not an integral constant expression}}
// expected-error@+2 2 {{directive '#pragma omp distribute' cannot contain more than one 'collapse' clause}}
// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
@@ -68,7 +86,11 @@ int main(int argc, char **argv) {
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp distribute collapse (S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
- // expected-error@+1 {{expression is not an integral constant expression}}
+#if __cplusplus <= 199711L
+ // expected-error@+4 {{expression is not an integral constant expression}}
+#else
+ // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
+#endif
#pragma omp distribute collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+3 {{statement after '#pragma omp distribute' must be a for loop}}
OpenPOWER on IntegriCloud