2 // { dg-options "-Wmissing-attributes" }
4 #define ATTR(list) __attribute__ (list)
6 /* Type attributes are normally absent in template functions, and the
7 mere presence of any such attribute used to cause the
8 -Wmissing-attributes checks, that checked for attributes typically
9 associated with functions rather than types, to report any missing
10 attributes twice: once for the specialization attribute list, once
11 for its type attribute list.
13 This test uses both decl and type attributes to exercise the code
14 that avoids reporting duplicates, in ways that failed in the past
15 but that were not covered in other tests. */
16 typedef void* ATTR ((alloc_size (1))) f_type (int);
21 missing_malloc; // { dg-message "missing primary template attribute .malloc." }
25 missing_malloc<char>; // { dg-warning "explicit specialization .\[^\n\r\]+. may be missing attributes" }
28 /* Check that even an attribute that appears in both lists (decl and
29 type) in a template declaration is reported as missing only
34 ATTR ((alloc_size (1))) // In both attr lists, decl's and type's.
35 missing_alloc_size; // { dg-message "missing primary template attribute .alloc_size." }
39 missing_alloc_size<char>(int); // { dg-warning "explicit specialization .\[^\n\r\]+. may be missing attributes" }
42 /* Check that even an attribute that appears in both lists (decl and
43 type) is not reported as missing if it's present only in the type
48 ATTR ((alloc_size (1))) // In both attr lists, decl's and type's.
53 missing_nothing<char>;
56 /* For completeness, check that a type attribute is matched by a decl
57 attribute in the specialization. */
65 ATTR ((alloc_size (1)))
66 missing_nothing2<char>(int);