GCC 4.7 apparently complains if you specify the "always_inline"
attribute without also specifying "inline", as observed in [1] and [2].
The exact warning is:

   # warning: always_inline function might not
   # be inlinable [-Wattributes]

Right now, we define NS_ALWAYS_INLINE as __attribute__((always_inline))
[3], and we never bother to add "inline" alongside it in practice.  So
we basically trigger an instance of this warning (and fail to inline the
function) for each NS_ALWAYS_INLINE usage in GCC 4.7 builds, with a few
exceptions[4].

To fix the warning and actually get inlining behavior, I think we need
to do either of the following:
 (a) include "inline" alongside NS_ALWAYS_INLINE in each usage
 (b) or, change the definition of NS_ALWAYS_INLINE to include "inline"

We already effectively do (b) for MOZALLOC_INLINE [5], FWIW.

Thoughts?

~Daniel

[1] http://comments.gmane.org/gmane.linux.bluez.kernel/22080
[2]
https://github.com/zfsonlinux/zfs/commit/10be533e3344f523e1b8d6ab4f0658897a95ac02
[3] https://mxr.mozilla.org/mozilla-central/source/configure.in#3843
[4] One exception: methods that are defined in the body of a class will
get automatically marked as inline "as required by ISO C++" per
http://gcc.gnu.org/onlinedocs/gcc/Inline.html
[5]
https://mxr.mozilla.org/mozilla-central/source/memory/mozalloc/mozalloc.h#43
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to