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.

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

mercurial