aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c
blob: 61f6b6410deed919c4c1b53e064b3d4b35e72b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Test CTF generation works well with ((used)) function attribute.

   This attribute, attached to a function, means that code must be emitted for
   the function even if it appears that the function is not referenced.  */

/* { dg-do compile )  */
/* { dg-options "-O2 -gctf -dA" } */

/* These should be true for higher optimization levels.  */
/* { dg-final { scan-assembler-times "ascii \"keep_this.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \"lose_this.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */

static int lose_this(int a)
{
    return a + 2;
}

__attribute__((used))
static int keep_this(double a)
{
    return a * 2;
}