Added patch for GCC7 from icecat package

This commit is contained in:
Jan Horak 2017-02-21 13:03:51 +01:00
parent 8db417e215
commit d8eeae0089
2 changed files with 218 additions and 1 deletions

View File

@ -0,0 +1,212 @@
From: Jens Lody <fedora@jenslody.de>
Date: Thu, 16 Feb 2017 09:31:56 +0100
Subject: Backport of fix for mozilla-bug 1269171, needed for gcc7.
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
--- a/config/gcc-stl-wrapper.template.h
+++ b/config/gcc-stl-wrapper.template.h
@@ -17,25 +17,6 @@
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_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
-
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
// Enable checked iterators and other goodies
//
@@ -46,10 +27,34 @@
// # 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
--- a/config/make-stl-wrappers.py
+++ b/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 a/config/msvc-stl-wrapper.template.h b/config/msvc-stl-wrapper.template.h
--- a/config/msvc-stl-wrapper.template.h
+++ b/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 a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h
--- a/memory/mozalloc/mozalloc.h
+++ b/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

@ -63,7 +63,7 @@
Summary: Mozilla Thunderbird mail/newsgroup client Summary: Mozilla Thunderbird mail/newsgroup client
Name: thunderbird Name: thunderbird
Version: 45.7.0 Version: 45.7.0
Release: 2%{?dist} Release: 3%{?dist}
URL: http://www.mozilla.org/projects/thunderbird/ URL: http://www.mozilla.org/projects/thunderbird/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet Group: Applications/Internet
@ -101,6 +101,7 @@ Patch301: mozilla-1228540-1.patch
Patch302: mozilla-1228540.patch Patch302: mozilla-1228540.patch
Patch303: mozilla-1253216.patch Patch303: mozilla-1253216.patch
Patch304: mozilla-1245783.patch Patch304: mozilla-1245783.patch
Patch305: mozilla-1269171-badalloc.patch
# Fedora specific patches # Fedora specific patches
Patch400: rhbz-966424.patch Patch400: rhbz-966424.patch
@ -223,6 +224,7 @@ cd mozilla
%patch400 -p1 -b .966424 %patch400 -p1 -b .966424
#%patch402 -p1 -b .rhbz-1014858 FIXME musi byt #%patch402 -p1 -b .rhbz-1014858 FIXME musi byt
%patch304 -p1 -b .1245783 %patch304 -p1 -b .1245783
%patch305 -p1 -b .mozilla-1269171-badalloc
cd .. cd ..
%patch105 -p1 -b .bad-langs %patch105 -p1 -b .bad-langs
@ -611,6 +613,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#=============================================================================== #===============================================================================
%changelog %changelog
* Tue Feb 21 2017 Jan Horak <jhorak@redhat.com> - 45.7.0-3
- Added patch for gcc7 from icecat package
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 45.7.0-2 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 45.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild