[ofa-general] Re: __always_inline macro usage

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Oct 23 00:22:09 PDT 2007


On Monday 22 October 2007 23:42, Roland Dreier wrote:
> Something is fishy with your compilation process.  __always_inline
> should never be visible to gcc; it is a macro defined in <linux/compiler.h>.
> 

Might this be a gcc installation problem?

I have the following file (foobar.c):

==============
static __always_inline int foo(int i) {return (i+1); }
int main(void) { return foo(5); }
==============

If I just do:  gcc foobar.c,
I get the following output:
	foobar.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’

If I modify the file to:
==============
static __attribute__((always_inline)) int foo(int i) {return (i+1); }
int main(void) { return foo(5); }
==============

and do gcc foobar.c,
the compilation succeeds.

I'm using gcc (GCC) 4.1.0 (SUSE Linux), on SLES 10.

-- Jack



More information about the general mailing list