1 // Tests handling of CUDA attributes. 2 // 3 // RUN: %clang_cc1 -fsyntax-only -verify %s 4 // RUN: %clang_cc1 -fsyntax-only -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 -fsyntax-only -verify -x c %s 7 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}} 14 // 15 // NOTE: IgnoredAttr in clang which is used for the rest of 16 // attributes ignores LangOpts, so there are no warnings. 17 #else 18 // expected-no-diagnostics 19 #endif 20 21 __attribute__((device)) void f_device(); 22 __attribute__((global)) void f_global(); 23 __attribute__((constant)) int* g_constant; 24 __attribute__((shared)) float *g_shared; 25 __attribute__((host)) void f_host(); 26 __attribute__((device_builtin)) void f_device_builtin(); 27 typedef __attribute__((device_builtin)) const void *t_device_builtin; 28 enum __attribute__((device_builtin)) e_device_builtin {E}; 29 __attribute__((device_builtin)) int v_device_builtin; 30 __attribute__((cudart_builtin)) void f_cudart_builtin(); 31 __attribute__((nv_weak)) void f_nv_weak(); 32 __attribute__((device_builtin_surface_type)) unsigned long long surface_var; 33 __attribute__((device_builtin_texture_type)) unsigned long long texture_var; 34