Back to index

enigmail  1.4.3
msvc-stl-wrapper.template.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  * vim: sw=2 ts=8 et :
00003  */
00004 /* ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at:
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is Mozilla Code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  *   The Mozilla Foundation
00021  * Portions created by the Initial Developer are Copyright (C) 2010
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Chris Jones <jones.chris.g@gmail.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef mozilla_${HEADER}_h
00042 #define mozilla_${HEADER}_h
00043 
00044 #if _HAS_EXCEPTIONS
00045 #  error "STL code can only be used with -fno-exceptions"
00046 #endif
00047 
00048 // Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
00049 // CRT doesn't export std::_Throw().  So we define it.
00050 #ifndef mozilla_Throw_h
00051 #  include "mozilla/throw_msvc.h"
00052 #endif
00053 
00054 // Code might include <new> before other wrapped headers, but <new>
00055 // includes <exception> and so we want to wrap it.  But mozalloc.h
00056 // wants <new> also, so we break the cycle by always explicitly
00057 // including <new> here.
00058 #include <${NEW_HEADER_PATH}>
00059 
00060 // See if we're in code that can use mozalloc.  NB: this duplicates
00061 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
00062 // can't build with that being included before base/basictypes.h.
00063 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
00064 #  include "mozilla/mozalloc.h"
00065 #else
00066 #  error "STL code can only be used with infallible ::operator new()"
00067 #endif
00068 
00069 #ifdef DEBUG
00070 // From
00071 //   http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
00072 // and
00073 //   http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
00074 // there appear to be two types of STL container checking.  The
00075 // former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
00076 // looks to be full generation/mutation checked iterators as done by
00077 // _GLIBCXX_DEBUG.  The latter appears to just be bounds checking, and
00078 // is enabled by the following macros.  It appears that the _DEBUG
00079 // iterators subsume _SECURE_SCL, and the following settings are
00080 // default anyway, so we'll just leave this commented out.
00081 //#  define _SECURE_SCL 1
00082 //#  define _SECURE_SCL_THROWS 0
00083 #else
00084 // Note: _SECURE_SCL iterators are on by default in opt builds.  We
00085 // could leave them on, but since gcc doesn't, we might as well
00086 // preserve that behavior for perf reasons.  nsTArray is in the same
00087 // camp as gcc.  Can revisit later.
00088 //
00089 // FIXME/bug 551254: because we're not wrapping all the STL headers we
00090 // use, undefining this here can cause some headers to be built with
00091 // iterator checking and others not.  Turning this off until we have a
00092 // better plan.
00093 //#  undef _SECURE_SCL
00094 #endif
00095 
00096 // We know that code won't be able to catch exceptions, but that's OK
00097 // because we're not throwing them.
00098 #pragma warning( push )
00099 #pragma warning( disable : 4530 )
00100 
00101 #include <${HEADER_PATH}>
00102 
00103 #pragma warning( pop )
00104 
00105 #endif  // if mozilla_${HEADER}_h