Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %s |
| 2 | |
Erik Pilkington | c5a0583 | 2019-04-11 17:55:30 +0000 | [diff] [blame] | 3 | // FIXME: Why isn't this supported? Seems useful for availability attributes at |
| 4 | // the very least. |
| 5 | __attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}} |
Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 6 | |
| 7 | __attribute__((deprecated)) @interface A @end |
| 8 | __attribute__((deprecated)) @protocol P0; |
| 9 | __attribute__((deprecated)) @protocol P1 |
| 10 | @end |
| 11 | |
| 12 | #define EXP __attribute__((visibility("default"))) |
| 13 | class EXP C {}; |
| 14 | EXP class C2 {}; // expected-warning {{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} |
| 15 | |
Nico Weber | 69a7914 | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 16 | @interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}} |
Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 17 | EXP @interface I2 @end |
| 18 | |
Alp Toker | 6ed7251 | 2013-12-14 01:07:05 +0000 | [diff] [blame] | 19 | @implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} |
Erik Pilkington | c5a0583 | 2019-04-11 17:55:30 +0000 | [diff] [blame] | 20 | EXP @implementation I2 @end |
Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 21 | |
Alp Toker | 6ed7251 | 2013-12-14 01:07:05 +0000 | [diff] [blame] | 22 | @class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} |
Erik Pilkington | c5a0583 | 2019-04-11 17:55:30 +0000 | [diff] [blame] | 23 | EXP @class OC2; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}} |
Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 24 | |
Nico Weber | 69a7914 | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 25 | @protocol EXP P @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@protocol'}} |
Nico Weber | 04e213b | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 26 | EXP @protocol P2 @end |