Clang Project

clang_source_code/test/OpenMP/target_teams_distribute_parallel_for_thread_limit_messages.cpp
1// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
4
5void foo() {
6}
7
8bool foobool(int argc) {
9  return argc;
10}
11
12struct S1; // expected-note 2 {{declared here}}
13
14template <typename T, int C> // expected-note {{declared here}}
15T tmain(T argc) {
16  char **a;
17#pragma omp target teams distribute parallel for thread_limit(C)
18  for (int j=0; j<100; j++) foo();
19
20#pragma omp target teams distribute parallel for thread_limit(T) // expected-error {{'T' does not refer to a value}}
21  for (int j=0; j<100; j++) foo();
22
23#pragma omp target teams distribute parallel for thread_limit // expected-error {{expected '(' after 'thread_limit'}}
24  for (int j=0; j<100; j++) foo();
25
26#pragma omp target teams distribute parallel for thread_limit( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27  for (int j=0; j<100; j++) foo();
28
29#pragma omp target teams distribute parallel for thread_limit() // expected-error {{expected expression}}
30  for (int j=0; j<100; j++) foo();
31
32#pragma omp target teams distribute parallel for thread_limit(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
33  for (int j=0; j<100; j++) foo();
34
35#pragma omp target teams distribute parallel for thread_limit(argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
36  for (int j=0; j<100; j++) foo();
37
38#pragma omp target teams distribute parallel for thread_limit(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
39  for (int j=0; j<100; j++) foo();
40
41#pragma omp target teams distribute parallel for thread_limit(argc + argc)
42  for (int j=0; j<100; j++) foo();
43
44#pragma omp target teams distribute parallel for thread_limit(argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'thread_limit' clause}}
45  for (int j=0; j<100; j++) foo();
46
47#pragma omp target teams distribute parallel for thread_limit(S1) // expected-error {{'S1' does not refer to a value}}
48  for (int j=0; j<100; j++) foo();
49
50#pragma omp target teams distribute parallel for thread_limit(-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
51  for (int j=0; j<100; j++) foo();
52
53#pragma omp target teams distribute parallel for thread_limit(-10u)
54  for (int j=0; j<100; j++) foo();
55
56#pragma omp target teams distribute parallel for thread_limit(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
57  for (int j=0; j<100; j++) foo();
58
59  return 0;
60}
61
62int main(int argc, char **argv) {
63#pragma omp target teams distribute parallel for thread_limit // expected-error {{expected '(' after 'thread_limit'}}
64  for (int j=0; j<100; j++) foo();
65
66#pragma omp target teams distribute parallel for thread_limit ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
67  for (int j=0; j<100; j++) foo();
68
69#pragma omp target teams distribute parallel for thread_limit () // expected-error {{expected expression}}
70  for (int j=0; j<100; j++) foo();
71
72#pragma omp target teams distribute parallel for thread_limit (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
73  for (int j=0; j<100; j++) foo();
74
75#pragma omp target teams distribute parallel for thread_limit (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
76  for (int j=0; j<100; j++) foo();
77
78#pragma omp target teams distribute parallel for thread_limit (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
79  for (int j=0; j<100; j++) foo();
80
81#pragma omp target teams distribute parallel for thread_limit (argc + argc)
82  for (int j=0; j<100; j++) foo();
83
84#pragma omp target teams distribute parallel for thread_limit (argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'thread_limit' clause}}
85  for (int j=0; j<100; j++) foo();
86
87#pragma omp target teams distribute parallel for thread_limit (S1) // expected-error {{'S1' does not refer to a value}}
88  for (int j=0; j<100; j++) foo();
89
90#pragma omp target teams distribute parallel for thread_limit (-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
91  for (int j=0; j<100; j++) foo();
92
93#pragma omp target teams distribute parallel for thread_limit (-10u)
94  for (int j=0; j<100; j++) foo();
95
96#pragma omp target teams distribute parallel for thread_limit (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
97  for (int j=0; j<100; j++) foo();
98
99  return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}}
100}
101