GCC编译inline函数

来源:互联网 发布:游乐场软件 编辑:程序博客网 时间:2024/05/16 06:11

GCC来编译包含inline函数的头文件gestalt.h,具体包含以下几个inline函数:

static inline int gestalt_test_bit (int nr, volatile void * addr)
{
    return test_bit(GESTALT_BITMAP_SHIFT(nr), &(GESTALT_BITMAP_ENTRY(nr, addr)));
}

static inline void gestalt_clear_bit (int nr, volatile void * addr)
{
    clear_bit(GESTALT_BITMAP_SHIFT(nr), &(GESTALT_BITMAP_ENTRY(nr, addr)));
}

static inline void gestalt_set_bit ( int nr, volatile void * addr)
{
    set_bit(GESTALT_BITMAP_SHIFT(nr), &(GESTALT_BITMAP_ENTRY(nr, addr)));
}

static inline int gestalt_test_and_set_bit (int nr, volatile void *addr)
{
    return test_and_set_bit(GESTALT_BITMAP_SHIFT(nr), &(GESTALT_BITMAP_ENTRY(nr, addr)));
}

static inline int gestalt_test_and_clear_bit (int nr, volatile void *addr)
{
    return test_and_clear_bit(GESTALT_BITMAP_SHIFT(nr), &(GESTALT_BITMAP_ENTRY(nr, addr)));
}

 

出现如下错误:

public/gestalt.h:61: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
public/gestalt.h:66: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
public/gestalt.h:71: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
public/gestalt.h:76: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
public/gestalt.h:88: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’

 

解决方法:

如果gcc的选项中有-ansi 选项,则去掉-ansi 或者使用-ansi  -std=gnu99来代替-ansi。

It should probably stop using -ansi as there are other occurences of the inline
keyword in xine headers.
原创粉丝点击