diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2012-06-19 22:09:27 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2012-06-19 22:09:27 +0000 |
| commit | 478faed4b08a6614fe9b8e3e00f71dadf17f1741 (patch) | |
| tree | e3029182d7dd6f7d88fc247d16f3d8973bb68982 /clang/test/Parser | |
| parent | e1c0ae6fda87373a954cf483dec638c0115d4fb1 (diff) | |
| download | bcm5719-llvm-478faed4b08a6614fe9b8e3e00f71dadf17f1741.tar.gz bcm5719-llvm-478faed4b08a6614fe9b8e3e00f71dadf17f1741.zip | |
Reapplying the changes from r158717 as they were rolled back to avoid merge conflicts from a separate problematic patch.
llvm-svn: 158750
Diffstat (limited to 'clang/test/Parser')
| -rw-r--r-- | clang/test/Parser/MicrosoftExtensions.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/clang/test/Parser/MicrosoftExtensions.c b/clang/test/Parser/MicrosoftExtensions.c index c20bdb6b143..cd03ac8c09c 100644 --- a/clang/test/Parser/MicrosoftExtensions.c +++ b/clang/test/Parser/MicrosoftExtensions.c @@ -3,10 +3,10 @@ __stdcall int func0(); int __stdcall func(); typedef int (__cdecl *tptr)(); void (*__fastcall fastpfunc)(); -struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; +struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; /* expected-warning{{__declspec attribute 'novtable' is not supported}} */ 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 ); +__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); /* expected-warning{{__declspec attribute 'noalias' is not supported}} expected-warning{{__declspec attribute 'restrict' is not supported}} */ typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; void * __ptr64 PtrToPtr64(const void *p) @@ -69,7 +69,7 @@ void deprecated_enum_test(void) [repeatable][source_annotation_attribute( Parameter|ReturnValue )] struct SA_Post{ SA_Post(); int attr; }; -[returnvalue:SA_Post( attr=1)] +[returnvalue:SA_Post( attr=1)] int foo1([SA_Post(attr=1)] void *param); @@ -80,3 +80,25 @@ void ms_intrinsics(int a) __assume(a); __debugbreak(); } + +struct __declspec(frobble) S1 {}; /* expected-warning {{unknown __declspec attribute 'frobble' ignored}} */ +struct __declspec(12) S2 {}; /* expected-error {{__declspec attributes must be an identifier or string literal}} */ +struct __declspec("testing") S3 {}; /* expected-warning {{__declspec attribute '"testing"' is not supported}} */ + +/* Ensure multiple declspec attributes are supported */ +struct __declspec(align(8) deprecated) S4 {}; + +/* But multiple declspecs must still be legal */ +struct __declspec(deprecated frobble "testing") S5 {}; /* expected-warning {{unknown __declspec attribute 'frobble' ignored}} expected-warning {{__declspec attribute '"testing"' is not supported}} */ +struct __declspec(unknown(12) deprecated) S6 {}; /* expected-warning {{unknown __declspec attribute 'unknown' ignored}}*/ + +struct S7 { + int foo() { return 12; } + __declspec(property(get=foo) deprecated) int t; +}; + +/* Technically, this is legal (though it does nothing) */ +__declspec() void quux( void ) { + struct S7 s; + int i = s.t; /* expected-warning {{'t' is deprecated}} */ +} |

