• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 -o - %s -Wuninitialized
2 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized
3 
4 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized
6 
foo()7 void foo() {
8 }
9 
foobool(int argc)10 bool foobool(int argc) {
11   return argc;
12 }
13 
14 struct S1; // expected-note {{declared here}}
15 
main(int argc,char ** argv)16 int main(int argc, char **argv) {
17   int z;
18   #pragma omp target device // expected-error {{expected '(' after 'device'}}
19   foo();
20   #pragma omp target device ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
21   foo();
22   #pragma omp target device () // expected-error {{expected expression}}
23   foo();
24   #pragma omp target device (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
25   foo();
26   #pragma omp target device (argc: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected expression}}
27   foo();
28   #pragma omp target device (z-argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
29   foo();
30   #pragma omp target device (device_num : argc > 0 ? argv[1] : argv[2]) // omp45-error {{use of undeclared identifier 'device_num'}} omp45-error {{expected ')'}} omp45-note {{to match this '('}} omp50-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
31   foo();
32   #pragma omp target device (argc: argc + argc) // omp45-error {{expected ')'}} omp45-note {{to match this '('}} omp50-error {{expected 'ancestor' or 'device_num' in OpenMP clause 'device'}}
33   foo();
34   #pragma omp target device (argc), device (argc+1) // expected-error {{directive '#pragma omp target' cannot contain more than one 'device' clause}}
35   foo();
36   #pragma omp target device (S1) // expected-error {{'S1' does not refer to a value}}
37   foo();
38   #pragma omp target device (-2) // expected-error {{argument to 'device' clause must be a non-negative integer value}}
39   foo();
40   #pragma omp target device (-10u)
41   foo();
42   #pragma omp target device (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
43   foo();
44   #pragma omp target device (ancestor) // expected-error {{use of undeclared identifier 'ancestor'}}
45   foo();
46 
47   return 0;
48 }
49