gecko: apply r421523 to the rest

Bump PORTREVISION to get a clear regression window.

PR:		212431
This commit is contained in:
Jan Beich 2016-09-18 18:38:21 +00:00
parent 2ae87730b3
commit 7d4da7f4ea
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=422403
16 changed files with 1503 additions and 3 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= thunderbird
DISTVERSION= 45.3.0
PORTREVISION= 1
CATEGORIES= mail news net-im ipv6
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source

View file

@ -0,0 +1,74 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1457596445 -32400
# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
# Parent 27c94617d7064d566c24a42e11cd4c7ef725923d
Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
Our STL wrappers do various different things, one of which is including
mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
circles back to our STL wrapper.
But of the things our STL wrappers do, including mozalloc.h is not one
that is necessary for cstdlib. So skip including mozalloc.h in our
cstdlib wrapper.
Additionally, some C++ sources (in media/mtransport) are including
headers in an extern "C" block, which end up including stdlib.h, which
ends up including cstdlib because really, this is all C++, and our
wrapper pre-includes <new> for mozalloc.h, which fails because templates
don't work inside extern "C". So, don't pre-include <new> when we're not
including mozalloc.h.
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- mozilla/config/gcc-stl-wrapper.template.h
+++ mozilla/config/gcc-stl-wrapper.template.h
@@ -12,33 +12,40 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+#ifndef moz_dont_include_mozalloc_for_${HEADER}
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
-#include_next <new>
+# include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+
#endif
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?

View file

@ -0,0 +1,50 @@
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1461978185 14400
# Node ID b622cbd9ba13d01abcb1d04684dcb39c22a08590
# Parent f3a5c8b5e17073a1e68f079da93f8dbe10e454a9
Bug 1268816 - allow Skia to use C++11 features on platforms that have them. r=froydnj
diff --git config/stl-headers config/stl-headers
--- mozilla/config/stl-headers
+++ mozilla/config/stl-headers
@@ -29,16 +29,17 @@ iterator
limits
list
map
memory
ostream
set
stack
string
+type_traits
utility
vector
cassert
climits
cmath
cstdarg
cstdio
cstdlib
diff --git config/system-headers config/system-headers
--- mozilla/config/system-headers
+++ mozilla/config/system-headers
@@ -1109,16 +1109,17 @@ ThreadManagerTests.h
Threads.h
time.h
Timer.h
tlhelp32.h
ToolUtils.h
tr1/functional
trace.h
Traps.h
+type_traits
typeinfo
types.h
Types.h
UAppleEventsMgr.h
UAttachments.h
ucontext.h
uconv.h
UCursor.h

View file

@ -0,0 +1,258 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1463557039 -32400
# Node ID 68da139d0866977c0ada86319fa94388f2255446
# Parent a640e6fa8ab9977fb6c5bcf63dc4daca6699477b
Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
Since the introduction of the STL wrappers, they have included
mozalloc.h, and multiple times, we've hit header reentrancy problems,
and worked around them as best as we could.
Taking a step back, all mozalloc.h does is:
- declare moz_* allocator functions.
- define inline implementations of various operator new/delete variants.
The first only requires the functions to be declared before they are used,
so mozalloc.h only needs to be included before anything that would use
those functions.
The second doesn't actually require a specific order, as long as the
declaration for those functions comes before their use, and they are
either declared in <new> or implicitly by the C++ compiler.
So all in all, it doesn't matter that mozalloc.h is included before the
wrapped STL headers. What matters is that it's included when STL headers
are included. So arrange things such that mozalloc.h is included after
the first wrapped STL header is fully preprocessed (and all its includes
have been included).
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- mozilla/config/gcc-stl-wrapper.template.h
+++ mozilla/config/gcc-stl-wrapper.template.h
@@ -12,56 +12,54 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
-// Don't include mozalloc for cstdlib. See bug 1245076.
-#ifndef moz_dont_include_mozalloc_for_cstdlib
-# define moz_dont_include_mozalloc_for_cstdlib
-#endif
-#ifndef moz_dont_include_mozalloc_for_${HEADER}
-// mozalloc.h wants <new>; break the cycle by always explicitly
-// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
-//
-// `#include_next' does not distinguish between <file> and "file"
-// inclusion, nor does it check that the file you specify has the
-// same name as the current file. It simply looks for the file
-// named, starting with the directory in the search path after the
-// one where the current file was found.
-# include_next <new>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-# else
-# error "STL code can only be used with infallible ::operator new()"
-# endif
-
-#endif
-
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?
//
// # define _GLIBCXX_DEBUG 1
#endif
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+ !defined(moz_dont_include_mozalloc_for_${HEADER})
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
#pragma GCC visibility push(default)
#include_next <${HEADER}>
#pragma GCC visibility pop
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
// gcc calls a __throw_*() function from bits/functexcept.h when it
// wants to "throw an exception". functexcept exists nominally to
// support -fno-exceptions, but since we'll always use the system
// libstdc++, and it's compiled with exceptions, then in practice
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_throw_gcc_h
diff --git config/make-stl-wrappers.py config/make-stl-wrappers.py
--- mozilla/config/make-stl-wrappers.py
+++ mozilla/config/make-stl-wrappers.py
@@ -25,28 +25,26 @@ def header_path(header, compiler):
def is_comment(line):
return re.match(r'\s*#.*', line)
def main(outdir, compiler, template_file, header_list_file):
if not os.path.isdir(outdir):
os.mkdir(outdir)
template = open(template_file, 'r').read()
- path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
continue
path = header_path(header, compiler)
with FileAvoidWrite(os.path.join(outdir, header)) as f:
f.write(string.Template(template).substitute(HEADER=header,
- HEADER_PATH=path,
- NEW_HEADER_PATH=path_to_new))
+ HEADER_PATH=path))
if __name__ == '__main__':
if 5 != len(sys.argv):
print("""Usage:
python {0} OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
""".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
diff --git config/msvc-stl-wrapper.template.h config/msvc-stl-wrapper.template.h
--- mozilla/config/msvc-stl-wrapper.template.h
+++ mozilla/config/msvc-stl-wrapper.template.h
@@ -3,45 +3,33 @@
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_${HEADER}_h
#define mozilla_${HEADER}_h
-#ifndef MOZ_HAVE_INCLUDED_ALLOC
-#define MOZ_HAVE_INCLUDED_ALLOC
-
#if _HAS_EXCEPTIONS
# error "STL code can only be used with -fno-exceptions"
#endif
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H)
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
-// Code might include <new> before other wrapped headers, but <new>
-// includes <exception> and so we want to wrap it. But mozalloc.h
-// wants <new> also, so we break the cycle by always explicitly
-// including <new> here.
-#include <${NEW_HEADER_PATH}>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
-#endif
-#endif /* MOZ_HAVE_INCLUDED_ALLOC */
-
#ifdef _DEBUG
// From
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
// and
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
// there appear to be two types of STL container checking. The
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
// looks to be full generation/mutation checked iterators as done by
@@ -70,9 +58,20 @@
// but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#include <${HEADER_PATH}>
#pragma warning( pop )
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
#endif // if mozilla_${HEADER}_h
diff --git memory/mozalloc/mozalloc.h memory/mozalloc/mozalloc.h
--- mozilla/memory/mozalloc/mozalloc.h
+++ mozilla/memory/mozalloc/mozalloc.h
@@ -7,20 +7,27 @@
#ifndef mozilla_mozalloc_h
#define mozilla_mozalloc_h
/*
* https://bugzilla.mozilla.org/show_bug.cgi?id=427099
*/
-#include <stdlib.h>
-#include <string.h>
#if defined(__cplusplus)
# include <new>
+// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
+// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
+// using things defined there. Specifically, with stdlib.h, the use of abs()
+// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
+# include <cstdlib>
+# include <cstring>
+#else
+# include <stdlib.h>
+# include <string.h>
#endif
#if defined(__cplusplus)
#include "mozilla/fallible.h"
#include "mozilla/TemplateLib.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"

View file

@ -4,7 +4,7 @@
PORTNAME= firefox
DISTVERSION= 45.4.0
DISTVERSIONSUFFIX=esr.source
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= www ipv6
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \

View file

@ -0,0 +1,74 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1457596445 -32400
# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
# Parent 27c94617d7064d566c24a42e11cd4c7ef725923d
Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
Our STL wrappers do various different things, one of which is including
mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
circles back to our STL wrapper.
But of the things our STL wrappers do, including mozalloc.h is not one
that is necessary for cstdlib. So skip including mozalloc.h in our
cstdlib wrapper.
Additionally, some C++ sources (in media/mtransport) are including
headers in an extern "C" block, which end up including stdlib.h, which
ends up including cstdlib because really, this is all C++, and our
wrapper pre-includes <new> for mozalloc.h, which fails because templates
don't work inside extern "C". So, don't pre-include <new> when we're not
including mozalloc.h.
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- config/gcc-stl-wrapper.template.h
+++ config/gcc-stl-wrapper.template.h
@@ -12,33 +12,40 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+#ifndef moz_dont_include_mozalloc_for_${HEADER}
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
-#include_next <new>
+# include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+
#endif
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?

View file

@ -0,0 +1,50 @@
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1461978185 14400
# Node ID b622cbd9ba13d01abcb1d04684dcb39c22a08590
# Parent f3a5c8b5e17073a1e68f079da93f8dbe10e454a9
Bug 1268816 - allow Skia to use C++11 features on platforms that have them. r=froydnj
diff --git config/stl-headers config/stl-headers
--- config/stl-headers
+++ config/stl-headers
@@ -29,16 +29,17 @@ iterator
limits
list
map
memory
ostream
set
stack
string
+type_traits
utility
vector
cassert
climits
cmath
cstdarg
cstdio
cstdlib
diff --git config/system-headers config/system-headers
--- config/system-headers
+++ config/system-headers
@@ -1109,16 +1109,17 @@ ThreadManagerTests.h
Threads.h
time.h
Timer.h
tlhelp32.h
ToolUtils.h
tr1/functional
trace.h
Traps.h
+type_traits
typeinfo
types.h
Types.h
UAppleEventsMgr.h
UAttachments.h
ucontext.h
uconv.h
UCursor.h

View file

@ -0,0 +1,258 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1463557039 -32400
# Node ID 68da139d0866977c0ada86319fa94388f2255446
# Parent a640e6fa8ab9977fb6c5bcf63dc4daca6699477b
Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
Since the introduction of the STL wrappers, they have included
mozalloc.h, and multiple times, we've hit header reentrancy problems,
and worked around them as best as we could.
Taking a step back, all mozalloc.h does is:
- declare moz_* allocator functions.
- define inline implementations of various operator new/delete variants.
The first only requires the functions to be declared before they are used,
so mozalloc.h only needs to be included before anything that would use
those functions.
The second doesn't actually require a specific order, as long as the
declaration for those functions comes before their use, and they are
either declared in <new> or implicitly by the C++ compiler.
So all in all, it doesn't matter that mozalloc.h is included before the
wrapped STL headers. What matters is that it's included when STL headers
are included. So arrange things such that mozalloc.h is included after
the first wrapped STL header is fully preprocessed (and all its includes
have been included).
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- config/gcc-stl-wrapper.template.h
+++ config/gcc-stl-wrapper.template.h
@@ -12,56 +12,54 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
-// Don't include mozalloc for cstdlib. See bug 1245076.
-#ifndef moz_dont_include_mozalloc_for_cstdlib
-# define moz_dont_include_mozalloc_for_cstdlib
-#endif
-#ifndef moz_dont_include_mozalloc_for_${HEADER}
-// mozalloc.h wants <new>; break the cycle by always explicitly
-// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
-//
-// `#include_next' does not distinguish between <file> and "file"
-// inclusion, nor does it check that the file you specify has the
-// same name as the current file. It simply looks for the file
-// named, starting with the directory in the search path after the
-// one where the current file was found.
-# include_next <new>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-# else
-# error "STL code can only be used with infallible ::operator new()"
-# endif
-
-#endif
-
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?
//
// # define _GLIBCXX_DEBUG 1
#endif
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+ !defined(moz_dont_include_mozalloc_for_${HEADER})
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
#pragma GCC visibility push(default)
#include_next <${HEADER}>
#pragma GCC visibility pop
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
// gcc calls a __throw_*() function from bits/functexcept.h when it
// wants to "throw an exception". functexcept exists nominally to
// support -fno-exceptions, but since we'll always use the system
// libstdc++, and it's compiled with exceptions, then in practice
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_throw_gcc_h
diff --git config/make-stl-wrappers.py config/make-stl-wrappers.py
--- config/make-stl-wrappers.py
+++ config/make-stl-wrappers.py
@@ -25,28 +25,26 @@ def header_path(header, compiler):
def is_comment(line):
return re.match(r'\s*#.*', line)
def main(outdir, compiler, template_file, header_list_file):
if not os.path.isdir(outdir):
os.mkdir(outdir)
template = open(template_file, 'r').read()
- path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
continue
path = header_path(header, compiler)
with FileAvoidWrite(os.path.join(outdir, header)) as f:
f.write(string.Template(template).substitute(HEADER=header,
- HEADER_PATH=path,
- NEW_HEADER_PATH=path_to_new))
+ HEADER_PATH=path))
if __name__ == '__main__':
if 5 != len(sys.argv):
print("""Usage:
python {0} OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
""".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
diff --git config/msvc-stl-wrapper.template.h config/msvc-stl-wrapper.template.h
--- config/msvc-stl-wrapper.template.h
+++ config/msvc-stl-wrapper.template.h
@@ -3,45 +3,33 @@
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_${HEADER}_h
#define mozilla_${HEADER}_h
-#ifndef MOZ_HAVE_INCLUDED_ALLOC
-#define MOZ_HAVE_INCLUDED_ALLOC
-
#if _HAS_EXCEPTIONS
# error "STL code can only be used with -fno-exceptions"
#endif
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H)
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
-// Code might include <new> before other wrapped headers, but <new>
-// includes <exception> and so we want to wrap it. But mozalloc.h
-// wants <new> also, so we break the cycle by always explicitly
-// including <new> here.
-#include <${NEW_HEADER_PATH}>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
-#endif
-#endif /* MOZ_HAVE_INCLUDED_ALLOC */
-
#ifdef _DEBUG
// From
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
// and
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
// there appear to be two types of STL container checking. The
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
// looks to be full generation/mutation checked iterators as done by
@@ -70,9 +58,20 @@
// but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#include <${HEADER_PATH}>
#pragma warning( pop )
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
#endif // if mozilla_${HEADER}_h
diff --git memory/mozalloc/mozalloc.h memory/mozalloc/mozalloc.h
--- memory/mozalloc/mozalloc.h
+++ memory/mozalloc/mozalloc.h
@@ -7,20 +7,27 @@
#ifndef mozilla_mozalloc_h
#define mozilla_mozalloc_h
/*
* https://bugzilla.mozilla.org/show_bug.cgi?id=427099
*/
-#include <stdlib.h>
-#include <string.h>
#if defined(__cplusplus)
# include <new>
+// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
+// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
+// using things defined there. Specifically, with stdlib.h, the use of abs()
+// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
+# include <cstdlib>
+# include <cstring>
+#else
+# include <stdlib.h>
+# include <string.h>
#endif
#if defined(__cplusplus)
#include "mozilla/fallible.h"
#include "mozilla/TemplateLib.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"

View file

@ -3,7 +3,7 @@
PORTNAME= libxul
DISTVERSION= 45.4.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES?= www devel
MASTER_SITES= MOZILLA/firefox/releases/${DISTVERSION}esr/source \
MOZILLA/firefox/candidates/${DISTVERSION}esr-candidates/build2/source

View file

@ -0,0 +1,74 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1457596445 -32400
# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
# Parent 27c94617d7064d566c24a42e11cd4c7ef725923d
Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
Our STL wrappers do various different things, one of which is including
mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
circles back to our STL wrapper.
But of the things our STL wrappers do, including mozalloc.h is not one
that is necessary for cstdlib. So skip including mozalloc.h in our
cstdlib wrapper.
Additionally, some C++ sources (in media/mtransport) are including
headers in an extern "C" block, which end up including stdlib.h, which
ends up including cstdlib because really, this is all C++, and our
wrapper pre-includes <new> for mozalloc.h, which fails because templates
don't work inside extern "C". So, don't pre-include <new> when we're not
including mozalloc.h.
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- config/gcc-stl-wrapper.template.h
+++ config/gcc-stl-wrapper.template.h
@@ -12,33 +12,40 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+#ifndef moz_dont_include_mozalloc_for_${HEADER}
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
-#include_next <new>
+# include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+
#endif
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?

View file

@ -0,0 +1,50 @@
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1461978185 14400
# Node ID b622cbd9ba13d01abcb1d04684dcb39c22a08590
# Parent f3a5c8b5e17073a1e68f079da93f8dbe10e454a9
Bug 1268816 - allow Skia to use C++11 features on platforms that have them. r=froydnj
diff --git config/stl-headers config/stl-headers
--- config/stl-headers
+++ config/stl-headers
@@ -29,16 +29,17 @@ iterator
limits
list
map
memory
ostream
set
stack
string
+type_traits
utility
vector
cassert
climits
cmath
cstdarg
cstdio
cstdlib
diff --git config/system-headers config/system-headers
--- config/system-headers
+++ config/system-headers
@@ -1109,16 +1109,17 @@ ThreadManagerTests.h
Threads.h
time.h
Timer.h
tlhelp32.h
ToolUtils.h
tr1/functional
trace.h
Traps.h
+type_traits
typeinfo
types.h
Types.h
UAppleEventsMgr.h
UAttachments.h
ucontext.h
uconv.h
UCursor.h

View file

@ -0,0 +1,258 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1463557039 -32400
# Node ID 68da139d0866977c0ada86319fa94388f2255446
# Parent a640e6fa8ab9977fb6c5bcf63dc4daca6699477b
Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
Since the introduction of the STL wrappers, they have included
mozalloc.h, and multiple times, we've hit header reentrancy problems,
and worked around them as best as we could.
Taking a step back, all mozalloc.h does is:
- declare moz_* allocator functions.
- define inline implementations of various operator new/delete variants.
The first only requires the functions to be declared before they are used,
so mozalloc.h only needs to be included before anything that would use
those functions.
The second doesn't actually require a specific order, as long as the
declaration for those functions comes before their use, and they are
either declared in <new> or implicitly by the C++ compiler.
So all in all, it doesn't matter that mozalloc.h is included before the
wrapped STL headers. What matters is that it's included when STL headers
are included. So arrange things such that mozalloc.h is included after
the first wrapped STL header is fully preprocessed (and all its includes
have been included).
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- config/gcc-stl-wrapper.template.h
+++ config/gcc-stl-wrapper.template.h
@@ -12,56 +12,54 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
-// Don't include mozalloc for cstdlib. See bug 1245076.
-#ifndef moz_dont_include_mozalloc_for_cstdlib
-# define moz_dont_include_mozalloc_for_cstdlib
-#endif
-#ifndef moz_dont_include_mozalloc_for_${HEADER}
-// mozalloc.h wants <new>; break the cycle by always explicitly
-// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
-//
-// `#include_next' does not distinguish between <file> and "file"
-// inclusion, nor does it check that the file you specify has the
-// same name as the current file. It simply looks for the file
-// named, starting with the directory in the search path after the
-// one where the current file was found.
-# include_next <new>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-# else
-# error "STL code can only be used with infallible ::operator new()"
-# endif
-
-#endif
-
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?
//
// # define _GLIBCXX_DEBUG 1
#endif
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+ !defined(moz_dont_include_mozalloc_for_${HEADER})
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
#pragma GCC visibility push(default)
#include_next <${HEADER}>
#pragma GCC visibility pop
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
// gcc calls a __throw_*() function from bits/functexcept.h when it
// wants to "throw an exception". functexcept exists nominally to
// support -fno-exceptions, but since we'll always use the system
// libstdc++, and it's compiled with exceptions, then in practice
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_throw_gcc_h
diff --git config/make-stl-wrappers.py config/make-stl-wrappers.py
--- config/make-stl-wrappers.py
+++ config/make-stl-wrappers.py
@@ -25,28 +25,26 @@ def header_path(header, compiler):
def is_comment(line):
return re.match(r'\s*#.*', line)
def main(outdir, compiler, template_file, header_list_file):
if not os.path.isdir(outdir):
os.mkdir(outdir)
template = open(template_file, 'r').read()
- path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
continue
path = header_path(header, compiler)
with FileAvoidWrite(os.path.join(outdir, header)) as f:
f.write(string.Template(template).substitute(HEADER=header,
- HEADER_PATH=path,
- NEW_HEADER_PATH=path_to_new))
+ HEADER_PATH=path))
if __name__ == '__main__':
if 5 != len(sys.argv):
print("""Usage:
python {0} OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
""".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
diff --git config/msvc-stl-wrapper.template.h config/msvc-stl-wrapper.template.h
--- config/msvc-stl-wrapper.template.h
+++ config/msvc-stl-wrapper.template.h
@@ -3,45 +3,33 @@
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_${HEADER}_h
#define mozilla_${HEADER}_h
-#ifndef MOZ_HAVE_INCLUDED_ALLOC
-#define MOZ_HAVE_INCLUDED_ALLOC
-
#if _HAS_EXCEPTIONS
# error "STL code can only be used with -fno-exceptions"
#endif
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H)
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
-// Code might include <new> before other wrapped headers, but <new>
-// includes <exception> and so we want to wrap it. But mozalloc.h
-// wants <new> also, so we break the cycle by always explicitly
-// including <new> here.
-#include <${NEW_HEADER_PATH}>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
-#endif
-#endif /* MOZ_HAVE_INCLUDED_ALLOC */
-
#ifdef _DEBUG
// From
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
// and
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
// there appear to be two types of STL container checking. The
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
// looks to be full generation/mutation checked iterators as done by
@@ -70,9 +58,20 @@
// but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#include <${HEADER_PATH}>
#pragma warning( pop )
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
#endif // if mozilla_${HEADER}_h
diff --git memory/mozalloc/mozalloc.h memory/mozalloc/mozalloc.h
--- memory/mozalloc/mozalloc.h
+++ memory/mozalloc/mozalloc.h
@@ -7,20 +7,27 @@
#ifndef mozilla_mozalloc_h
#define mozilla_mozalloc_h
/*
* https://bugzilla.mozilla.org/show_bug.cgi?id=427099
*/
-#include <stdlib.h>
-#include <string.h>
#if defined(__cplusplus)
# include <new>
+// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
+// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
+// using things defined there. Specifically, with stdlib.h, the use of abs()
+// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
+# include <cstdlib>
+# include <cstring>
+#else
+# include <stdlib.h>
+# include <string.h>
#endif
#if defined(__cplusplus)
#include "mozilla/fallible.h"
#include "mozilla/TemplateLib.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"

View file

@ -4,7 +4,7 @@
PORTNAME= seamonkey
DISTVERSION= 2.39
MOZILLA_VER= 42 # above + 3
PORTREVISION= 11
PORTREVISION= 12
CATEGORIES?= www mail news editors irc ipv6
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source

View file

@ -0,0 +1,74 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1457596445 -32400
# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
# Parent 27c94617d7064d566c24a42e11cd4c7ef725923d
Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
Our STL wrappers do various different things, one of which is including
mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
circles back to our STL wrapper.
But of the things our STL wrappers do, including mozalloc.h is not one
that is necessary for cstdlib. So skip including mozalloc.h in our
cstdlib wrapper.
Additionally, some C++ sources (in media/mtransport) are including
headers in an extern "C" block, which end up including stdlib.h, which
ends up including cstdlib because really, this is all C++, and our
wrapper pre-includes <new> for mozalloc.h, which fails because templates
don't work inside extern "C". So, don't pre-include <new> when we're not
including mozalloc.h.
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- mozilla/config/gcc-stl-wrapper.template.h
+++ mozilla/config/gcc-stl-wrapper.template.h
@@ -12,33 +12,40 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+#ifndef moz_dont_include_mozalloc_for_${HEADER}
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
-#include_next <new>
+# include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+
#endif
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?

View file

@ -0,0 +1,50 @@
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1461978185 14400
# Node ID b622cbd9ba13d01abcb1d04684dcb39c22a08590
# Parent f3a5c8b5e17073a1e68f079da93f8dbe10e454a9
Bug 1268816 - allow Skia to use C++11 features on platforms that have them. r=froydnj
diff --git config/stl-headers config/stl-headers
--- mozilla/config/stl-headers
+++ mozilla/config/stl-headers
@@ -27,16 +27,17 @@ iterator
limits
list
map
memory
ostream
set
stack
string
+type_traits
utility
vector
cassert
climits
cstdarg
cstdio
cstdlib
cstring
diff --git config/system-headers config/system-headers
--- mozilla/config/system-headers
+++ mozilla/config/system-headers
@@ -1109,16 +1109,17 @@ ThreadManagerTests.h
Threads.h
time.h
Timer.h
tlhelp32.h
ToolUtils.h
tr1/functional
trace.h
Traps.h
+type_traits
typeinfo
types.h
Types.h
UAppleEventsMgr.h
UAttachments.h
ucontext.h
uconv.h
UCursor.h

View file

@ -0,0 +1,229 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1463557039 -32400
# Node ID 68da139d0866977c0ada86319fa94388f2255446
# Parent a640e6fa8ab9977fb6c5bcf63dc4daca6699477b
Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
Since the introduction of the STL wrappers, they have included
mozalloc.h, and multiple times, we've hit header reentrancy problems,
and worked around them as best as we could.
Taking a step back, all mozalloc.h does is:
- declare moz_* allocator functions.
- define inline implementations of various operator new/delete variants.
The first only requires the functions to be declared before they are used,
so mozalloc.h only needs to be included before anything that would use
those functions.
The second doesn't actually require a specific order, as long as the
declaration for those functions comes before their use, and they are
either declared in <new> or implicitly by the C++ compiler.
So all in all, it doesn't matter that mozalloc.h is included before the
wrapped STL headers. What matters is that it's included when STL headers
are included. So arrange things such that mozalloc.h is included after
the first wrapped STL header is fully preprocessed (and all its includes
have been included).
diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
--- mozilla/config/gcc-stl-wrapper.template.h
+++ mozilla/config/gcc-stl-wrapper.template.h
@@ -12,56 +12,54 @@
// compiling ObjC.
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
-// Don't include mozalloc for cstdlib. See bug 1245076.
-#ifndef moz_dont_include_mozalloc_for_cstdlib
-# define moz_dont_include_mozalloc_for_cstdlib
-#endif
-#ifndef moz_dont_include_mozalloc_for_${HEADER}
-// mozalloc.h wants <new>; break the cycle by always explicitly
-// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
-//
-// `#include_next' does not distinguish between <file> and "file"
-// inclusion, nor does it check that the file you specify has the
-// same name as the current file. It simply looks for the file
-// named, starting with the directory in the search path after the
-// one where the current file was found.
-# include_next <new>
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include "mozilla/mozalloc.h"
-# else
-# error "STL code can only be used with infallible ::operator new()"
-# endif
-
-#endif
-
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
// Figure out how to resolve this with -fno-rtti. Maybe build with
// -frtti in DEBUG builds?
//
// # define _GLIBCXX_DEBUG 1
#endif
+// Don't include mozalloc for cstdlib. See bug 1245076.
+#ifndef moz_dont_include_mozalloc_for_cstdlib
+# define moz_dont_include_mozalloc_for_cstdlib
+#endif
+
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+ !defined(moz_dont_include_mozalloc_for_${HEADER})
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
#pragma GCC visibility push(default)
#include_next <${HEADER}>
#pragma GCC visibility pop
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
// gcc calls a __throw_*() function from bits/functexcept.h when it
// wants to "throw an exception". functexcept exists nominally to
// support -fno-exceptions, but since we'll always use the system
// libstdc++, and it's compiled with exceptions, then in practice
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_throw_gcc_h
diff --git config/make-stl-wrappers.py config/make-stl-wrappers.py
--- mozilla/config/make-stl-wrappers.py
+++ mozilla/config/make-stl-wrappers.py
@@ -25,28 +25,26 @@ def header_path(header, compiler):
def is_comment(line):
return re.match(r'\s*#.*', line)
def main(outdir, compiler, template_file, header_list_file):
if not os.path.isdir(outdir):
os.mkdir(outdir)
template = open(template_file, 'r').read()
- path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
continue
path = header_path(header, compiler)
with FileAvoidWrite(os.path.join(outdir, header)) as f:
f.write(string.Template(template).substitute(HEADER=header,
- HEADER_PATH=path,
- NEW_HEADER_PATH=path_to_new))
+ HEADER_PATH=path))
if __name__ == '__main__':
if 5 != len(sys.argv):
print("""Usage:
python {0} OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
""".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
diff --git config/msvc-stl-wrapper.template.h config/msvc-stl-wrapper.template.h
--- mozilla/config/msvc-stl-wrapper.template.h
+++ mozilla/config/msvc-stl-wrapper.template.h
@@ -7,16 +7,23 @@
#ifndef mozilla_${HEADER}_h
#define mozilla_${HEADER}_h
#if _HAS_EXCEPTIONS
# error "STL code can only be used with -fno-exceptions"
#endif
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H)
+# define MOZ_INCLUDE_MOZALLOC_H
+# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
// Code might include <new> before other wrapped headers, but <new>
// includes <exception> and so we want to wrap it. But mozalloc.h
@@ -66,9 +73,20 @@
// but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#include <${HEADER_PATH}>
#pragma warning( pop )
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include "mozilla/mozalloc.h"
+# else
+# error "STL code can only be used with infallible ::operator new()"
+# endif
+#endif
+
#endif // if mozilla_${HEADER}_h
diff --git memory/mozalloc/mozalloc.h memory/mozalloc/mozalloc.h
--- mozilla/memory/mozalloc/mozalloc.h
+++ mozilla/memory/mozalloc/mozalloc.h
@@ -7,20 +7,27 @@
#ifndef mozilla_mozalloc_h
#define mozilla_mozalloc_h
/*
* https://bugzilla.mozilla.org/show_bug.cgi?id=427099
*/
-#include <stdlib.h>
-#include <string.h>
#if defined(__cplusplus)
# include <new>
+// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
+// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
+// using things defined there. Specifically, with stdlib.h, the use of abs()
+// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
+# include <cstdlib>
+# include <cstring>
+#else
+# include <stdlib.h>
+# include <string.h>
#endif
#if defined(__cplusplus)
#include "mozilla/fallible.h"
#include "mozilla/TemplateLib.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"