Clang Project

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