[ofa-general] Re: __always_inline macro usage

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Oct 23 01:28:16 PDT 2007


On Tuesday 23 October 2007 09:23, Gleb Natapov wrote:
> And where is "#include <linux/compiler.h>" here?
> 
Point taken.  However, I checked on Red Hat Enterprise Linux 4 (update 5)
distributions.  the macro "__always_inline" is not present there (see below).
They use "inline" or "__inline__" or "__inline" instead.

How do we avoid "backports" for gcc??
================================================================
/* Never include this file directly.  Include <linux/compiler.h> instead.  */

/* These definitions are for GCC v3.x.  */
#include <linux/compiler-gcc.h>

#if __GNUC_MINOR__ >= 1  && __GNUC_MINOR__ < 4
# define inline         __inline__ __attribute__((always_inline))
# define __inline__     __inline__ __attribute__((always_inline))
# define __inline       __inline__ __attribute__((always_inline))
#endif

#if __GNUC_MINOR__ > 0
# define __deprecated   __attribute__((deprecated))
#endif

#if __GNUC_MINOR__ >= 3
# define __attribute_used__     __attribute__((__used__))
#else
# define __attribute_used__     __attribute__((__unused__))
#endif

#define __attribute_pure__      __attribute__((pure))
#define __attribute_const__     __attribute__((__const__))

#if __GNUC_MINOR__ >= 1
#define  noinline __attribute__((noinline))
#endif
#if __GNUC_MINOR__ >= 4
#define __must_check __attribute__((warn_unused_result))
#endif

#if __GNUC_MINOR__ >= 5
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#endif
~





More information about the general mailing list