Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-copy.c
blob8bd537acf73b34f9aa7f4cfd5289c19887ab106f
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-require-alias "" }
5 { dg-options "-O2 -Wall" } */
7 #define ATTR(list) __attribute__ (list)
9 /* Verify incorrect numbers of arguments. */
10 ATTR ((copy)) void
11 fno_args (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
13 ATTR ((copy ())) void
14 fno_args2 (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
16 ATTR ((copy (fno_args, fno_args))) void
17 fmlti_args (void); /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
19 /* Verify that referencing an undeclared symbol is rejected with an error. */
21 ATTR ((copy (foobar))) /* { dg-error ".foobar. undeclared" } */
22 void fundeclared (void);
24 /* Verify that using a string argument triggers a descriptive error
25 (given attributes like alias and weakref using a string is a likely
26 mistake). */
28 ATTR ((copy ("foobar")))
29 void fstring (void); /* { dg-error ".copy. attribute argument cannot be a string" } */
31 /* Ditto for an integer. */
33 ATTR ((copy (123)))
34 void fnumber (void); /* { dg-error ".copy. attribute argument cannot be a constant arithmetic expression" } */