Re: Issue with inline functions in dynamic libraries since GCC 5.1.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 06/27/2015 03:27 AM, Jonathan Wakely wrote:

> GCC 5 defaults to C11, not C90, so 'inline' now has the C99 meaning,
> not the non-standard GNU inline meaning. See
> https://gcc.gnu.org/gcc-5/porting_to.html
> 

Hi Jonathan,

Thanks for your answer. From reading the text from the link, the changes
to how inline is handled occurs very strange to me:

"C99 inline: No externally visible function is generated. If the
function is referenced in this TU, an external definition has to exist
in another TU; same as GNU89 extern inline with no redefinition."

So the *definition* of the inline function is then completely ignored?
That means that something like

inline void f1(void);


int main(void)
{
	f1();
}

inline void f1(void)
{

}

is not valid C99 nor C11. I'm curious about the reason(s) for the
language to be defined this way. Without the inline function specifier,
it is perfectly legal C and I was under the assumption that the inline
function specifier only added a (strong) hint to the compiler to inline
as much as possible.

> If you don't want to fix your code to conform to standard C semantics
> then you can compile with -std=gnu90 to get the old language mode.
> 

Luckily, I could fix the code. Should have been "static inline" for all
versions of C (and compilers used) as the inline function was only
referenced inside that source file.

Cheers,

Bas.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux