Francois Pichet | 913b7bf | 2010-12-20 03:51:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s |
Steve Naroff | 239f073 | 2008-12-25 14:16:32 +0000 | [diff] [blame] | 2 | __stdcall int func0(); |
| 3 | int __stdcall func(); |
| 4 | typedef int (__cdecl *tptr)(); |
| 5 | void (*__fastcall fastpfunc)(); |
John McCall | b1d397c | 2010-08-05 17:13:11 +0000 | [diff] [blame] | 6 | struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; |
Steve Naroff | 239f073 | 2008-12-25 14:16:32 +0000 | [diff] [blame] | 7 | extern __declspec(dllimport) void __stdcall VarR4FromDec(); |
| 8 | __declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix); |
| 9 | __declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 10 | typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; |
Francois Pichet | 58fd97a | 2011-08-25 00:36:46 +0000 | [diff] [blame] | 11 | |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 12 | void * __ptr64 PtrToPtr64(const void *p) |
| 13 | { |
John McCall | e82247a | 2011-10-01 05:17:03 +0000 | [diff] [blame] | 14 | return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}} |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 15 | } |
Francois Pichet | 58fd97a | 2011-08-25 00:36:46 +0000 | [diff] [blame] | 16 | void * __ptr32 PtrToPtr32(const void *p) |
| 17 | { |
John McCall | e82247a | 2011-10-01 05:17:03 +0000 | [diff] [blame] | 18 | return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}} |
Francois Pichet | 58fd97a | 2011-08-25 00:36:46 +0000 | [diff] [blame] | 19 | } |
| 20 | |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 21 | void __forceinline InterlockedBitTestAndSet (long *Base, long Bit) |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 22 | { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 23 | __asm { |
| 24 | mov eax, Bit |
| 25 | mov ecx, Base |
| 26 | lock bts [ecx], eax |
| 27 | setc al |
| 28 | }; |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 29 | } |
Francois Pichet | 229ca4a | 2010-10-06 13:02:48 +0000 | [diff] [blame] | 30 | _inline int foo99() { return 99; } |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 31 | |
Steve Naroff | 47f5209 | 2009-01-06 19:34:12 +0000 | [diff] [blame] | 32 | void *_alloca(int); |
| 33 | |
| 34 | void foo() { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 35 | __declspec(align(16)) int *buffer = (int *)_alloca(9); |
Steve Naroff | 47f5209 | 2009-01-06 19:34:12 +0000 | [diff] [blame] | 36 | } |
Douglas Gregor | 5a2f5d3 | 2009-01-10 00:48:18 +0000 | [diff] [blame] | 37 | |
| 38 | typedef bool (__stdcall __stdcall *blarg)(int); |
Chris Lattner | 6633522 | 2009-12-23 19:15:27 +0000 | [diff] [blame] | 39 | |
Chris Lattner | 6229c8e | 2010-09-28 23:35:09 +0000 | [diff] [blame] | 40 | void local_callconv() |
| 41 | { |
| 42 | bool (__stdcall *p)(int); |
| 43 | } |
Chris Lattner | 6633522 | 2009-12-23 19:15:27 +0000 | [diff] [blame] | 44 | |
| 45 | // Charify extension. |
| 46 | #define FOO(x) #@x |
| 47 | char x = FOO(a); |
| 48 | |
Douglas Gregor | 0c99ec6 | 2010-07-16 15:18:19 +0000 | [diff] [blame] | 49 | typedef enum E { e1 }; |
Francois Pichet | 01b7c30 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 50 | |
| 51 | |
Aaron Ballman | 6454a02 | 2012-03-01 04:09:28 +0000 | [diff] [blame] | 52 | enum __declspec(deprecated) E2 { i, j, k }; |
| 53 | __declspec(deprecated) enum E3 { a, b, c } e; |
Francois Pichet | d3d3be9 | 2010-12-20 01:41:49 +0000 | [diff] [blame] | 54 | |
Aaron Ballman | 0e3c989 | 2012-03-15 00:20:05 +0000 | [diff] [blame^] | 55 | void deprecated_enum_test(void) |
| 56 | { |
| 57 | // Test to make sure the deprecated warning follows the right thing |
| 58 | enum E2 e1; // expected-warning {{'E2' is deprecated}} |
| 59 | enum E3 e2; // No warning expected, the deprecation follows the variable |
| 60 | enum E3 e3 = e; // expected-warning {{'e' is deprecated}} |
| 61 | } |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 62 | |
Francois Pichet | 334d47e | 2010-10-11 12:59:39 +0000 | [diff] [blame] | 63 | /* Microsoft attribute tests */ |
| 64 | [repeatable][source_annotation_attribute( Parameter|ReturnValue )] |
| 65 | struct SA_Post{ SA_Post(); int attr; }; |
| 66 | |
| 67 | [returnvalue:SA_Post( attr=1)] |
| 68 | int foo1([SA_Post(attr=1)] void *param); |
| 69 | |
| 70 | |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 71 | |
| 72 | void ms_intrinsics(int a) |
| 73 | { |
| 74 | __noop(); |
| 75 | __assume(a); |
Francois Pichet | 699f9b1 | 2011-07-10 14:15:07 +0000 | [diff] [blame] | 76 | __debugbreak(); |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 77 | } |