Debian Codegraph @

gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c

raw
1 /* Test CTF generation works well with ((used)) function attribute.
2
3 This attribute, attached to a function, means that code must be emitted for
4 the function even if it appears that the function is not referenced. */
5
6 /* { dg-do compile } */
7 /* { dg-options "-O2 -gctf -dA" } */
8
9 /* These should be true for higher optimization levels. */
10 /* { dg-final { scan-assembler-times "ascii \"keep_this.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
11 /* { dg-final { scan-assembler-times "ascii \"lose_this.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
12
13 static int lose_this(int a)
14 {
15 return a + 2;
16 }
17
18 __attribute__((used))
19 static int keep_this(double a)
20 {
21 return a * 2;
22 }