Back to index

enigmail  1.4.3
gcc-stl-wrapper.template.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  * vim: sw=2 ts=8 et :
00003  */
00004 /* ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at:
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is Mozilla Code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  *   The Mozilla Foundation
00021  * Portions created by the Initial Developer are Copyright (C) 2010
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Chris Jones <jones.chris.g@gmail.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef mozilla_${HEADER}_h
00042 #define mozilla_${HEADER}_h
00043 
00044 // For some reason, Apple's GCC refuses to honor -fno-exceptions when
00045 // compiling ObjC.
00046 #if __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
00047 #  error "STL code can only be used with -fno-exceptions"
00048 #endif
00049 
00050 // Silence "warning: #include_next is a GCC extension"
00051 #pragma GCC system_header
00052 
00053 // mozalloc.h wants <new>; break the cycle by always explicitly
00054 // including <new> here.  NB: this is a tad sneaky.  Sez the gcc docs:
00055 //
00056 //    `#include_next' does not distinguish between <file> and "file"
00057 //    inclusion, nor does it check that the file you specify has the
00058 //    same name as the current file. It simply looks for the file
00059 //    named, starting with the directory in the search path after the
00060 //    one where the current file was found.
00061 #include_next <new>
00062 
00063 // See if we're in code that can use mozalloc.  NB: this duplicates
00064 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
00065 // can't build with that being included before base/basictypes.h.
00066 #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
00067 #  include "mozilla/mozalloc.h"
00068 #else
00069 #  error "STL code can only be used with infallible ::operator new()"
00070 #endif
00071 
00072 #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
00073 // Enable checked iterators and other goodies
00074 //
00075 // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
00076 // Figure out how to resolve this with -fno-rtti.  Maybe build with
00077 // -frtti in DEBUG builds?
00078 //
00079 //  # define _GLIBCXX_DEBUG 1
00080 #endif
00081 
00082 #pragma GCC visibility push(default)
00083 #include_next <${HEADER}>
00084 #pragma GCC visibility pop
00085 
00086 // gcc calls a __throw_*() function from bits/functexcept.h when it
00087 // wants to "throw an exception".  functexcept exists nominally to
00088 // support -fno-exceptions, but since we'll always use the system
00089 // libstdc++, and it's compiled with exceptions, then in practice
00090 // these __throw_*() functions will always throw exceptions (shades of
00091 // -fshort-wchar).  We don't want that and so define our own inlined
00092 // __throw_*().
00093 #ifndef mozilla_throw_gcc_h
00094 #  include "mozilla/throw_gcc.h"
00095 #endif
00096 
00097 #endif  // if mozilla_${HEADER}_h