diff options
author | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 173a4f43a911175643bda81ee675e8d9269056ea (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /test/OpenMP/parallel_sections_num_threads_messages.cpp | |
parent | 88f7a7d5251a2d813460274c92decc143a11569b (diff) | |
download | FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.zip FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.tar.gz |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957
Diffstat (limited to 'test/OpenMP/parallel_sections_num_threads_messages.cpp')
-rw-r--r-- | test/OpenMP/parallel_sections_num_threads_messages.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/OpenMP/parallel_sections_num_threads_messages.cpp b/test/OpenMP/parallel_sections_num_threads_messages.cpp new file mode 100644 index 0000000..927e8d7 --- /dev/null +++ b/test/OpenMP/parallel_sections_num_threads_messages.cpp @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} + +template <class T, typename S, int N> // expected-note {{declared here}} +T tmain(T argc, S **argv) { + #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} + {foo();} + #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + {foo();} + #pragma omp parallel sections num_threads () // expected-error {{expected expression}} + {foo();} + #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + {foo();} + #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} + {foo();} + #pragma omp parallel sections num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} + {foo();} + #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} + {foo();} + #pragma omp parallel sections num_threads (S) // expected-error {{'S' does not refer to a value}} + {foo();} + #pragma omp parallel sections num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} + {foo();} + #pragma omp parallel sections num_threads (argc) + {foo();} + #pragma omp parallel sections num_threads (N) // expected-error {{argument to 'num_threads' clause must be a positive integer value}} + {foo();} + + return argc; +} + +int main(int argc, char **argv) { + #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} + {foo();} + #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + {foo();} + #pragma omp parallel sections num_threads () // expected-error {{expected expression}} + {foo();} + #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + {foo();} + #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} + {foo();} + #pragma omp parallel sections num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }} + {foo();} + #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} + {foo();} + #pragma omp parallel sections num_threads (S1) // expected-error {{'S1' does not refer to a value}} + {foo();} + #pragma omp parallel sections num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} + {foo();} + #pragma omp parallel sections num_threads (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1>' requested here}} + {foo();} + + return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}} +} |