1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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
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.
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
45 # error "STL code can only be used with -fno-exceptions"
48 // Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
49 // CRT doesn't export std::_Throw(). So we define it.
50 #ifndef mozilla_Throw_h
51 # include "mozilla/throw_msvc.h"
54 // Code might include <new> before other wrapped headers, but <new>
55 // includes <exception> and so we want to wrap it. But mozalloc.h
56 // wants <new> also, so we break the cycle by always explicitly
57 // including <new> here.
58 #include <${NEW_HEADER_PATH}>
60 // See if we're in code that can use mozalloc. NB: this duplicates
61 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
62 // can't build with that being included before base/basictypes.h.
63 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
64 # include "mozilla/mozalloc.h"
66 # error "STL code can only be used with infallible ::operator new()"
71 // http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
73 // http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
74 // there appear to be two types of STL container checking. The
75 // former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
76 // looks to be full generation/mutation checked iterators as done by
77 // _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
78 // is enabled by the following macros. It appears that the _DEBUG
79 // iterators subsume _SECURE_SCL, and the following settings are
80 // default anyway, so we'll just leave this commented out.
81 //# define _SECURE_SCL 1
82 //# define _SECURE_SCL_THROWS 0
84 // Note: _SECURE_SCL iterators are on by default in opt builds. We
85 // could leave them on, but since gcc doesn't, we might as well
86 // preserve that behavior for perf reasons. nsTArray is in the same
87 // camp as gcc. Can revisit later.
89 // FIXME/bug 551254: because we're not wrapping all the STL headers we
90 // use, undefining this here can cause some headers to be built with
91 // iterator checking and others not. Turning this off until we have a
96 // We know that code won't be able to catch exceptions, but that's OK
97 // because we're not throwing them.
98 #pragma warning( push )
99 #pragma warning( disable : 4530 )
101 #include <${HEADER_PATH}>
103 #pragma warning( pop )
105 #endif // if mozilla_${HEADER}_h