]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/objc.dg/attributes/nullability-00.m
81c0145f17b2dccb91cb604adc53556d288ebb03
[thirdparty/gcc.git] / gcc / testsuite / objc.dg / attributes / nullability-00.m
1 /* { dg-do compile } */
2 /* { dg-additional-options "-Wno-objc-root-class -fsyntax-only" } */
3
4 __attribute__((objc_nullability(0))) id a;
5 __attribute__((objc_nullability(4))) id e_1; /* { dg-error {'objc_nullability' attribute argument '4' is not an integer constant between 0 and 3} } */
6 __attribute__((objc_nullability(-22))) id e_2; /* { dg-error {'objc_nullability' attribute argument '-22' is not an integer constant between 0 and 3} } */
7 __attribute__((objc_nullability("unspecified"))) id b;
8 __attribute__((objc_nullability("nullable"))) id c;
9 __attribute__((objc_nullability("nonnull"))) id d;
10 __attribute__((objc_nullability("resettable"))) id e;
11 __attribute__((objc_nullability("nonsense"))) id e_3; /* { dg-error {'objc_nullability' attribute argument '"nonsense"' is not recognised} } */
12 __attribute__((objc_nullability(noGoingToWork))) id e_4; /* { dg-error {'noGoingToWork' undeclared here} } */
13
14 @interface MyRoot
15 {
16 __attribute__((objc_nullability(0))) id iv_a;
17 __attribute__((objc_nullability(3))) struct { int bad_a; } s;/* { dg-error {'objc_nullability' cannot be applied to non-pointer type 'struct <anonymous>'} } */
18 __attribute__((objc_nullability("resettable"))) int iv_b;/* { dg-error {'objc_nullability' cannot be applied to non-pointer type 'int'} } */
19 }
20 @end