Attributes of functions

Nicolas Baradakis nbk at sitadelle.com
Sat Sep 17 17:29:18 CEST 2005


Among other things, Primoz Bratanic has send to me a patch that adds
attributes to some of the functions. I think it is a good idea, I can
see only avantages to it:
- it makes the code more explicit for the reader.
- it helps the compiler to produce a more performant binary.
- it makes audit easier.

I'd like to know whether I can apply this patch. There're two
different methods to use the attributes of functions:

--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
#ifndef __GNUC__
#  define  __attribute__(x)  /*NOTHING*/
#endif

static void __attribute__((noreturn)) usage(void)
--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---

Or perhaps this one a little friendlier:

--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
#ifdef __GNUC__
#  define NORETURN __attribute__(noreturn)
#else
#  define NORETURN /*NOTHING*/
#endif

static void NORETURN usage(void)
--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---


-- 
Nicolas Baradakis




More information about the Freeradius-Devel mailing list