Debian Codegraph @

gcc/testsuite/g++.dg/ext/attr-hotness.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O0 -Wattributes -fdump-tree-gimple" } */
3
4
5 struct __attribute((cold)) A {
6 __attribute((noinline, used)) void foo(void) { }
7 template <class T> void bar() {}
8 };
9 template void A::bar<int>();
10
11 struct __attribute((hot)) B {
12 __attribute((noinline, used)) void foo(void) { }
13 template <class T> void bar() {}
14 };
15 template void B::bar<int>();
16
17 struct __attribute((hot, cold)) C { __attribute((noinline, used)) void foo(void) { } }; /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */
18
19 struct __attribute((cold, hot)) D { __attribute((noinline, used)) void foo(void) { } }; /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */
20
21
22 /* { dg-final { scan-tree-dump-times "cold" 3 "gimple" } } */
23 /* { dg-final { scan-tree-dump-times "hot" 3 "gimple" } } */
24