Closed
Bug 964852
Opened 10 years ago
Closed 8 years ago
Assertions.h:139:1: warning: always_inline function might not be inlinable [-Wattributes]
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
WORKSFORME
Tracking | Status | |
---|---|---|
firefox46 | --- | verified |
People
(Reporter: froydnj, Assigned: froydnj)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
4.86 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
I get a fair number of these "always_inline function might not be inlinable" warnings when compiling. The always_inline functions in question are the functions for reporting assertion errors, which shouldn't need to be inlined. (In fact, I'd be a little surprised if the compiler inlined them, since they're calling varargs functions, which are bound to be a little more expensive than calling fixed-arg functions.) We should simply declare them extern and move the implementations someplace else.
Assignee | ||
Comment 1•10 years ago
|
||
Just like the patch says.
Attachment #8366854 -
Flags: review?(jwalden+bmo)
Comment 2•10 years ago
|
||
Comment on attachment 8366854 [details] [diff] [review] move definitions of MOZ_Report* out-of-line Review of attachment 8366854 [details] [diff] [review]: ----------------------------------------------------------------- Any reason not to just s/MOZ_ALWAYS_INLINE/inline/g and leave it at that? Don't see much point in out-of-lining effort here to avoid an easy warning.
Attachment #8366854 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #2) > Any reason not to just s/MOZ_ALWAYS_INLINE/inline/g and leave it at that? > Don't see much point in out-of-lining effort here to avoid an easy warning. Hm, no, other than #include'ing slightly less stuff and getting a slightly smaller binary. I guess I'll do that instead, assuming it builds everywhere.
Assignee | ||
Comment 4•10 years ago
|
||
(Out-of-lining saves ~0.2% of text size on x86-64 debug and a whopping 250 bytes on x86-64 opt, FWIW.)
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Nathan Froyd (:froydnj) from comment #3) > (In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #2) > > Any reason not to just s/MOZ_ALWAYS_INLINE/inline/g and leave it at that? > > Don't see much point in out-of-lining effort here to avoid an easy warning. > > Hm, no, other than #include'ing slightly less stuff and getting a slightly > smaller binary. I guess I'll do that instead, assuming it builds everywhere. It does not build, particularly on Windows. We use Assertions.h in C source files (jemalloc, for instance), and MSVC doesn't recognize |inline| in C files. Hooray. WDYT about adding MOZ_INLINE with strong warnings that you shouldn't be using it if you know your code will only be used from C++?
Flags: needinfo?(jwalden+bmo)
Comment 6•10 years ago
|
||
FYI I removed MOZ_INLINE in bug 928210.
Assignee | ||
Comment 7•10 years ago
|
||
I suppose another option is to simply #ifdef __cplusplus the |inline| bit for those functions with an explanatory comment somewhere.
Comment 8•10 years ago
|
||
#ifdef _MSC_VER __inline #else inline #endif seems slightly preferable to reintroducing MOZ_INLINE for not too much value. (Particularly if, as I hope, we eventually convert to building everything in the tree as C++ and not as C, to simplify our language compatibility matrix and all.)
Flags: needinfo?(jwalden+bmo)
Comment 9•10 years ago
|
||
btw, just yesterday I wrote a patch proposing to `#define inline __inline` when compiling C code with MSVC (to fix some warnings in webrtc's C code). Redefining a keyword like `inline` is reckless, but it is unreasonable for a modern C compiler to not support understand `inline`. +#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline) +# define inline __inline +#endif + #if !defined(DEBUG) # define MOZ_ALWAYS_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG -#elif defined(_MSC_VER) && !defined(__cplusplus) -# define MOZ_ALWAYS_INLINE __inline #else # define MOZ_ALWAYS_INLINE inline #endif
Comment 10•10 years ago
|
||
MSVC12 dislikes #defining the "inline" keyword.
Comment 11•8 years ago
|
||
Nathan, do you still see these -Wattributes warnings about always_inline? I don't see them when build for Android with gcc 4.9. (I don't have a Linux build environment.)
Flags: needinfo?(nfroyd)
Assignee | ||
Comment 12•8 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #11) > Nathan, do you still see these -Wattributes warnings about always_inline? I > don't see them when build for Android with gcc 4.9. (I don't have a Linux > build environment.) I don't see them on my local 4.9 build. I guess 4.9 changed the warning somehow? (I'm pretty sure I was using 4.7 or 4.8 previously...)
Flags: needinfo?(nfroyd)
Comment 13•8 years ago
|
||
Thanks. I'm triaging old bug reports about compiler warnings. I'll close this bug unless someone sees this warning again.
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox46:
--- → verified
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•