Revise -mdisable-fpregs option and add new -msoft-mult option
[official-gcc.git] / gcc / testsuite / gcc.dg / Wmissing-attributes.c
blob049a4c095bd224d2b8d5b5ae79b8d8a9e0bb23ee
1 /* PR middle-end/81824 - Warn for missing attributes with function aliases
2 { dg-do compile }
3 { dg-require-alias "" }
4 { dg-options "-Wall" } */
6 #define ATTR(list) __attribute__ (list)
9 int alias_no_const (void);
11 ATTR ((const)) int
12 target_const (void) /* { dg-message ".alias_no_const. target declared here" } */
13 { return 0; }
15 ATTR ((alias ("target_const"))) int
16 alias_no_const (void); /* { dg-warning ".alias_no_const. specifies less restrictive attribute than its target .target_const.: .const." } */
19 ATTR ((alloc_size (1), malloc)) void*
20 target_malloc (int n) /* { dg-message ".alias_no_malloc. target declared here" } */
21 { return __builtin_malloc (n); }
23 ATTR ((alias ("target_malloc"))) void*
24 alias_no_malloc (int); /* { dg-warning ".alias_no_malloc. specifies less restrictive attributes than its target .target_malloc.: .alloc_size., .malloc." } */
27 ATTR ((leaf)) int
28 target_leaf (void) /* { dg-message ".alias_no_leaf. target declared here" } */
29 { return 0; }
31 ATTR ((alias ("target_leaf"))) int
32 alias_no_leaf (void); /* { dg-warning ".alias_no_leaf. specifies less restrictive attribute than its target .target_leaf.: .leaf." } */
35 /* Verify that attributes noclone, noinline, and noipa on the target
36 don't cause a warning for aliases without the attribute. */
38 ATTR ((noclone)) int
39 target_noclone (void)
40 { return 0; }
42 ATTR ((alias ("target_noclone"))) int
43 alias_no_noclone (void);
46 ATTR ((noipa)) int
47 target_noipa (void)
48 { return 0; }
50 ATTR ((alias ("target_noipa"))) int
51 alias_no_noipa (void);
54 ATTR ((noinline)) int
55 target_noinline (void)
56 { return 0; }
58 ATTR ((alias ("target_noinline"))) int
59 alias_no_noinline (void);
62 ATTR ((nothrow)) int
63 target_nothrow (void) /* { dg-message ".alias_no_nothrow. target declared here" } */
64 { return 0; }
66 ATTR ((alias ("target_nothrow"))) int
67 alias_no_nothrow (void); /* { dg-warning ".alias_no_nothrow. specifies less restrictive attribute than its target .target_nothrow.: .nothrow." } */
70 /* Verify that attribute weak on the target doesn't cause and isn't
71 mentioned in a warning for aliases without the attribute. */
73 ATTR ((weak)) int
74 target_weak (void)
75 { return 0; }
77 ATTR ((alias ("target_weak"))) int
78 alias_no_weak (void);
81 ATTR ((nothrow, weak)) int
82 target_nothrow_weak (void) /* { dg-message ".alias_nothrow_no_weak. target declared here" } */
83 { return 0; }
85 ATTR ((alias ("target_nothrow_weak"))) int
86 alias_nothrow_no_weak (void); /* { dg-warning ".alias_nothrow_no_weak. specifies less restrictive attribute than its target .target_nothrow_weak.: .nothrow." } */
89 /* Verify that __typeof__ doesn't include attributes. */
91 ATTR ((cold)) int
92 target_cold (void)
93 { return 0; }
95 __typeof__ (target_cold) ATTR ((alias ("target_cold")))
96 alias_cold; /* { dg-warning ".alias_cold. specifies less restrictive attribute than its target .target_cold.: .cold." } */