Update mail/thunderbird to version 45.3.0_2
[dports.git] / mail / thunderbird / files / patch-bug1245076
1
2 # HG changeset patch
3 # User Mike Hommey <mh+mozilla@glandium.org>
4 # Date 1457596445 -32400
5 # Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
6 # Parent  27c94617d7064d566c24a42e11cd4c7ef725923d
7 Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
8
9 Our STL wrappers do various different things, one of which is including
10 mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
11 which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
12 circles back to our STL wrapper.
13
14 But of the things our STL wrappers do, including mozalloc.h is not one
15 that is necessary for cstdlib. So skip including mozalloc.h in our
16 cstdlib wrapper.
17
18 Additionally, some C++ sources (in media/mtransport) are including
19 headers in an extern "C" block, which end up including stdlib.h, which
20 ends up including cstdlib because really, this is all C++, and our
21 wrapper pre-includes <new> for mozalloc.h, which fails because templates
22 don't work inside extern "C". So, don't pre-include <new> when we're not
23 including mozalloc.h.
24
25
26 diff --git config/gcc-stl-wrapper.template.h config/gcc-stl-wrapper.template.h
27 --- mozilla/config/gcc-stl-wrapper.template.h
28 +++ mozilla/config/gcc-stl-wrapper.template.h
29 @@ -12,33 +12,40 @@
30  // compiling ObjC.
31  #if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
32  #  error "STL code can only be used with -fno-exceptions"
33  #endif
34  
35  // Silence "warning: #include_next is a GCC extension"
36  #pragma GCC system_header
37  
38 +// Don't include mozalloc for cstdlib. See bug 1245076.
39 +#ifndef moz_dont_include_mozalloc_for_cstdlib
40 +#  define moz_dont_include_mozalloc_for_cstdlib
41 +#endif
42 +#ifndef moz_dont_include_mozalloc_for_${HEADER}
43  // mozalloc.h wants <new>; break the cycle by always explicitly
44  // including <new> here.  NB: this is a tad sneaky.  Sez the gcc docs:
45  //
46  //    `#include_next' does not distinguish between <file> and "file"
47  //    inclusion, nor does it check that the file you specify has the
48  //    same name as the current file. It simply looks for the file
49  //    named, starting with the directory in the search path after the
50  //    one where the current file was found.
51 -#include_next <new>
52 +#  include_next <new>
53  
54  // See if we're in code that can use mozalloc.  NB: this duplicates
55  // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
56  // can't build with that being included before base/basictypes.h.
57 -#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
58 -#  include "mozilla/mozalloc.h"
59 -#else
60 -#  error "STL code can only be used with infallible ::operator new()"
61 +#  if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
62 +#    include "mozilla/mozalloc.h"
63 +#  else
64 +#    error "STL code can only be used with infallible ::operator new()"
65 +#  endif
66 +
67  #endif
68  
69  #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
70  // Enable checked iterators and other goodies
71  //
72  // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
73  // Figure out how to resolve this with -fno-rtti.  Maybe build with
74  // -frtti in DEBUG builds?