Clang Project

clang_source_code/test/OpenMP/openmp_check.cpp
1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
3// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
4
5// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
6// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++98 %s
7// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 %s
8// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9
10#define p _Pragma("omp parallel")
11
12int nested(int a) {
13#pragma omp parallel p // expected-error {{unexpected OpenMP directive}}
14  ++a;
15#pragma omp parallel
16  ++a;
17
18  auto F = [&]() {
19#if __cplusplus <= 199711L
20  // expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
21  // expected-error@-3 {{expected expression}}
22  // expected-error@-4 {{expected ';' at end of declaration}}
23#endif
24
25#pragma omp parallel
26    {
27#pragma omp target
28      ++a;
29    }
30  };
31  F();
32#if __cplusplus <= 199711L
33  // expected-error@-2 {{C++ requires a type specifier for all declarations}}
34#endif
35  return a;
36#if __cplusplus <= 199711L
37  // expected-error@-2 {{expected unqualified-id}}
38#endif
39}
40#if __cplusplus <= 199711L
41// expected-error@-2 {{extraneous closing brace ('}')}}
42#endif
43