File: borland-extensions.cpp

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (62 lines) | stat: -rw-r--r-- 1,942 bytes parent folder | download | duplicates (23)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple x86_64-linux-gnu -verify
// RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple i686-linux-gnu -Werror

// Borland extensions

// 1. test  -fborland-extensions
int dummy_function() { return 0; }

// 2. test __pascal
// expected-warning@+1 {{'_pascal' calling convention is not supported for this target}}
int _pascal f2();

// expected-warning@+1 {{'__pascal' calling convention is not supported for this target}}
float __pascal gi2(int, int); 
// expected-warning@+1 {{'__pascal' calling convention is not supported for this target}}
template<typename T> T g2(T (__pascal * const )(int, int)) { return 0; }

struct M {
    // expected-warning@+1 {{'__pascal' calling convention is not supported for this target}}
    int __pascal addP();
    // expected-warning@+1 {{'__pascal' calling convention is not supported for this target}}
    float __pascal subtractP(); 
};
// expected-warning@+1 {{'__pascal' calling convention is not supported for this target}}
template<typename T> int h2(T (__pascal M::* const )()) { return 0; }
void m2() {
    int i; float f;
    i = f2();
    f = gi2(2, i);
    f = g2(gi2);
    i = h2<int>(&M::addP);
    f = h2(&M::subtractP);
} 

// 3. test other calling conventions
int _cdecl fa3();
// expected-warning@+1 {{'_fastcall' calling convention is not supported for this target}}
int _fastcall fc3();
// expected-warning@+1 {{'_stdcall' calling convention is not supported for this target}}
int _stdcall fd3();

// 4. test __uuidof()
typedef struct _GUID {
     unsigned long  Data1;
     unsigned short Data2;
     unsigned short Data3;
     unsigned char  Data4[ 8 ];
} GUID;

struct __declspec(uuid("{12345678-1234-1234-1234-123456789abc}")) Foo;
struct Data {
     GUID const* Guid;
};

void t4() {
    unsigned long  data;

    const GUID guid_inl = __uuidof(Foo);
    Data ata1 = { &guid_inl};
    data = ata1.Guid->Data1;
}