config/gcc-stl-wrapper.template.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * vim: sw=2 ts=8 et :
michael@0 3 */
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 #ifndef mozilla_${HEADER}_h
michael@0 9 #define mozilla_${HEADER}_h
michael@0 10
michael@0 11 // For some reason, Apple's GCC refuses to honor -fno-exceptions when
michael@0 12 // compiling ObjC.
michael@0 13 #if __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
michael@0 14 # error "STL code can only be used with -fno-exceptions"
michael@0 15 #endif
michael@0 16
michael@0 17 // Silence "warning: #include_next is a GCC extension"
michael@0 18 #pragma GCC system_header
michael@0 19
michael@0 20 #ifdef _WIN32
michael@0 21 // Suppress windef.h min and max macros - they make std::min/max not compile.
michael@0 22 #define NOMINMAX 1
michael@0 23 #endif
michael@0 24
michael@0 25 // mozalloc.h wants <new>; break the cycle by always explicitly
michael@0 26 // including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
michael@0 27 //
michael@0 28 // `#include_next' does not distinguish between <file> and "file"
michael@0 29 // inclusion, nor does it check that the file you specify has the
michael@0 30 // same name as the current file. It simply looks for the file
michael@0 31 // named, starting with the directory in the search path after the
michael@0 32 // one where the current file was found.
michael@0 33 #include_next <new>
michael@0 34
michael@0 35 // See if we're in code that can use mozalloc. NB: this duplicates
michael@0 36 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
michael@0 37 // can't build with that being included before base/basictypes.h.
michael@0 38 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
michael@0 39 # include "mozilla/mozalloc.h"
michael@0 40 #else
michael@0 41 # error "STL code can only be used with infallible ::operator new()"
michael@0 42 #endif
michael@0 43
michael@0 44 #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
michael@0 45 // Enable checked iterators and other goodies
michael@0 46 //
michael@0 47 // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
michael@0 48 // Figure out how to resolve this with -fno-rtti. Maybe build with
michael@0 49 // -frtti in DEBUG builds?
michael@0 50 //
michael@0 51 // # define _GLIBCXX_DEBUG 1
michael@0 52 #endif
michael@0 53
michael@0 54 #pragma GCC visibility push(default)
michael@0 55 #include_next <${HEADER}>
michael@0 56 #pragma GCC visibility pop
michael@0 57
michael@0 58 // gcc calls a __throw_*() function from bits/functexcept.h when it
michael@0 59 // wants to "throw an exception". functexcept exists nominally to
michael@0 60 // support -fno-exceptions, but since we'll always use the system
michael@0 61 // libstdc++, and it's compiled with exceptions, then in practice
michael@0 62 // these __throw_*() functions will always throw exceptions (shades of
michael@0 63 // -fshort-wchar). We don't want that and so define our own inlined
michael@0 64 // __throw_*().
michael@0 65 #ifndef mozilla_throw_gcc_h
michael@0 66 # include "mozilla/throw_gcc.h"
michael@0 67 #endif
michael@0 68
michael@0 69 #endif // if mozilla_${HEADER}_h

mercurial