[PATCH] Use __gnu_inline__ for __extern_always_inline in g++-4.2
Richard Smith
richard@metafoo.co.uk
Sat Dec 15 00:10:00 GMT 2012
Hi,
_FORTIFY_SOURCE's __extern_always_inline macro currently only includes
the __gnu_inline__ attribute in C++ mode for gcc >= 4.3. However,
__gnu_inline__ semantics are always desired for the
__extern_always_inline functions, and are available in g++ 4.2 (and
some releases of g++ 4.1). The attached patch causes the
__gnu_inline__ attribute to be used in C++ whenever the compiler
supports it and it is not the default, that is:
* Whenever __GNUC_STDC_INLINE__ is defined, which indicates that we
are in C, and __gnu_inline__ is available and is not the default.
* Whenever __GNUC_GNU_INLINE__ is defined in C++ mode, which
indicates that __gnu_inline__ is available (GNU inline semantics are
never the default in C++ mode).
This causes g++-4.2 to stop emitting weak definitions for the fortify
wrapper functions if they can't be inlined, and also improves Clang
compatibility.
Thanks!
Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extern-always-inline-gnu-inline.diff
Type: application/octet-stream
Size: 1034 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121215/3dda447b/attachment.obj>
More information about the Libc-alpha
mailing list