michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_${HEADER}_h michael@0: #define mozilla_${HEADER}_h michael@0: michael@0: #if _HAS_EXCEPTIONS michael@0: # error "STL code can only be used with -fno-exceptions" michael@0: #endif michael@0: michael@0: // Suppress windef.h min and max macros - they make std::min/max not compile. michael@0: #define NOMINMAX 1 michael@0: michael@0: // Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k michael@0: // CRT doesn't export std::_Throw(). So we define it. michael@0: #ifndef mozilla_Throw_h michael@0: # include "mozilla/throw_msvc.h" michael@0: #endif michael@0: michael@0: // Code might include before other wrapped headers, but michael@0: // includes and so we want to wrap it. But mozalloc.h michael@0: // wants also, so we break the cycle by always explicitly michael@0: // including here. michael@0: #include <${NEW_HEADER_PATH}> michael@0: michael@0: // See if we're in code that can use mozalloc. NB: this duplicates michael@0: // code in nscore.h because nscore.h pulls in prtypes.h, and chromium michael@0: // can't build with that being included before base/basictypes.h. michael@0: #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC) michael@0: # include "mozilla/mozalloc.h" michael@0: #else michael@0: # error "STL code can only be used with infallible ::operator new()" michael@0: #endif michael@0: michael@0: #ifdef DEBUG michael@0: // From michael@0: // http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx michael@0: // and michael@0: // http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx michael@0: // there appear to be two types of STL container checking. The michael@0: // former is enabled by -D_DEBUG (which is implied by -DDEBUG), and michael@0: // looks to be full generation/mutation checked iterators as done by michael@0: // _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and michael@0: // is enabled by the following macros. It appears that the _DEBUG michael@0: // iterators subsume _SECURE_SCL, and the following settings are michael@0: // default anyway, so we'll just leave this commented out. michael@0: //# define _SECURE_SCL 1 michael@0: //# define _SECURE_SCL_THROWS 0 michael@0: #else michael@0: // Note: _SECURE_SCL iterators are on by default in opt builds. We michael@0: // could leave them on, but since gcc doesn't, we might as well michael@0: // preserve that behavior for perf reasons. nsTArray is in the same michael@0: // camp as gcc. Can revisit later. michael@0: // michael@0: // FIXME/bug 551254: because we're not wrapping all the STL headers we michael@0: // use, undefining this here can cause some headers to be built with michael@0: // iterator checking and others not. Turning this off until we have a michael@0: // better plan. michael@0: //# undef _SECURE_SCL michael@0: #endif michael@0: michael@0: // C4275: When _HAS_EXCEPTIONS is set to 0, system STL header michael@0: // will generate the warning which we can't modify. michael@0: // C4530: We know that code won't be able to catch exceptions, michael@0: // but that's OK because we're not throwing them. michael@0: #pragma warning( push ) michael@0: #pragma warning( disable : 4275 4530 ) michael@0: michael@0: #include <${HEADER_PATH}> michael@0: michael@0: #pragma warning( pop ) michael@0: michael@0: #endif // if mozilla_${HEADER}_h