xref: /netbsd-src/tests/usr.bin/xlint/lint1/gcc_attribute_func.c (revision b4c7d7a77ec12477c6285b9cc66c98d5ca12bbcc)
1 /*	$NetBSD: gcc_attribute_func.c,v 1.1 2021/07/06 17:33:07 rillig Exp $	*/
2 # 3 "gcc_attribute_func.c"
3 
4 /*
5  * Tests for the GCC __attribute__ for functions.
6  *
7  * https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
8  */
9 
10 void deprecated_function(void)
11     __attribute__((__noreturn__))
12     __attribute__((__aligned__(8), __cold__))
13     __attribute__((__deprecated__("do not use while driving")));
14 
15 __attribute__((__cold__))
16 void attribute_as_prefix(void);
17 
18 void __attribute__((__cold__)) attribute_after_type_spec(void);
19 void *__attribute__((__cold__)) attribute_before_name(void);
20 /*TODO: do not allow __attribute__ after function name */
21 void *attribute_after_name __attribute__((__cold__))(void);
22 void *attribute_after_parameters(void) __attribute__((__cold__));
23 
24 /* just to trigger _some_ error, to keep the .exp file */
25 /* expect+1: error: syntax error 'syntax_error' [249] */
26 __attribute__((syntax_error));
27