1 /* Test to exercise attribute "nonstring" syntax.
3 { dg-options "-Wattributes" } */
5 #define ATTR(list) __attribute__ (list)
6 #define NONSTR ATTR ((nonstring))
8 /* Verify it's accepted on char arrays. */
9 extern NONSTR
char nsx_1
[];
10 extern char NONSTR nsx_2
[];
11 extern char nsx_3
[] NONSTR
;
13 extern NONSTR
char ns1
[1];
14 extern char NONSTR ns3
[3];
15 extern char ns5
[5] NONSTR
;
17 /* Verify it's accepted on char pointers. */
18 extern NONSTR
char* pns_1
;
19 extern char NONSTR
* pns_2
;
20 extern char* NONSTR pns_3
;
24 /* Verify it's accepted on char member pointers. */
29 /* Verify it's accepted on char member arrays. */
34 /* Verify it's accepted on char flexible array members. */
38 /* Verify it's rejected on non-array and non-pointer objects. */
39 extern NONSTR
char c1
; /* { dg-warning ".nonstring. attribute ignored on objects of type .char." } */
41 extern NONSTR
int i1
; /* { dg-warning ".nonstring. attribute ignored on objects of type .int." } */
43 extern NONSTR
int ia1
[]; /* { dg-warning ".nonstring. attribute ignored on objects of type .int *\\\[\\\]." } */
45 extern NONSTR
int* pi1
; /* { dg-warning ".nonstring. attribute ignored on objects of type .int *\\*." } */
48 void f (void); /* { dg-warning ".nonstring. attribute does not apply to functions" } */
51 NonStrType
{ int i
; }; /* { dg-warning ".nonstring. attribute does not apply to types" } */
53 typedef char NONSTR nschar_t
; /* { dg-warning ".nonstring. attribute does not apply to types" } */
55 void func (NONSTR
char *pns1
, char NONSTR
*pns2
, char* NONSTR pns3
)