brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 3d01650 Raw
38 lines · plain
1// Test the __declspec spellings of CUDA attributes.2//3// RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify %s4// RUN: %clang_cc1 -fsyntax-only -fms-extensions -fcuda-is-device -verify %s5// Now pretend that we're compiling a C file. There should be warnings.6// RUN: %clang_cc1 -DEXPECT_WARNINGS -fms-extensions -fsyntax-only -verify -x c %s7 8#if defined(EXPECT_WARNINGS)9// expected-warning@+15 {{'__device__' attribute ignored}}10// expected-warning@+15 {{'__global__' attribute ignored}}11// expected-warning@+15 {{'__constant__' attribute ignored}}12// expected-warning@+15 {{'__shared__' attribute ignored}}13// expected-warning@+15 {{'__host__' attribute ignored}}14// expected-warning@+20 {{'__device_builtin_surface_type__' attribute ignored}}15// expected-warning@+20 {{'__device_builtin_texture_type__' attribute ignored}}16//17// (Currently we don't for the other attributes. They are implemented with18// IgnoredAttr, which is ignored irrespective of any LangOpts.)19#else20// expected-warning@+14 {{'__device_builtin_surface_type__' attribute only applies to classes}}21// expected-warning@+14 {{'__device_builtin_texture_type__' attribute only applies to classes}}22#endif23 24__declspec(__device__) void f_device(void);25__declspec(__global__) void f_global(void);26__declspec(__constant__) int* g_constant;27__declspec(__shared__) float *g_shared;28__declspec(__host__) void f_host(void);29__declspec(__device_builtin__) void f_device_builtin(void);30typedef __declspec(__device_builtin__) const void *t_device_builtin;31enum __declspec(__device_builtin__) e_device_builtin {E};32__declspec(__device_builtin__) int v_device_builtin;33__declspec(__cudart_builtin__) void f_cudart_builtin(void);34__declspec(__device_builtin_surface_type__) unsigned long long surface_var;35__declspec(__device_builtin_texture_type__) unsigned long long texture_var;36 37// Note that there's no __declspec spelling of nv_weak.38