xref: /netbsd-src/tests/usr.bin/xlint/lint1/gcc_attribute_label.c (revision 122b5006ee1bd67145794b4cde92f4fe4781a5ec)
1 /*	$NetBSD: gcc_attribute_label.c,v 1.2 2021/07/11 19:24:42 rillig Exp $	*/
2 # 3 "gcc_attribute_label.c"
3 
4 /*
5  * Tests for the GCC __attribute__ for labels.
6  *
7  * https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html
8  */
9 
10 void dead(void);
11 
12 void
13 test(int i)
14 {
15 	if (i < 1000)
16 		goto hot;
17 error:
18 	__attribute__((__cold__));
19 	dead();
20 
21 hot:
22 	__attribute__((__hot__));
23 	if (i < 0)
24 		goto error;
25 }
26