1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 void tooManyArgs(void) __attribute__((unavailable("a", "b"))); // expected-error {{'unavailable' attribute takes no more than 1 argument}}
6 int foo(int) __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{'foo' has been explicitly marked unavailable here}}
7 double dfoo(double) __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{'dfoo' has been explicitly marked unavailable here}}
9 void bar(void) __attribute__((__unavailable__
)); // expected-note {{explicitly marked unavailable}}
11 int quux(void) __attribute__((__unavailable__(12))); // expected-error {{'__unavailable__' attribute requires a string}}
13 #define ACCEPTABLE "Use something else"
14 int quux2(void) __attribute__((__unavailable__(ACCEPTABLE
)));
17 int ir
= foo(1); // expected-error {{'foo' is unavailable: USE IFOO INSTEAD}}
18 double dr
= dfoo(1.0); // expected-error {{'dfoo' is unavailable: NO LONGER}}
20 void (*fp
)(void) = &bar
; // expected-error {{'bar' is unavailable}}
22 double (*fp4
)(double) = dfoo
; // expected-error {{'dfoo' is unavailable: NO LONGER}}
25 char test2
[__has_feature(attribute_unavailable_with_message
) ? 1 : -1];
28 void unavail(void) __attribute__((__unavailable__
));
30 // No complains inside an unavailable function.
32 double dr
= dfoo(1.0);
33 void (*fp
)(void) = &bar
;
34 double (*fp4
)(double) = dfoo
;
40 b
__attribute__((deprecated())) = 2, // expected-note {{'b' has been explicitly marked deprecated here}}
42 }__attribute__((deprecated())); // expected-note {{'foo' has been explicitly marked deprecated here}}
44 enum fee
{ // expected-note 2 {{'fee' has been explicitly marked unavailable here}}
48 }__attribute__((unavailable()));
50 enum fee
f(void) { // expected-error {{'fee' is unavailable}}
51 int i
= a
; // expected-warning {{'a' is deprecated}}
53 i
= b
; // expected-warning {{'b' is deprecated}}
55 return r
; // expected-error {{'r' is unavailable}}