Closed
Bug 1189967
Opened 9 years ago
Closed 9 years ago
Char16.h includes <string> even when MOZ_NO_MOZALLOC is defined
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: bas.schouten, Assigned: glandium)
References
Details
Attachments
(4 files, 4 obsolete files)
2.85 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
669 bytes,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
7.04 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
3.89 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
This doesn't work since our <string> wrapper errors out when MOZ_NO_MOZALLOC is defined.
Attachment #8641911 -
Flags: review?(mh+mozilla)
Assignee | ||
Comment 1•9 years ago
|
||
Comment on attachment 8641911 [details] [diff] [review]
Don't include string when MOZ_NO_MOZALLOC is defined
Review of attachment 8641911 [details] [diff] [review]:
-----------------------------------------------------------------
::: mfbt/Char16.h
@@ +47,5 @@
> # define MOZ_USE_CHAR16_WRAPPER
> # endif
> #endif
>
> +#if defined(MOZ_USE_CHAR16_WRAPPER) && !defined(MOZ_NO_MOZALLOC)
... except the result is also to use char16_t* for char16ptr_t, which is likely not desirable.
You're failing to mention what you're trying to fix here. MOZ_NO_MOZALLOC should almost never be used.
Attachment #8641911 -
Flags: review?(mh+mozilla)
Reporter | ||
Comment 2•9 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #1)
> Comment on attachment 8641911 [details] [diff] [review]
> Don't include string when MOZ_NO_MOZALLOC is defined
>
> Review of attachment 8641911 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: mfbt/Char16.h
> @@ +47,5 @@
> > # define MOZ_USE_CHAR16_WRAPPER
> > # endif
> > #endif
> >
> > +#if defined(MOZ_USE_CHAR16_WRAPPER) && !defined(MOZ_NO_MOZALLOC)
>
> ... except the result is also to use char16_t* for char16ptr_t, which is
> likely not desirable.
>
> You're failing to mention what you're trying to fix here. MOZ_NO_MOZALLOC
> should almost never be used.
Fair point, so xpcom/typelib/xpt is compiled with MOZ_NO_ALLOC, yet it also includes mozilla-config.h which in turn includes Char16.h. On earlier versions of Visual Studio this would not include <string> and therefor not touch any of our STL wrappers. In newer versions it could, this means mozilla-config.h will now conflict with MOZ_NO_MOZALLOC since out <string> STL wrapper #errors on MOZ_NO_MOZALLOC not being defined.
Flags: needinfo?(mh+mozilla)
Assignee | ||
Comment 3•9 years ago
|
||
Sounds to me it's time to fix bug 1138321.
Flags: needinfo?(mh+mozilla)
Reporter | ||
Comment 4•9 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #3)
> Sounds to me it's time to fix bug 1138321.
Anything I can do to help there? I'd like VS2015 to build :).
Reporter | ||
Comment 5•9 years ago
|
||
So this causes additional issues, since we force-include mozilla-config.h in a bunch of places, this causes us to draw in mozalloc declarations all over the place (for example stuff in testing/tools) where we don't actually link against MOZALLOC or libxul.. Causing linking issues later on.
Reporter | ||
Comment 6•9 years ago
|
||
Basically currently the only way to make this work is defining MOZ_NO_MOZALLOC in all the tests that don't link against mozalloc (since we include mozilla-config.h in all of them), or start linking them against mozalloc..
Flags: needinfo?(mh+mozilla)
Reporter | ||
Comment 7•9 years ago
|
||
So this is one of the solutions to the problem I can come up with, a lot of these cases have stand-alone tests, they get built before mozalloc even exists and so can't easily be linked against it without changing build order. At the same time we probably don't just want to disable STL_WRAPPERS as some of these files are actually also linked into xul.dll. Having said that it's questionable whether there's a point in allowing the STL wrappers as any use of STL headers would cause the links of these stand-alone tests to fail anyway.
Attachment #8641911 -
Attachment is obsolete: true
Attachment #8643996 -
Flags: review?(mh+mozilla)
Assignee | ||
Comment 8•9 years ago
|
||
The snippet including mozilla/Char16.h was added in bug 895047, which
also made mozilla/Char16.h define __PRUNICHAR__ and typedef PRUnichar
itself. That part was removed in bug 956507, and there is actually no
reason anymore to ensure mozilla/Char16.h is included before prtypes.h.
In fact, doing so presently doesn't change anything for prtypes.h.
This simplifies the problem Bas is trying to fix, and I suspect it's
actually enough to fix it. Bas. Can you check?
Flags: needinfo?(mh+mozilla)
Attachment #8647283 -
Flags: review?(Pidgeot18)
Attachment #8647283 -
Flags: feedback?(bas)
Reporter | ||
Comment 9•9 years ago
|
||
Comment on attachment 8647283 [details] [diff] [review]
Stop including mozilla/Char16.h from mozilla-config.h
Review of attachment 8647283 [details] [diff] [review]:
-----------------------------------------------------------------
Interestingly this patch makes things worse, as it causes a bunch of other places in the build to now include out STL wrappers in more inconvenient places where they cause more, new and exciting build errors :-(. (of the type in bug 1189891)
Attachment #8647283 -
Flags: feedback?(bas) → feedback-
Reporter | ||
Updated•9 years ago
|
Flags: needinfo?(mh+mozilla)
Assignee | ||
Comment 10•9 years ago
|
||
I think it just triggers bug 1120793 earlier than it normally happens.
Flags: needinfo?(mh+mozilla)
Reporter | ||
Comment 11•9 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #10)
> I think it just triggers bug 1120793 earlier than it normally happens.
I had the second patch of that bug in my tree (skip string for mozalloc one), it also built fine with my patch (from this bug) applied which shouldn't really fix anything bug 1120793 related, but all this include stuff is somewhat of a mystery to me so who knows.
Assignee | ||
Updated•9 years ago
|
Attachment #8647283 -
Flags: review?(Pidgeot18)
Assignee | ||
Updated•9 years ago
|
Attachment #8643996 -
Flags: review?(mh+mozilla)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → mh+mozilla
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8643996 -
Attachment is obsolete: true
Attachment #8647283 -
Attachment is obsolete: true
Attachment #8650884 -
Flags: review?(nfroyd)
Assignee | ||
Comment 13•9 years ago
|
||
Since Char16.h is included everywhere, and MSVC 2015 uses the char16ptr_t trick
it contains, we include <string> everywhere, but that has the side effect of
breaking the build in subtle ways. One way around this would be to avoid including
Char16.h in the first place, but that requires more work than I was ready to put
in. So instead, just avoid including <string> by removing the conversion operator
for std::wstring.
Attachment #8650885 -
Flags: review?(nfroyd)
Assignee | ||
Comment 14•9 years ago
|
||
Somehow, TimeStamp.cpp fails to build with MSVC 2015 without this.
Attachment #8650887 -
Flags: review?(nfroyd)
Assignee | ||
Comment 15•9 years ago
|
||
Note, I think we should remove the char16ptr_t thing, and switch uses of std::wstring to std::u16string or some other type.
Assignee | ||
Comment 16•9 years ago
|
||
Fixup for OSX.
Attachment #8650884 -
Attachment is obsolete: true
Attachment #8650884 -
Flags: review?(nfroyd)
Assignee | ||
Updated•9 years ago
|
Attachment #8650943 -
Flags: review?(nfroyd)
Assignee | ||
Comment 17•9 years ago
|
||
This fixes warnings that we are actually already getting, but that adding cmath to the STL wrappers makes a hard error because TimeStamp.cpp is built with warnings as errors.
Attachment #8650959 -
Flags: review?(nfroyd)
Comment 18•9 years ago
|
||
Comment on attachment 8650885 [details] [diff] [review]
Avoid including <string> from Char16.h
Review of attachment 8650885 [details] [diff] [review]:
-----------------------------------------------------------------
::: mfbt/Char16.h
@@ -92,5 @@
> operator bool() const
> {
> return mPtr != nullptr;
> }
> - operator std::wstring() const
I wonder if it's worth |= delete|'ing this, just so we have a helpful place to hang a "this is why we don't provide conversion to wstring" comment.
Attachment #8650885 -
Flags: review?(nfroyd) → review+
Updated•9 years ago
|
Attachment #8650943 -
Flags: review?(nfroyd) → review+
Updated•9 years ago
|
Attachment #8650887 -
Flags: review?(nfroyd) → review+
Comment 19•9 years ago
|
||
Comment on attachment 8650959 [details] [diff] [review]
Avoid conflicting declarations for our raise wrappers on Windows
Review of attachment 8650959 [details] [diff] [review]:
-----------------------------------------------------------------
::: memory/mozalloc/msvc_raise_wrappers.h
@@ +17,5 @@
>
> #include "mozilla/mozalloc_abort.h"
>
> +// xutility will declare those functions in the std namespace, which we
> +// will define in msvc_raise_wrappers.cpp
This comment reads a little funny to me (mostly around "those functions", how about:
"xutility will declare the following functions in the std namespace. We #define them to be named differently so we can ensure the exception throwing semantics of these functions work exactly the way we want, by defining our own versions in msvc_raise_wrappers.cpp."
Attachment #8650959 -
Flags: review?(nfroyd) → review+
Assignee | ||
Comment 20•9 years ago
|
||
(In reply to Nathan Froyd [:froydnj][:nfroyd] from comment #18)
> Comment on attachment 8650885 [details] [diff] [review]
> Avoid including <string> from Char16.h
>
> Review of attachment 8650885 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: mfbt/Char16.h
> @@ -92,5 @@
> > operator bool() const
> > {
> > return mPtr != nullptr;
> > }
> > - operator std::wstring() const
>
> I wonder if it's worth |= delete|'ing this, just so we have a helpful place
> to hang a "this is why we don't provide conversion to wstring" comment.
How do you = delete it without including <string> for the definition of wstring? The problem being with the include, not wstring.
Comment 21•9 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #20)
> (In reply to Nathan Froyd [:froydnj][:nfroyd] from comment #18)
> > I wonder if it's worth |= delete|'ing this, just so we have a helpful place
> > to hang a "this is why we don't provide conversion to wstring" comment.
>
> How do you = delete it without including <string> for the definition of
> wstring? The problem being with the include, not wstring.
Fair point! Can't even forward-declare wstring, since it's a typedef...
Comment 22•9 years ago
|
||
Comment 23•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/73bd8b894c6b
https://hg.mozilla.org/mozilla-central/rev/6fa4f5768491
https://hg.mozilla.org/mozilla-central/rev/3cb2f2b870f4
https://hg.mozilla.org/mozilla-central/rev/187097ffcdc6
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•