Bug 1564761 [wpt PR 17620] - Document::CheckComplete should be nop when called from...
[gecko.git] / config / gcc-stl-wrapper.template.h
blob41ae14024b0c0e59dd9a886c7d128e99bf58c401
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_${HEADER}_h
9 #define mozilla_${HEADER}_h
11 // For some reason, Apple's GCC refuses to honor -fno-exceptions when
12 // compiling ObjC.
13 #if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
14 # error "STL code can only be used with -fno-exceptions"
15 #endif
17 // Silence "warning: #include_next is a GCC extension"
18 #pragma GCC system_header
20 #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
21 // Enable checked iterators and other goodies
23 // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
24 // Figure out how to resolve this with -fno-rtti. Maybe build with
25 // -frtti in DEBUG builds?
27 // # define _GLIBCXX_DEBUG 1
28 #endif
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
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
43 #pragma GCC visibility push(default)
44 #include_next <${HEADER}>
45 #pragma GCC visibility pop
47 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
48 // See if we're in code that can use mozalloc.
49 # if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
50 # include "mozilla/mozalloc.h"
51 # else
52 # error "STL code can only be used with infallible ::operator new()"
53 # endif
54 #endif
56 // gcc calls a __throw_*() function from bits/functexcept.h when it
57 // wants to "throw an exception". functexcept exists nominally to
58 // support -fno-exceptions, but since we'll always use the system
59 // libstdc++, and it's compiled with exceptions, then in practice
60 // these __throw_*() functions will always throw exceptions (shades of
61 // -fshort-wchar). We don't want that and so define our own inlined
62 // __throw_*().
63 #ifndef mozilla_throw_gcc_h
64 # include "mozilla/throw_gcc.h"
65 #endif
67 #endif // if mozilla_${HEADER}_h