Bug 737833 - Only do metro registration for metro builds. r=rstrong
[gecko.git] / config / gcc-stl-wrapper.template.h
blobbd5c9159b3193559ad3a8dc18d22ea75b519504a
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 __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 // mozalloc.h wants <new>; break the cycle by always explicitly
21 // including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
23 // `#include_next' does not distinguish between <file> and "file"
24 // inclusion, nor does it check that the file you specify has the
25 // same name as the current file. It simply looks for the file
26 // named, starting with the directory in the search path after the
27 // one where the current file was found.
28 #include_next <new>
30 // See if we're in code that can use mozalloc. NB: this duplicates
31 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
32 // can't build with that being included before base/basictypes.h.
33 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
34 # include "mozilla/mozalloc.h"
35 #else
36 # error "STL code can only be used with infallible ::operator new()"
37 #endif
39 #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
40 // Enable checked iterators and other goodies
42 // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
43 // Figure out how to resolve this with -fno-rtti. Maybe build with
44 // -frtti in DEBUG builds?
46 // # define _GLIBCXX_DEBUG 1
47 #endif
49 #pragma GCC visibility push(default)
50 #include_next <${HEADER}>
51 #pragma GCC visibility pop
53 // gcc calls a __throw_*() function from bits/functexcept.h when it
54 // wants to "throw an exception". functexcept exists nominally to
55 // support -fno-exceptions, but since we'll always use the system
56 // libstdc++, and it's compiled with exceptions, then in practice
57 // these __throw_*() functions will always throw exceptions (shades of
58 // -fshort-wchar). We don't want that and so define our own inlined
59 // __throw_*().
60 #ifndef mozilla_throw_gcc_h
61 # include "mozilla/throw_gcc.h"
62 #endif
64 #endif // if mozilla_${HEADER}_h