Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / config / gcc-stl-wrapper.template.h
blob943df64ba9851921a48e11b28552d6744b5d13aa
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.h for cstdlib, cmath, type_traits, limits and iosfwd.
31 // See bug 1245076 (cstdlib), bug 1720641 (cmath), bug 1594027 (type_traits,
32 // limits) and bug 1694575 (iosfwd).
33 // Please be careful when adding more exceptions, especially regarding
34 // the header not directly or indirectly including <new>.
35 #ifndef moz_dont_include_mozalloc_for_cstdlib
36 # define moz_dont_include_mozalloc_for_cstdlib
37 #endif
39 #ifndef moz_dont_include_mozalloc_for_cmath
40 # define moz_dont_include_mozalloc_for_cmath
41 #endif
43 #ifndef moz_dont_include_mozalloc_for_type_traits
44 # define moz_dont_include_mozalloc_for_type_traits
45 #endif
47 #ifndef moz_dont_include_mozalloc_for_limits
48 # define moz_dont_include_mozalloc_for_limits
49 #endif
51 #ifndef moz_dont_include_mozalloc_for_iosfwd
52 # define moz_dont_include_mozalloc_for_iosfwd
53 #endif
55 // Include mozalloc after the STL header and all other headers it includes
56 // have been preprocessed.
57 #if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
58 !defined(moz_dont_include_mozalloc_for_${HEADER})
59 # define MOZ_INCLUDE_MOZALLOC_H
60 # define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
61 #endif
63 #pragma GCC visibility push(default)
64 #include_next <${HEADER}>
65 #pragma GCC visibility pop
67 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
68 // See if we're in code that can use mozalloc.
69 # if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
70 # include "mozilla/mozalloc.h"
71 # else
72 # error "STL code can only be used with infallible ::operator new()"
73 # endif
74 #endif
76 // gcc calls a __throw_*() function from bits/functexcept.h when it
77 // wants to "throw an exception". functexcept exists nominally to
78 // support -fno-exceptions, but since we'll always use the system
79 // libstdc++, and it's compiled with exceptions, then in practice
80 // these __throw_*() functions will always throw exceptions (shades of
81 // -fshort-wchar). We don't want that and so define our own inlined
82 // __throw_*().
83 #ifndef mozilla_throw_gcc_h
84 # include "mozilla/throw_gcc.h"
85 #endif
87 #endif // if mozilla_${HEADER}_h