brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 538ee6b Raw
75 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized4 5// RUN: %clang_cc1 -DOMP52 -verify=omp52 -fopenmp -fopenmp-version=52 %s -Wuninitialized6 7// RUN: %clang_cc1 -DOMP52 -verify=omp52 -fopenmp-simd  -fopenmp-version=52 %s -Wuninitialized8 9struct omp_alloctrait_t {};10 11typedef void **omp_allocator_handle_t;12extern const omp_allocator_handle_t omp_null_allocator;13extern const omp_allocator_handle_t omp_default_mem_alloc;14extern const omp_allocator_handle_t omp_large_cap_mem_alloc;15extern const omp_allocator_handle_t omp_const_mem_alloc;16extern const omp_allocator_handle_t omp_high_bw_mem_alloc;17extern const omp_allocator_handle_t omp_low_lat_mem_alloc;18extern const omp_allocator_handle_t omp_cgroup_mem_alloc;19extern const omp_allocator_handle_t omp_pteam_mem_alloc;20extern const omp_allocator_handle_t omp_thread_mem_alloc;21 22int main(int argc, char **argv) {23  omp_alloctrait_t my_traits[10];24  omp_alloctrait_t *ptraits;25  omp_allocator_handle_t my_alloc = nullptr;26  const omp_allocator_handle_t c_my_alloc = my_alloc;27  omp_alloctrait_t aligned_traits[10];28  omp_allocator_handle_t aligned_alloc;29 30#ifndef OMP5231 32#pragma omp target uses_allocators // expected-error {{expected '(' after 'uses_allocator'}}33{}34#pragma omp target uses_allocators( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected unqualified-id}}35{}36#pragma omp target uses_allocators() // expected-error {{expected unqualified-id}}37{}38#pragma omp target uses_allocators(omp_default_mem_alloc // expected-error {{expected ',' or ')' in 'uses_allocators' clause}} expected-error {{expected ')'}} expected-note {{to match this '('}}39{}40#pragma omp target uses_allocators(argc, // expected-error {{expected ')'}} expected-error {{expected variable of the 'omp_allocator_handle_t' type, not 'int'}} expected-note {{to match this '('}}41{}42#pragma omp target uses_allocators(argc > 0 ? omp_default_mem_alloc : omp_thread_mem_alloc) // expected-error {{expected ',' or ')' in 'uses_allocators' clause}} expected-error {{expected unqualified-id}} expected-error {{expected variable of the 'omp_allocator_handle_t' type, not 'int'}}43{}44#pragma omp target uses_allocators(omp_default_mem_alloc, omp_large_cap_mem_alloc, omp_const_mem_alloc, omp_high_bw_mem_alloc, omp_low_lat_mem_alloc, omp_cgroup_mem_alloc, omp_pteam_mem_alloc, omp_thread_mem_alloc)45{}46#pragma omp target uses_allocators(omp_default_mem_alloc(my_traits), omp_large_cap_mem_alloc(my_traits), omp_const_mem_alloc(my_traits), omp_high_bw_mem_alloc(my_traits), omp_low_lat_mem_alloc(my_traits), omp_cgroup_mem_alloc(my_traits), omp_pteam_mem_alloc(my_traits), omp_thread_mem_alloc(my_traits)) // expected-error 8 {{predefined allocator cannot have traits specified}} expected-note-re 8 {{predefined trait '{{omp_default_mem_alloc|omp_large_cap_mem_alloc|omp_const_mem_alloc|omp_high_bw_mem_alloc|omp_low_lat_mem_alloc|omp_cgroup_mem_alloc|omp_pteam_mem_alloc|omp_thread_mem_alloc}}' used here}}47{}48#pragma omp target uses_allocators(my_alloc, c_my_alloc) // expected-error {{non-predefined allocator must have traits specified}} expected-error {{expected variable of the 'omp_allocator_handle_t' type, not 'const omp_allocator_handle_t' (aka 'void **const')}}49{}50#pragma omp target uses_allocators(my_alloc() // expected-error {{expected unqualified-id}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{non-predefined allocator must have traits specified}}51{}52#pragma omp target uses_allocators(my_alloc()) // expected-error {{expected unqualified-id}} expected-error {{non-predefined allocator must have traits specified}}53{}54#pragma omp target uses_allocators(my_alloc(argc > 0 ? argv[0] : argv{1})) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected constant sized array of 'omp_alloctrait_t' elements, not 'int'}}55{}56#pragma omp target uses_allocators(my_alloc(ptraits)) // expected-error {{expected constant sized array of 'omp_alloctrait_t' elements, not 'omp_alloctrait_t *'}}57{}58#pragma omp target uses_allocators(my_alloc(my_traits)) private(my_alloc) // expected-error {{allocators used in 'uses_allocators' clause cannot appear in other data-sharing or data-mapping attribute clauses}} expected-note {{defined as private}}59{}60#pragma omp target map(my_alloc, my_traits) uses_allocators(my_alloc(my_traits)) // expected-error {{allocators used in 'uses_allocators' clause cannot appear in other data-sharing or data-mapping attribute clauses}} expected-note {{used here}}61{}62#else63#pragma omp target teams uses_allocators(traits(my_traits): my_alloc; traits(aligned_traits): aligned_alloc)64{}65#pragma omp target teams uses_allocators(my_alloc)66{}67#pragma omp target teams uses_allocators(traits(my_traits): my_alloc, traits(aligned_traits): aligned_alloc) // omp52-error {{',' not allowed as separator in 'uses_allocators' clause, use ';' instead}}68{}69#pragma omp target teams uses_allocators(my_alloc(my_traits), aligned_alloc(aligned_traits)) // omp52-error {{old syntax 'allocator(expr)' on 'uses_allocators' clause was deprecated, use new syntax 'traits(expr): alloc'}} //omp52-error {{old syntax 'allocator(expr)' on 'uses_allocators' clause was deprecated, use new syntax 'traits(expr): alloc'}}70{}71#endif72  return 0;73}74 75