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@+12 {{'__device__' attribute ignored}}
10 // expected-warning@+12 {{'__global__' attribute ignored}}
11 // expected-warning@+12 {{'__constant__' attribute ignored}}
12 // expected-warning@+12 {{'__shared__' attribute ignored}}
13 // expected-warning@+12 {{'__host__' attribute ignored}}
15 // (Currently we don't for the other attributes. They are implemented with
16 // IgnoredAttr, which is ignored irrespective of any LangOpts.)
18 // expected-no-diagnostics
21 __declspec(__device__) void f_device();
22 __declspec(__global__) void f_global();
23 __declspec(__constant__) int* g_constant;
24 __declspec(__shared__) float *g_shared;
25 __declspec(__host__) void f_host();
26 __declspec(__device_builtin__) void f_device_builtin();
27 typedef __declspec(__device_builtin__) const void *t_device_builtin;
28 enum __declspec(__device_builtin__) e_device_builtin {E};
29 __declspec(__device_builtin__) int v_device_builtin;
30 __declspec(__cudart_builtin__) void f_cudart_builtin();
31 __declspec(__device_builtin_surface_type__) unsigned long long surface_var;
32 __declspec(__device_builtin_texture_type__) unsigned long long texture_var;
34 // Note that there's no __declspec spelling of nv_weak.