File: attributes-on-non-cuda.cu

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (37 lines) | stat: -rw-r--r-- 1,849 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Tests that CUDA attributes are warnings when compiling C files, but not when
// compiling CUDA files.
//
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s
// Now pretend that we're compiling a C file. There should be warnings.
// RUN: %clang_cc1 -DEXPECT_WARNINGS -fsyntax-only -verify -x c %s

#if defined(EXPECT_WARNINGS)
// expected-warning@+15 {{'device' attribute ignored}}
// expected-warning@+15 {{'global' attribute ignored}}
// expected-warning@+15 {{'constant' attribute ignored}}
// expected-warning@+15 {{'shared' attribute ignored}}
// expected-warning@+15 {{'host' attribute ignored}}
// expected-warning@+21 {{'device_builtin_surface_type' attribute ignored}}
// expected-warning@+21 {{'device_builtin_texture_type' attribute ignored}}
//
// NOTE: IgnoredAttr in clang which is used for the rest of
// attributes ignores LangOpts, so there are no warnings.
#else
// expected-warning@+15 {{'device_builtin_surface_type' attribute only applies to classes}}
// expected-warning@+15 {{'device_builtin_texture_type' attribute only applies to classes}}
#endif

__attribute__((device)) void f_device(void);
__attribute__((global)) void f_global(void);
__attribute__((constant)) int* g_constant;
__attribute__((shared)) float *g_shared;
__attribute__((host)) void f_host(void);
__attribute__((device_builtin)) void f_device_builtin(void);
typedef __attribute__((device_builtin)) const void *t_device_builtin;
enum __attribute__((device_builtin)) e_device_builtin {E};
__attribute__((device_builtin)) int v_device_builtin;
__attribute__((cudart_builtin)) void f_cudart_builtin(void);
__attribute__((nv_weak)) void f_nv_weak(void);
__attribute__((device_builtin_surface_type)) unsigned long long surface_var;
__attribute__((device_builtin_texture_type)) unsigned long long texture_var;