File: pragma_LDC_extern_weak.d

package info (click to toggle)
ldc 1%3A1.40.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,308 kB
  • sloc: cpp: 85,368; ansic: 21,877; makefile: 1,705; sh: 1,018; asm: 584; objc: 135; exp: 48; python: 12
file content (21 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test pragma(LDC_extern_weak) on function declarations.

// RUN: %ldc -d-version=DECLARATION -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll --check-prefix=DECLARATION
// RUN: not %ldc -d-version=DEFINITION %s 2>&1 | FileCheck %s --check-prefix=DEFINITION

version(DECLARATION)
{
// DECLARATION: declare{{.*}} extern_weak {{.*}}weakreffunction
pragma(LDC_extern_weak) extern(C) void weakreffunction();
}

version(DEFINITION)
{
// DEFINITION: Error: `LDC_extern_weak` cannot be applied to function definitions
pragma(LDC_extern_weak) extern(C) void weakreffunction() {};
}

void foo()
{
    auto a = &weakreffunction;
}