Closed
Bug 1155393
Opened 10 years ago
Closed 10 years ago
mozalloc.h:182:1: error: replacement function 'operator new' cannot be declared 'inline' [-Werror,-Winline-new-delete]
Categories
(Core :: Memory Allocator, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: dholbert, Assigned: ehsan.akhgari)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
2.48 KB,
patch
|
glandium
:
review+
dholbert
:
review+
|
Details | Diff | Splinter Review |
Bug 1062473 added this #include...
> #include "mozilla/mozalloc.h"
...to js/src/shell/js.cpp.
For some reason, this introduced this set of build warnings (treated as errors in warnings-as-errors builds) in clang 3.6 and clang 3.7:
{
1:16.05 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.06 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.06 ../../../dist/include/mozilla/mozalloc.h:182:1: error: replacement function 'operator new' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.06 MOZALLOC_INLINE
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.06 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.06 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.06 ^
1:16.06 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.06 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.06 ../../../dist/include/mozilla/mozalloc.h:189:21: error: replacement function 'operator new' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.06 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.06 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.06 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.06 ^
1:16.06 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.06 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.06 ../../../dist/include/mozilla/mozalloc.h:195:21: error: replacement function 'operator new[]' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.06 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.06 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.06 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.06 ^
1:16.06 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.06 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.06 ../../../dist/include/mozilla/mozalloc.h:201:21: error: replacement function 'operator new[]' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.06 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.06 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.06 ^
1:16.06 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.06 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.06 ^
1:16.07 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.07 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.07 ../../../dist/include/mozilla/mozalloc.h:207:21: error: replacement function 'operator delete' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.07 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.07 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.07 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.07 ^
1:16.07 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.07 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.07 ../../../dist/include/mozilla/mozalloc.h:213:21: error: replacement function 'operator delete' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.07 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.07 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.07 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.07 ^
1:16.07 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.07 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.07 ../../../dist/include/mozilla/mozalloc.h:219:21: error: replacement function 'operator delete[]' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.07 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.07 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.07 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.07 ^
1:16.07 In file included from $OBJ/js/src/shell/Unified_cpp_js_src_shell0.cpp:11:
1:16.07 In file included from $SRC/js/src/shell/js.cpp:13:
1:16.07 ../../../dist/include/mozilla/mozalloc.h:225:21: error: replacement function 'operator delete[]' cannot be declared 'inline' [-Werror,-Winline-new-delete]
1:16.07 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/mozalloc.h:31:27: note: expanded from macro 'MOZALLOC_INLINE'
1:16.07 # define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
1:16.07 ^
1:16.07 ../../../dist/include/mozilla/Attributes.h:27:75: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
1:16.07 # define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
1:16.07 ^
}
(These don't look really related to js.cpp; I'm unclear on why I'm only getting these warnings now, when I wasn't before. Anyway; let's fix these.)
Reporter | ||
Comment 1•10 years ago
|
||
Here's the local hackaround that I'm using to allow myself to still build (with warnings-as-errors) -- just telling the compiler not to treat this particular arning as an error.
This isn't a fix -- just a hackaround. I wouldn't want to actually take this on m-c (other than as a band-aid) because this warning is really spammy, as you can see in comment 0. So, we should actually fix it (or completely suppress it, if appropriate).
Reporter | ||
Comment 2•10 years ago
|
||
glandium, do you know what's going on here / can you take a look at this or suggest someone who could?
Flags: needinfo?(mh+mozilla)
Comment 4•10 years ago
|
||
(which you should know since you did it ;) )
Reporter | ||
Comment 5•10 years ago
|
||
Psh, that was ages ago. 6-digit bug number. :)
Anyway -- I wonder why that's not helping here. Can't look in depth now, but will later.
(Also, I noticed this, in the MSVC-specific section:
> 2273 if test -n "$CLANG_CL"; then
> 2274 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
> 2275 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
> 2276 fi
http://mxr.mozilla.org/mozilla-central/source/configure.in?rev=40957d7011f2#2273
That looks maybe-intended to fix this, but I doubt it has any effect since it's in a MSVC-specific section.
Reporter | ||
Updated•10 years ago
|
Flags: needinfo?(dholbert)
Comment 6•10 years ago
|
||
It doesn't help because js/src/configure.in is not configure.in, and it doesn't have those.
Reporter | ||
Comment 7•10 years ago
|
||
Ah right. So we just need to copy that bug's changes into js/src/configure then.
Assignee | ||
Comment 10•10 years ago
|
||
Attachment #8593939 -
Flags: review?(mh+mozilla)
Assignee | ||
Comment 11•10 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #5)
> Psh, that was ages ago. 6-digit bug number. :)
>
> Anyway -- I wonder why that's not helping here. Can't look in depth now, but
> will later.
>
> (Also, I noticed this, in the MSVC-specific section:
> > 2273 if test -n "$CLANG_CL"; then
> > 2274 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
> > 2275 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
> > 2276 fi
> http://mxr.mozilla.org/mozilla-central/source/configure.
> in?rev=40957d7011f2#2273
>
> That looks maybe-intended to fix this, but I doubt it has any effect since
> it's in a MSVC-specific section.
No, this is needed for clang-cl, because it will break in the exact same way as clang without that hunk.
Assignee: nobody → ehsan
Flags: needinfo?(dholbert)
Assignee | ||
Updated•10 years ago
|
Attachment #8593631 -
Attachment is obsolete: true
Reporter | ||
Comment 12•10 years ago
|
||
Ah, thanks for explaining the clang-cl chunk. (I'm unfamiliar with clang-cl & its usage w/ MSVC, but I'll take your word for it.)
Thanks for picking this up!
Reporter | ||
Comment 13•10 years ago
|
||
...though, the patch here doesn't apply to current mozilla-inbound.
e.g. this chunk of the patch doesn't apply, because js/src/configure.in doesn't actually have the "unused-local-typedef" contextual line that's quoted in the patch here:
>+++ b/js/src/configure.in
> # Turn off the following warnings that -Wall turns on:
> # -Wno-unused - lots of violations in third-party code
>+ # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
> # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros
> #
> _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
>
>+ MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
> MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef)
MXR link: http://mxr.mozilla.org/mozilla-central/source/js/src/configure.in?rev=7b86dac3ed1b#1244
Flags: needinfo?(ehsan)
Assignee | ||
Comment 14•10 years ago
|
||
Sorry, that comes from another patch in my queue! Please apply manually. I'll land this properly once glandium reviews the patch.
Flags: needinfo?(ehsan)
Reporter | ||
Comment 15•10 years ago
|
||
Comment on attachment 8593939 [details] [diff] [review]
Port the -Wno-inline-new-delete option from configure.in to the JS configure script
As author of bug 928808's patch, I'll r+ this, which I think is safe given the implicit support glandium has expressed here and on bug 928808.
Leaving r?glandium open so he can officially review, but for now I think we should get this in, because it's breaking people's builds -- and then glandium can retroactively r+ [as I'm sure he will] when he has a chance.
Attachment #8593939 -
Flags: review+
Comment 16•10 years ago
|
||
Is there some bug on file for getting an OSX build on automation that uses the same version of clang that developers who have up to date versions of XCode on their systems? It seems bad that we're repeatedly breaking it.
Assignee | ||
Comment 17•10 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #16)
> Is there some bug on file for getting an OSX build on automation that uses
> the same version of clang that developers who have up to date versions of
> XCode on their systems? It seems bad that we're repeatedly breaking it.
We are using an *ancient* version of clang on our builders. AFAIK unfortunately nobody owns updating to new compiler versions so there is little point in filing bugs unless someone steps in to help.
Comment 18•10 years ago
|
||
Updated•10 years ago
|
Attachment #8593939 -
Flags: review?(mh+mozilla) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•