Merge mozilla-central and tracemonkey. (a=blockers)
[mozilla-central.git] / config / gcc-stl-wrapper.template.h
blob6b1a7184873ef1e6d9a957cb41a0b24710770a2e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at:
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is Mozilla Code.
19 * The Initial Developer of the Original Code is
20 * The Mozilla Foundation
21 * Portions created by the Initial Developer are Copyright (C) 2010
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
25 * Chris Jones <jones.chris.g@gmail.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef mozilla_${HEADER}_h
42 #define mozilla_${HEADER}_h
44 #if __EXCEPTIONS
45 # error "STL code can only be used with -fno-exceptions"
46 #endif
48 // Silence "warning: #include_next is a GCC extension"
49 #pragma GCC system_header
51 // mozalloc.h wants <new>; break the cycle by always explicitly
52 // including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
54 // `#include_next' does not distinguish between <file> and "file"
55 // inclusion, nor does it check that the file you specify has the
56 // same name as the current file. It simply looks for the file
57 // named, starting with the directory in the search path after the
58 // one where the current file was found.
59 #include_next <new>
61 // See if we're in code that can use mozalloc. NB: this duplicates
62 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
63 // can't build with that being included before base/basictypes.h.
64 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
65 # include "mozilla/mozalloc.h"
66 #else
67 # error "STL code can only be used with infallible ::operator new()"
68 #endif
70 #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
71 // Enable checked iterators and other goodies
73 // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
74 // Figure out how to resolve this with -fno-rtti. Maybe build with
75 // -frtti in DEBUG builds?
77 // # define _GLIBCXX_DEBUG 1
78 #endif
80 #pragma GCC visibility push(default)
81 #include_next <${HEADER}>
82 #pragma GCC visibility pop
84 // gcc calls a __throw_*() function from bits/functexcept.h when it
85 // wants to "throw an exception". functexcept exists nominally to
86 // support -fno-exceptions, but since we'll always use the system
87 // libstdc++, and it's compiled with exceptions, then in practice
88 // these __throw_*() functions will always throw exceptions (shades of
89 // -fshort-wchar). We don't want that and so define our own inlined
90 // __throw_*().
91 #ifndef mozilla_throw_gcc_h
92 # include "mozilla/throw_gcc.h"
93 #endif
95 #endif // if mozilla_${HEADER}_h