1 // Test the __declspec spellings of CUDA attributes.
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
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}}
17 // (Currently we don't for the other attributes. They are implemented with
18 // IgnoredAttr, which is ignored irrespective of any LangOpts.)
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}}
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);
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(void);
34 __declspec(__device_builtin_surface_type__) unsigned long long surface_var;
35 __declspec(__device_builtin_texture_type__) unsigned long long texture_var;
37 // Note that there's no __declspec spelling of nv_weak.