builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-copy.c
blob27cd7bc5be62ddfdef5ffc453d8c37cc28588bda
1 /* PR middle-end/81824 - Warn for missing attributes with function aliases
2 Exercise error handling for attribute copy.
3 { dg-do compile }
4 { dg-options "-O2 -Wall" } */
6 #define ATTR(list) __attribute__ (list)
8 /* Verify incorrect numbers of arguments. */
9 ATTR ((copy)) void
10 fno_args (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
12 ATTR ((copy ())) void
13 fno_args2 (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
15 ATTR ((copy (fno_args, fno_args))) void
16 fmlti_args (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
18 /* Verify that referencing an undeclared symbol is rejected with an error. */
20 ATTR ((copy (foobar))) /* { dg-error ".foobar. undeclared" } */
21 void fundeclared (void);
23 /* Verify that using a string argument triggers a descriptive error
24 (given attributes like alias and weakref using a string is a likely
25 mistake). */
27 ATTR ((copy ("foobar")))
28 void fstring (void); /* { dg-error ".copy. attribute argument cannot be a string" } */
30 /* Ditto for an integer. */
32 ATTR ((copy (123)))
33 void fnumber (void); /* { dg-error ".copy. attribute argument cannot be a constant arithmetic expression" } */