2010-12-20 11:51:03 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s
|
2008-12-25 22:16:32 +08:00
|
|
|
__stdcall int func0();
|
|
|
|
int __stdcall func();
|
|
|
|
typedef int (__cdecl *tptr)();
|
|
|
|
void (*__fastcall fastpfunc)();
|
2010-08-06 01:13:11 +08:00
|
|
|
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
|
2008-12-25 22:16:32 +08:00
|
|
|
extern __declspec(dllimport) void __stdcall VarR4FromDec();
|
|
|
|
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
|
|
|
|
__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
|
2008-12-25 22:41:26 +08:00
|
|
|
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
|
2011-08-25 08:36:46 +08:00
|
|
|
|
2008-12-25 22:41:26 +08:00
|
|
|
void * __ptr64 PtrToPtr64(const void *p)
|
|
|
|
{
|
2011-10-01 13:17:03 +08:00
|
|
|
return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}}
|
2008-12-25 22:41:26 +08:00
|
|
|
}
|
2011-08-25 08:36:46 +08:00
|
|
|
void * __ptr32 PtrToPtr32(const void *p)
|
|
|
|
{
|
2011-10-01 13:17:03 +08:00
|
|
|
return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}}
|
2011-08-25 08:36:46 +08:00
|
|
|
}
|
|
|
|
|
2009-07-22 08:43:08 +08:00
|
|
|
void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
|
2008-12-25 22:41:26 +08:00
|
|
|
{
|
2009-09-09 23:08:12 +08:00
|
|
|
__asm {
|
|
|
|
mov eax, Bit
|
|
|
|
mov ecx, Base
|
|
|
|
lock bts [ecx], eax
|
|
|
|
setc al
|
|
|
|
};
|
2008-12-25 22:41:26 +08:00
|
|
|
}
|
2010-10-06 21:02:48 +08:00
|
|
|
_inline int foo99() { return 99; }
|
2008-12-25 22:41:26 +08:00
|
|
|
|
2009-01-07 03:34:12 +08:00
|
|
|
void *_alloca(int);
|
|
|
|
|
|
|
|
void foo() {
|
2009-09-09 23:08:12 +08:00
|
|
|
__declspec(align(16)) int *buffer = (int *)_alloca(9);
|
2009-01-07 03:34:12 +08:00
|
|
|
}
|
2009-01-10 08:48:18 +08:00
|
|
|
|
|
|
|
typedef bool (__stdcall __stdcall *blarg)(int);
|
2009-12-24 03:15:27 +08:00
|
|
|
|
2010-09-29 07:35:09 +08:00
|
|
|
void local_callconv()
|
|
|
|
{
|
|
|
|
bool (__stdcall *p)(int);
|
|
|
|
}
|
2009-12-24 03:15:27 +08:00
|
|
|
|
|
|
|
// Charify extension.
|
|
|
|
#define FOO(x) #@x
|
|
|
|
char x = FOO(a);
|
|
|
|
|
2010-07-16 23:18:19 +08:00
|
|
|
typedef enum E { e1 };
|
2010-09-08 20:20:18 +08:00
|
|
|
|
|
|
|
|
2012-03-01 12:09:28 +08:00
|
|
|
enum __declspec(deprecated) E2 { i, j, k };
|
|
|
|
__declspec(deprecated) enum E3 { a, b, c } e;
|
2010-12-20 09:41:49 +08:00
|
|
|
|
2012-03-15 08:20:05 +08:00
|
|
|
void deprecated_enum_test(void)
|
|
|
|
{
|
|
|
|
// Test to make sure the deprecated warning follows the right thing
|
|
|
|
enum E2 e1; // expected-warning {{'E2' is deprecated}}
|
|
|
|
enum E3 e2; // No warning expected, the deprecation follows the variable
|
|
|
|
enum E3 e3 = e; // expected-warning {{'e' is deprecated}}
|
|
|
|
}
|
2010-10-11 20:00:10 +08:00
|
|
|
|
2010-10-11 20:59:39 +08:00
|
|
|
/* Microsoft attribute tests */
|
|
|
|
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
|
|
|
|
struct SA_Post{ SA_Post(); int attr; };
|
|
|
|
|
|
|
|
[returnvalue:SA_Post( attr=1)]
|
|
|
|
int foo1([SA_Post(attr=1)] void *param);
|
|
|
|
|
|
|
|
|
2010-10-11 20:00:10 +08:00
|
|
|
|
|
|
|
void ms_intrinsics(int a)
|
|
|
|
{
|
|
|
|
__noop();
|
|
|
|
__assume(a);
|
2011-07-10 22:15:07 +08:00
|
|
|
__debugbreak();
|
2010-10-11 20:00:10 +08:00
|
|
|
}
|