diff options
Diffstat (limited to 'test/Sema/MicrosoftExtensions.c')
-rw-r--r-- | test/Sema/MicrosoftExtensions.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/Sema/MicrosoftExtensions.c b/test/Sema/MicrosoftExtensions.c index 5d7330e..a6caf7a 100644 --- a/test/Sema/MicrosoftExtensions.c +++ b/test/Sema/MicrosoftExtensions.c @@ -76,6 +76,9 @@ void pointer_to_integral_type_conv(char* ptr) { short sh = (short)ptr; ch = (char)ptr; sh = (short)ptr; + + // This is valid ISO C. + _Bool b = (_Bool)ptr; } @@ -93,7 +96,7 @@ struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declar #define MY_TEXT "This is also deprecated" __declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}} -struct __declspec(deprecated(123)) DS2 {}; // expected-error {{argument to deprecated attribute was not a string literal}} +struct __declspec(deprecated(123)) DS2 {}; // expected-error {{'deprecated' attribute requires a string}} void test( void ) { e1 = one; // expected-warning {{'e1' is deprecated: This is deprecated}} @@ -102,3 +105,32 @@ void test( void ) { enum DE1 no; // no warning because E1 is not deprecated } + +int __sptr wrong1; // expected-error {{'__sptr' attribute only applies to pointer arguments}} +// The modifier must follow the asterisk +int __sptr *wrong_psp; // expected-error {{'__sptr' attribute only applies to pointer arguments}} +int * __sptr __uptr wrong2; // expected-error {{'__sptr' and '__uptr' attributes are not compatible}} +int * __sptr __sptr wrong3; // expected-warning {{attribute '__sptr' is already applied}} + +// It is illegal to overload based on the type attribute. +void ptr_func(int * __ptr32 i) {} // expected-note {{previous definition is here}} +void ptr_func(int * __ptr64 i) {} // expected-error {{redefinition of 'ptr_func'}} + +// It is also illegal to overload based on the pointer type attribute. +void ptr_func2(int * __sptr __ptr32 i) {} // expected-note {{previous definition is here}} +void ptr_func2(int * __uptr __ptr32 i) {} // expected-error {{redefinition of 'ptr_func2'}} + +int * __sptr __ptr32 __sptr wrong4; // expected-warning {{attribute '__sptr' is already applied}} + +__ptr32 int *wrong5; // expected-error {{'__ptr32' attribute only applies to pointer arguments}} + +int *wrong6 __ptr32; // expected-error {{expected ';' after top level declarator}} expected-warning {{declaration does not declare anything}} + +int * __ptr32 __ptr64 wrong7; // expected-error {{'__ptr32' and '__ptr64' attributes are not compatible}} + +int * __ptr32 __ptr32 wrong8; // expected-warning {{attribute '__ptr32' is already applied}} + +int *(__ptr32 __sptr wrong9); // expected-error {{'__sptr' attribute only applies to pointer arguments}} // expected-error {{'__ptr32' attribute only applies to pointer arguments}} + +typedef int *T; +T __ptr32 wrong10; // expected-error {{'__ptr32' attribute only applies to pointer arguments}} |