gcc_attribute_func.c revision 1.5
1/* $NetBSD: gcc_attribute_func.c,v 1.5 2024/11/13 03:43:00 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/* lint1-extra-flags: -X 351 */ 11 12void deprecated_function(void) 13 __attribute__((__noreturn__)) 14 __attribute__((__aligned__(8), __cold__)) 15 __attribute__((__deprecated__("do not use while driving"))); 16 17__attribute__((__cold__)) 18void attribute_as_prefix(void); 19 20void __attribute__((__cold__)) attribute_after_type_spec(void); 21void *__attribute__((__cold__)) attribute_before_name(void); 22/*TODO: do not allow __attribute__ after function name */ 23void *attribute_after_name __attribute__((__cold__))(void); 24void *attribute_after_parameters(void) __attribute__((__cold__)); 25 26static void __attribute__((used)) 27used_function(void) 28{ 29} 30 31/* expect+2: warning: static function 'unused_function' unused [236] */ 32static void 33unused_function(void) 34{ 35} 36