Lines 12-67
Link Here
|
12 |
// compiling ObjC. |
12 |
// compiling ObjC. |
13 |
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS) |
13 |
#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS) |
14 |
# error "STL code can only be used with -fno-exceptions" |
14 |
# error "STL code can only be used with -fno-exceptions" |
15 |
#endif |
15 |
#endif |
16 |
|
16 |
|
17 |
// Silence "warning: #include_next is a GCC extension" |
17 |
// Silence "warning: #include_next is a GCC extension" |
18 |
#pragma GCC system_header |
18 |
#pragma GCC system_header |
19 |
|
19 |
|
20 |
// Don't include mozalloc for cstdlib. See bug 1245076. |
|
|
21 |
#ifndef moz_dont_include_mozalloc_for_cstdlib |
22 |
# define moz_dont_include_mozalloc_for_cstdlib |
23 |
#endif |
24 |
#ifndef moz_dont_include_mozalloc_for_${HEADER} |
25 |
// mozalloc.h wants <new>; break the cycle by always explicitly |
26 |
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs: |
27 |
// |
28 |
// `#include_next' does not distinguish between <file> and "file" |
29 |
// inclusion, nor does it check that the file you specify has the |
30 |
// same name as the current file. It simply looks for the file |
31 |
// named, starting with the directory in the search path after the |
32 |
// one where the current file was found. |
33 |
# include_next <new> |
34 |
|
35 |
// See if we're in code that can use mozalloc. NB: this duplicates |
36 |
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium |
37 |
// can't build with that being included before base/basictypes.h. |
38 |
# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC) |
39 |
# include "mozilla/mozalloc.h" |
40 |
# else |
41 |
# error "STL code can only be used with infallible ::operator new()" |
42 |
# endif |
43 |
|
44 |
#endif |
45 |
|
46 |
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG) |
20 |
#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG) |
47 |
// Enable checked iterators and other goodies |
21 |
// Enable checked iterators and other goodies |
48 |
// |
22 |
// |
49 |
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti. |
23 |
// FIXME/bug 551254: gcc's debug STL implementation requires -frtti. |
50 |
// Figure out how to resolve this with -fno-rtti. Maybe build with |
24 |
// Figure out how to resolve this with -fno-rtti. Maybe build with |
51 |
// -frtti in DEBUG builds? |
25 |
// -frtti in DEBUG builds? |
52 |
// |
26 |
// |
53 |
// # define _GLIBCXX_DEBUG 1 |
27 |
// # define _GLIBCXX_DEBUG 1 |
54 |
#endif |
28 |
#endif |
55 |
|
29 |
|
|
|
30 |
// Don't include mozalloc for cstdlib. See bug 1245076. |
31 |
#ifndef moz_dont_include_mozalloc_for_cstdlib |
32 |
# define moz_dont_include_mozalloc_for_cstdlib |
33 |
#endif |
34 |
|
35 |
// Include mozalloc after the STL header and all other headers it includes |
36 |
// have been preprocessed. |
37 |
#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \ |
38 |
!defined(moz_dont_include_mozalloc_for_${HEADER}) |
39 |
# define MOZ_INCLUDE_MOZALLOC_H |
40 |
# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER} |
41 |
#endif |
42 |
|
56 |
#pragma GCC visibility push(default) |
43 |
#pragma GCC visibility push(default) |
57 |
#include_next <${HEADER}> |
44 |
#include_next <${HEADER}> |
58 |
#pragma GCC visibility pop |
45 |
#pragma GCC visibility pop |
59 |
|
46 |
|
|
|
47 |
#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER} |
48 |
// See if we're in code that can use mozalloc. NB: this duplicates |
49 |
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium |
50 |
// can't build with that being included before base/basictypes.h. |
51 |
# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC) |
52 |
# include "mozilla/mozalloc.h" |
53 |
# else |
54 |
# error "STL code can only be used with infallible ::operator new()" |
55 |
# endif |
56 |
#endif |
57 |
|
60 |
// gcc calls a __throw_*() function from bits/functexcept.h when it |
58 |
// gcc calls a __throw_*() function from bits/functexcept.h when it |
61 |
// wants to "throw an exception". functexcept exists nominally to |
59 |
// wants to "throw an exception". functexcept exists nominally to |
62 |
// support -fno-exceptions, but since we'll always use the system |
60 |
// support -fno-exceptions, but since we'll always use the system |
63 |
// libstdc++, and it's compiled with exceptions, then in practice |
61 |
// libstdc++, and it's compiled with exceptions, then in practice |
64 |
// these __throw_*() functions will always throw exceptions (shades of |
62 |
// these __throw_*() functions will always throw exceptions (shades of |
65 |
// -fshort-wchar). We don't want that and so define our own inlined |
63 |
// -fshort-wchar). We don't want that and so define our own inlined |
66 |
// __throw_*(). |
64 |
// __throw_*(). |
67 |
#ifndef mozilla_throw_gcc_h |
65 |
#ifndef mozilla_throw_gcc_h |