1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/config/gcc-stl-wrapper.template.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: sw=2 ts=8 et : 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#ifndef mozilla_${HEADER}_h 1.12 +#define mozilla_${HEADER}_h 1.13 + 1.14 +// For some reason, Apple's GCC refuses to honor -fno-exceptions when 1.15 +// compiling ObjC. 1.16 +#if __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS) 1.17 +# error "STL code can only be used with -fno-exceptions" 1.18 +#endif 1.19 + 1.20 +// Silence "warning: #include_next is a GCC extension" 1.21 +#pragma GCC system_header 1.22 + 1.23 +#ifdef _WIN32 1.24 +// Suppress windef.h min and max macros - they make std::min/max not compile. 1.25 +#define NOMINMAX 1 1.26 +#endif 1.27 + 1.28 +// mozalloc.h wants <new>; break the cycle by always explicitly 1.29 +// including <new> here. NB: this is a tad sneaky. Sez the gcc docs: 1.30 +// 1.31 +// `#include_next' does not distinguish between <file> and "file" 1.32 +// inclusion, nor does it check that the file you specify has the 1.33 +// same name as the current file. It simply looks for the file 1.34 +// named, starting with the directory in the search path after the 1.35 +// one where the current file was found. 1.36 +#include_next <new> 1.37 + 1.38 +// See if we're in code that can use mozalloc. NB: this duplicates 1.39 +// code in nscore.h because nscore.h pulls in prtypes.h, and chromium 1.40 +// can't build with that being included before base/basictypes.h. 1.41 +#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC) 1.42 +# include "mozilla/mozalloc.h" 1.43 +#else 1.44 +# error "STL code can only be used with infallible ::operator new()" 1.45 +#endif 1.46 + 1.47 +#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG) 1.48 +// Enable checked iterators and other goodies 1.49 +// 1.50 +// FIXME/bug 551254: gcc's debug STL implementation requires -frtti. 1.51 +// Figure out how to resolve this with -fno-rtti. Maybe build with 1.52 +// -frtti in DEBUG builds? 1.53 +// 1.54 +// # define _GLIBCXX_DEBUG 1 1.55 +#endif 1.56 + 1.57 +#pragma GCC visibility push(default) 1.58 +#include_next <${HEADER}> 1.59 +#pragma GCC visibility pop 1.60 + 1.61 +// gcc calls a __throw_*() function from bits/functexcept.h when it 1.62 +// wants to "throw an exception". functexcept exists nominally to 1.63 +// support -fno-exceptions, but since we'll always use the system 1.64 +// libstdc++, and it's compiled with exceptions, then in practice 1.65 +// these __throw_*() functions will always throw exceptions (shades of 1.66 +// -fshort-wchar). We don't want that and so define our own inlined 1.67 +// __throw_*(). 1.68 +#ifndef mozilla_throw_gcc_h 1.69 +# include "mozilla/throw_gcc.h" 1.70 +#endif 1.71 + 1.72 +#endif // if mozilla_${HEADER}_h