File: storageclass-cl20.cl

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (45 lines) | stat: -rw-r--r-- 2,995 bytes parent folder | download | duplicates (16)
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
38
39
40
41
42
43
44
45
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0

int G2 = 0;
global int G3 = 0;
local int G4 = 0;              // expected-error{{program scope variable must reside in global or constant address space}}

static float g_implicit_static_var = 0;
static constant float g_constant_static_var = 0;
static global float g_global_static_var = 0;
static local float g_local_static_var = 0;     // expected-error {{program scope variable must reside in global or constant address space}}
static private float g_private_static_var = 0; // expected-error {{program scope variable must reside in global or constant address space}}
static generic float g_generic_static_var = 0; // expected-error {{program scope variable must reside in global or constant address space}}

extern float g_implicit_extern_var;
extern constant float g_constant_extern_var;
extern global float g_global_extern_var;
extern local float g_local_extern_var;     // expected-error {{extern variable must reside in global or constant address space}}
extern private float g_private_extern_var; // expected-error {{extern variable must reside in global or constant address space}}
extern generic float g_generic_extern_var; // expected-error {{extern variable must reside in global or constant address space}}

static void kernel bar(void) { // expected-error{{kernel functions cannot be declared static}}
}

void kernel foo(void) {
  constant int L1 = 0;
  local int L2;
  global int L3;                              // expected-error{{function scope variable cannot be declared in global address space}}
  generic int L4;                             // expected-error{{automatic variable qualified with an invalid address space}}
  __attribute__((address_space(100))) int L5; // expected-error{{automatic variable qualified with an invalid address space}}

  static float l_implicit_static_var = 0;
  static constant float l_constant_static_var = 0;
  static global float l_global_static_var = 0;
  static local float l_local_static_var = 0;     // expected-error {{static local variable must reside in global or constant address space}}
  static private float l_private_static_var = 0; // expected-error {{static local variable must reside in global or constant address space}}
  static generic float l_generic_static_var = 0; // expected-error {{static local variable must reside in global or constant address space}}

  extern float l_implicit_extern_var;
  extern constant float l_constant_extern_var;
  extern global float l_global_extern_var;
  extern local float l_local_extern_var;     // expected-error {{extern variable must reside in global or constant address space}}
  extern private float l_private_extern_var; // expected-error {{extern variable must reside in global or constant address space}}
  extern generic float l_generic_extern_var; // expected-error {{extern variable must reside in global or constant address space}}
}