stuart wrote:
This is a useful resource:
http://www.unixwiz.net/techtips/gnu-c-attributes.html... and, as noted,
__attribute__ are GNU-only advisory options which don't affect the code produced, only the warnings the compiler outputs (and thus breaking all other compilers to achieve this could be construed as somewhat rude at the very least...)
In any case, the solution to the problem is (at noted) to include:
Code:
/* If we're not using GNU C, elide __attribute__ */
#ifndef __GNUC__
# define __attribute__(x) /*NOTHING*/
#endif
... in any code which includes this form of GNU-ism.
Hm, I'm not sure it's in general okay to ignore __attribute__ as per the above. Eg., in the example I'd cited above
Code:
/* O32 stack frames have 32bit integer args */
typedef unsigned int ffi_arg __attribute__((__mode__(__SI__)));
typedef signed int ffi_sarg __attribute__((__mode__(__SI__)));
#else
/* N32 and N64 frames have 64bit integer args */
typedef unsigned int ffi_arg __attribute__((__mode__(__DI__)));
typedef signed int ffi_sarg __attribute__((__mode__(__DI__)));
eliding it would break the code - the __mode__ certainly conveys important information about the types. In the O32 case, it would be fine to get rid of the __attribute__ and it would be ok. However, for the N32/64 case, you still have to take care about the DI mode and recode it:
Code:
typedef __uint64_t ffi_arg;
typedef __int64_t ffi_sarg;