1 // Test the __declspec spellings of CUDA attributes. 2 // 3 // RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify %s 4 // RUN: %clang_cc1 -fsyntax-only -fms-extensions -fcuda-is-device -verify %s 5 // 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 %s 7 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 with 18 // IgnoredAttr, which is ignored irrespective of any LangOpts.) 19 #else 20 // 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 #endif 23 24 __declspec(__device__) void f_device(); 25 __declspec(__global__) void f_global(); 26 __declspec(__constant__) int* g_constant; 27 __declspec(__shared__) float *g_shared; 28 __declspec(__host__) void f_host(); 29 __declspec(__device_builtin__) void f_device_builtin(); 30 typedef __declspec(__device_builtin__) const void *t_device_builtin; 31 enum __declspec(__device_builtin__) e_device_builtin {E}; 32 __declspec(__device_builtin__) int v_device_builtin; 33 __declspec(__cudart_builtin__) void f_cudart_builtin(); 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