aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/parser/def_linkflags.good
blob: 10228167c500c5b0c5a426b8c3a3342ce1dfe87f (plain)
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
46
47

int va;        // Allocates storage and is visible in other compilation units.
local int vb;  // Allocates storage and is visible in this file only.
export int vc; // Allocates storage and is visible even in other linkage units.
import int vd; // Storage is allocated in another linkage unit. (Should be the default in headers?)
declonly int ve; // Storage is allocated in some other compilation unit.

typedef incomplete X = (int x, private);
import int#[undefined] vd2; // Allowed! The size doesn't need to be known for declonly/import
declonly int#[undefined] ve2;
declonly X declonly_incomplete;

int va1 = 123;
local int vb1 = 123;
export int vc1 = 123;


// Visible in other compilation units
int fa()
{
    return 0;
}

// Local function, only visible in this file
local int fb()
{
    return 0;
}

// Exported function. Visible in other linkage units
export int fc()
{
    return 0;
}

// External function which is defined in another linkage unit. (Should be the default in headers?)
import int fd();

// External function which is defined in another compilation unit. (Should be the default in headers?)
declonly int fe();


// Combination multiple flags
export linkname "fd_two" int fd2() {
    return 0;
}