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: // For some reason, Apple's GCC refuses to honor -fno-exceptions when michael@0: // compiling ObjC. michael@0: #if __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS) michael@0: # error "STL code can only be used with -fno-exceptions" michael@0: #endif michael@0: michael@0: // Silence "warning: #include_next is a GCC extension" michael@0: #pragma GCC system_header michael@0: michael@0: #ifdef _WIN32 michael@0: // Suppress windef.h min and max macros - they make std::min/max not compile. michael@0: #define NOMINMAX 1 michael@0: #endif michael@0: michael@0: // mozalloc.h wants ; break the cycle by always explicitly michael@0: // including here. NB: this is a tad sneaky. Sez the gcc docs: michael@0: // michael@0: // `#include_next' does not distinguish between and "file" michael@0: // inclusion, nor does it check that the file you specify has the michael@0: // same name as the current file. It simply looks for the file michael@0: // named, starting with the directory in the search path after the michael@0: // one where the current file was found. michael@0: #include_next 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: #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG) michael@0: // Enable checked iterators and other goodies michael@0: // michael@0: // FIXME/bug 551254: gcc's debug STL implementation requires -frtti. michael@0: // Figure out how to resolve this with -fno-rtti. Maybe build with michael@0: // -frtti in DEBUG builds? michael@0: // michael@0: // # define _GLIBCXX_DEBUG 1 michael@0: #endif michael@0: michael@0: #pragma GCC visibility push(default) michael@0: #include_next <${HEADER}> michael@0: #pragma GCC visibility pop michael@0: michael@0: // gcc calls a __throw_*() function from bits/functexcept.h when it michael@0: // wants to "throw an exception". functexcept exists nominally to michael@0: // support -fno-exceptions, but since we'll always use the system michael@0: // libstdc++, and it's compiled with exceptions, then in practice michael@0: // these __throw_*() functions will always throw exceptions (shades of michael@0: // -fshort-wchar). We don't want that and so define our own inlined michael@0: // __throw_*(). michael@0: #ifndef mozilla_throw_gcc_h michael@0: # include "mozilla/throw_gcc.h" michael@0: #endif michael@0: michael@0: #endif // if mozilla_${HEADER}_h