[ofa-general] Re: __always_inline macro usage

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


On Tuesday 23 October 2007 10:28, Jack Morgenstein wrote:
> 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.
> 
Correction.

In Kernel space, the __always_inline macro is present (in file /lib/modules/<kernel>/source/linux/compiler.h.

However, in user space, the file used is: /usr/include/linux/compiler.h:
#ifndef __LINUX_COMPILER_H
#define __LINUX_COMPILER_H

#define likely(x)       __builtin_expect((x),1)
#define unlikely(x)     __builtin_expect((x),0)

#endif /* __LINUX_COMPILER_H */

The __always_inline macro is not defined for userspace in RHEL4.

Any ideas (other than just including a macro ourselves:
 #ifndef __always_inline
 #define __always_inline inline
 #endif
)?

- Jack



More information about the general mailing list