comparison gcc/testsuite/gcc.dg/attr-copy-5.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* PR middle-end/81824 - Warn for missing attributes with function aliases
2 Verify that attributes always_inline, gnu_inline, and noinline aren't
3 copied. Also verify that copying attribute tls_model to a non-thread
4 variable triggers a warning.
5 { dg-do compile }
6 { dg-require-alias "" }
7 { dg-options "-Wall" }
8 { dg-require-effective-target tls } */
9
10 #define ATTR(...) __attribute__ ((__VA_ARGS__))
11
12 ATTR (always_inline, gnu_inline, noreturn) inline int
13 finline_noret (void)
14 {
15 __builtin_abort ();
16 /* Expect no -Wreturn-type. */
17 }
18
19 int call_finline_noret (void)
20 {
21 finline_noret ();
22 /* Expect no -Wreturn-type. */
23 }
24
25
26 ATTR (copy (finline_noret)) int
27 fnoret (void);
28
29 int call_fnoret (void)
30 {
31 fnoret ();
32 /* Expect no -Wreturn-type. */
33 }
34
35
36 /* Verify that attribute always_inline on an alias target doesn't
37 get copied and interfere with attribute noinline on the alias
38 (trigger a warning due to a conflict). */
39
40 ATTR (always_inline) static inline int
41 finline (void) { return 0; }
42
43 ATTR (alias ("finline"), noinline) int
44 fnoinline (void);
45
46 ATTR (copy (finline)) int
47 fnoinline (void);
48
49
50 ATTR (tls_model ("global-dynamic")) __thread int
51 tls_target;
52
53 ATTR (alias ("tls_target"), copy (tls_target)) extern __thread int
54 thread_alias;
55
56
57 ATTR (alias ("tls_target"), copy (tls_target)) extern int
58 alias; /* { dg-warning ".tls_model. attribute ignored because .alias. does not have thread storage duration" } */