Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple x86_64-linux-gnu -verify |
| 2 | // RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple i686-linux-gnu -Werror |
Dawn Perchik | 400b607 | 2010-09-02 23:59:25 +0000 | [diff] [blame] | 3 | |
| 4 | // Borland extensions |
| 5 | |
| 6 | // 1. test -fborland-extensions |
| 7 | int dummy_function() { return 0; } |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 8 | |
| 9 | // 2. test __pascal |
Richard Smith | cda7968 | 2013-01-29 01:38:41 +0000 | [diff] [blame] | 10 | // expected-warning@+1 {{calling convention '_pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 11 | int _pascal f2(); |
| 12 | |
Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 13 | // expected-warning@+1 {{calling convention '__pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 14 | float __pascal gi2(int, int); |
Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 15 | // expected-warning@+1 {{calling convention '__pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 16 | template<typename T> T g2(T (__pascal * const )(int, int)) { return 0; } |
| 17 | |
| 18 | struct M { |
Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 19 | // expected-warning@+1 {{calling convention '__pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 20 | int __pascal addP(); |
Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 21 | // expected-warning@+1 {{calling convention '__pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 22 | float __pascal subtractP(); |
| 23 | }; |
Richard Smith | 5cd532c | 2013-01-29 01:24:26 +0000 | [diff] [blame] | 24 | // expected-warning@+1 {{calling convention '__pascal' ignored for this target}} |
Dawn Perchik | 52fc314 | 2010-09-03 01:29:35 +0000 | [diff] [blame] | 25 | template<typename T> int h2(T (__pascal M::* const )()) { return 0; } |
| 26 | void m2() { |
| 27 | int i; float f; |
| 28 | i = f2(); |
| 29 | f = gi2(2, i); |
| 30 | f = g2(gi2); |
| 31 | i = h2<int>(&M::addP); |
| 32 | f = h2(&M::subtractP); |
| 33 | } |
Dawn Perchik | 8df7622 | 2010-09-08 22:56:24 +0000 | [diff] [blame] | 34 | |
| 35 | // 3. test other calling conventions |
| 36 | int _cdecl fa3(); |
Richard Smith | cda7968 | 2013-01-29 01:38:41 +0000 | [diff] [blame] | 37 | // expected-warning@+1 {{calling convention '_fastcall' ignored for this target}} |
Dawn Perchik | 8df7622 | 2010-09-08 22:56:24 +0000 | [diff] [blame] | 38 | int _fastcall fc3(); |
Richard Smith | cda7968 | 2013-01-29 01:38:41 +0000 | [diff] [blame] | 39 | // expected-warning@+1 {{calling convention '_stdcall' ignored for this target}} |
Dawn Perchik | 8df7622 | 2010-09-08 22:56:24 +0000 | [diff] [blame] | 40 | int _stdcall fd3(); |
| 41 | |
| 42 | // 4. test __uuidof() |
| 43 | typedef struct _GUID { |
| 44 | unsigned long Data1; |
| 45 | unsigned short Data2; |
| 46 | unsigned short Data3; |
| 47 | unsigned char Data4[ 8 ]; |
| 48 | } GUID; |
| 49 | |
| 50 | struct __declspec(uuid("{12345678-1234-1234-1234-123456789abc}")) Foo; |
| 51 | struct Data { |
| 52 | GUID const* Guid; |
| 53 | }; |
| 54 | |
| 55 | void t4() { |
| 56 | unsigned long data; |
| 57 | |
| 58 | const GUID guid_inl = __uuidof(Foo); |
| 59 | Data ata1 = { &guid_inl}; |
| 60 | data = ata1.Guid->Data1; |
| 61 | } |
| 62 | |