I'm compiling some bioinformatics code from sourceforge (BWA http://bio-bwa.sourceforge.net/) with xlc on Linux on POWER7 and am getting some errors relating to inline functions within the code that I don't see with GCC.
"bwt.c", line 106.22: 1506-780 (S) Reference to "__occ_aux" with
internal linkage is not allowed within inline definition of "bwt_occ".
Removing the static from the function definition and changing several function definitions to "__inline__" from "inline" allows compilation to continue, but I would prefer not to mangle the code because it is not mine, and I don't know the reasons the programmer(s) may have had for defining their functions that way.
I've tried various arrangements of the compiler options: -qlanglvl=stdc99, -qkeyword=inline, and -qkeepinlines to no avail.
Pinned topic Calling static inline function from within inline function
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-06-03T21:11:51Z at 2011-06-03T21:11:51Z by Visda
Visda 060001SUB137 Posts
Re: Calling static inline function from within inline function2011-06-03T21:11:51ZThis is the accepted answer. This is the accepted answer.The xlc compiler error is most likely due to a violation of C99 in application's code. It is documented in the C99 specification (184.108.40.206):
An inline definition of a function with external linkage shall not contain a definition of a
modifiable object with static storage duration, and shall not contain a reference to an
identifier with internal linkage.
There are two suggestions that you can try to use:
Use the option -Dinline=__inline__. It implies that you use GNU (non-c99) style inlining, which is implemented in the xlc compiler with the __inline__ keyword, as GCC inline keyword by default does not conform to c99.
Use gxlc/gxlc++ to port applications. gxlc/gxlc++ takes GNU C/C++ compiler options and translates them into comparable XL C/C++ options. The list of translated options is located in configuration file gxlc.cfg shipped with XL C/C++ compiler. Please note, that not every GNU option has a corresponding XL C/C++ option - gxlc/gxlc++ will return warnings for input options that are not translated.