Closed
Bug 798954
Opened 13 years ago
Closed 13 years ago
NS_ALWAYS_INLINE triggers "warning: always_inline function might not be inlinable [-Wattributes]"
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
DUPLICATE
of bug 697810
People
(Reporter: dholbert, Unassigned)
References
(Blocks 1 open bug)
Details
Warning: -Wattributes in /mozilla/toolkit/components/places/SQLFunctions.cpp: always_inline function might not be inlinable
/mozilla/toolkit/components/places/SQLFunctions.cpp:95:3: warning: always_inline function might not be inlinable [-Wattributes]
Warning: -Wattributes in /mozilla/toolkit/components/places/SQLFunctions.cpp: always_inline function might not be inlinable
/mozilla/toolkit/components/places/SQLFunctions.cpp:48:3: warning: always_inline function might not be inlinable [-Wattributes]
Pretty sure these functions need to be declared with "inline" **and** NS_ALWAYS_INLINE if we actually want them to be inlined. The GCC "always_inline" attribute only has an effect if it's combined with "inline".
From the GCC docs:
> GCC does not inline any functions when not optimizing unless you
> specify the `always_inline' attribute for the function, like this:
> /* Prototype. */
> inline void foo (const char) __attribute__((always_inline));
(note: ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ both are specified.
http://gcc.gnu.org/onlinedocs/gcc/Inline.html
See also this ZFS commit, fixing the same warning in their code, with a commit message explaining this as well:
https://github.com/zfsonlinux/zfs/commit/10be533e3344f523e1b8d6ab4f0658897a95ac02
Reporter | ||
Comment 1•13 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #0)
> Pretty sure these functions need to be declared with "inline" **and**
> NS_ALWAYS_INLINE if we actually want them to be inlined. The GCC
> "always_inline" attribute only has an effect if it's combined with "inline".
Hmm, though actually there's a message on the GCC help list that disagrees with this:
If you use the always_inline attribute, then, yes, you do not need to
also use the inline keyword.
http://gcc.gnu.org/ml/gcc-help/2007-01/msg00051.html
Still, if I add "inline", the build warning goes away. So I think it's a good idea, even if it's not strictly necessary.
Reporter | ||
Comment 2•13 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #1)
> Hmm, though actually there's a message on the GCC help list that disagrees
> with this:
[...]
> http://gcc.gnu.org/ml/gcc-help/2007-01/msg00051.html
...though that's 5 years old, so I think I trust the newer information / documentation more.
I actually posted to m.d.platform about this:
https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platform/kAAEDEoQcfM
Morphing this bug to be about the general issue, rather than about the specific instance in SQLFunctions.cpp.
Component: Places → General
Product: Toolkit → Core
Summary: SQLFunctions.cpp:95:3: warning: always_inline function might not be inlinable [-Wattributes] → NS_ALWAYS_INLINE triggers "warning: always_inline function might not be inlinable [-Wattributes]"
Reporter | ||
Comment 3•13 years ago
|
||
jgilbert points me to bug 697810 which is already filed on this macro being broken. This is effectively a dupe of that bug.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•