Bug 557060: Interpose _Throw() on MSVC and centralize pseudo-throw code in mozalloc. r=ehsan sr=bsmedberg

This commit is contained in:
Chris Jones 2010-04-20 15:12:02 -05:00
parent 3078ab39d0
commit cedd844205
20 changed files with 380 additions and 112 deletions

View File

@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)

View File

@ -45,13 +45,23 @@
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
#include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include <new> // to give mozalloc std::bad_alloc
# include <stdlib.h> // to give mozalloc malloc/free decls
# include <string.h>
# include "mozilla/mozalloc.h"
#else
# error "STL code can only be used with infallible ::operator new()"
@ -78,8 +88,8 @@
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_functexcept_h
# include "mozilla/functexcept.h"
#ifndef mozilla_throw_gcc_h
# include "mozilla/throw_gcc.h"
#endif
#endif // if mozilla_${HEADER}_h

View File

@ -62,7 +62,8 @@ def main(outdir, compiler, template_file, header_list_file):
os.mkdir(outdir)
template = open(template_file, 'r').read()
path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
@ -72,7 +73,8 @@ def main(outdir, compiler, template_file, header_list_file):
try:
f = open(os.path.join(outdir, header), 'w')
f.write(string.Template(template).substitute(HEADER=header,
HEADER_PATH=path))
HEADER_PATH=path,
NEW_HEADER_PATH=path_to_new))
finally:
f.close()

View File

@ -45,13 +45,22 @@
# error "STL code can only be used with -fno-exceptions"
#endif
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
// Code might include <new> before other wrapped headers, but <new>
// includes <exception> and so we want to wrap it. But mozalloc.h
// wants <new> also, so we break the cycle by always explicitly
// including <new> here.
#include <${NEW_HEADER_PATH}>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include <new> // to give mozalloc std::bad_alloc
# include <stdlib.h> // to give mozalloc malloc/free decls
# include <string.h>
# include "mozilla/mozalloc.h"
#else
# error "STL code can only be used with infallible ::operator new()"

View File

@ -12,8 +12,17 @@
# safety of <foo> for gcc and MSVC".
#
new
# FIXME: these headers haven't been reviewed yet, but we use them
# unsafely in modules/libpr0n, so we might as well prevent it from
# unsafely in Gecko, so we might as well prevent them from
# throwing exceptions
algorithm
deque
iostream
list
map
memory
stack
string
vector

View File

@ -76,6 +76,7 @@ include $(topsrcdir)/config/rules.mk
LIBS += $(XPCOM_STANDALONE_GLUE_LDOPTS)
DEFINES += -DXPCOM_GLUE
STL_FLAGS =
CXXFLAGS += $(MOZ_GTK2_CFLAGS)

View File

@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)

View File

@ -44,6 +44,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
VISIBILITY_FLAGS=
STL_FLAGS =
ifdef _MSC_VER
STL_FLAGS = -D_HAS_EXCEPTIONS=0
endif
MODULE = mozalloc
LIBRARY_NAME = mozalloc
@ -62,11 +66,27 @@ DEFINES += -D_GNU_SOURCE
endif
EXPORTS_NAMESPACES = mozilla
EXPORTS_mozilla = mozalloc.h mozalloc_macro_wrappers.h mozalloc_oom.h
EXPORTS_mozilla = \
mozalloc.h \
mozalloc_abort.h \
mozalloc_macro_wrappers.h \
mozalloc_oom.h \
$(NULL)
CPPSRCS = \
CPPSRCS = \
mozalloc.cpp \
mozalloc_abort.cpp \
mozalloc_oom.cpp \
$(NULL)
ifdef WRAP_STL_INCLUDES
ifdef GCC_VERSION
EXPORTS_mozilla += throw_gcc.h
endif
ifdef _MSC_VER
EXPORTS_mozilla += throw_msvc.h
CPPSRCS += throw_msvc.cpp
endif
endif # WRAP_STL_INCLUDES
include $(topsrcdir)/config/rules.mk

View File

@ -41,18 +41,16 @@
#ifndef mozilla_mozalloc_h
#define mozilla_mozalloc_h
/*
* https://bugzilla.mozilla.org/show_bug.cgi?id=427099
*/
/*
* NB: this header depends on the symbols malloc(), free(), and
* std::bad_alloc. But because this header is used in situations
* where malloc/free have different visibility, we rely on code
* including this header to provide the declarations of malloc/free.
* I.e., we don't #include <stdlib.h> or <new> on purpose.
*/
#include <stdlib.h>
#include <string.h>
#if defined(__cplusplus)
# include <new>
#endif
#if defined(MOZALLOC_EXPORT)
// do nothing: it's been defined to __declspec(dllexport) by

View File

@ -0,0 +1,91 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <stdio.h>
#include <stdlib.h> // for abort()
#if defined(_WIN32)
# include <signal.h> // for raise
#elif defined(XP_UNIX)
# include <unistd.h> // for _exit
#endif
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#endif
#include "mozilla/mozalloc_abort.h"
static int gDummyCounter;
void
mozalloc_abort(const char* const msg)
{
fputs(msg, stderr);
fputs("\n", stderr);
// XXX/cjones: most of this function was copied from
// xpcom/base/nsDebugImpl.cpp:Abort(), except that we assume on
// UNIX-like platforms can directly abort() rather than need to go
// through PR_Abort(). we don't want this code to rely on NSPR.
// FIXME/bug 558928: improve implementation for windows/wince
#if defined(_WIN32)
# if !defined(WINCE)
//This should exit us
raise(SIGABRT);
# endif
//If we are ignored exit this way..
_exit(3);
#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
abort();
#else
# warning not attempting to abort() on this platform
#endif
// Still haven't aborted? Try dereferencing null.
// (Written this way to lessen the likelihood of it being optimized away.)
gDummyCounter += *((int*) 0); // TODO annotation saying we know
// this is crazy
// Still haven't aborted? Try _exit().
_exit(127);
}

View File

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_mozalloc_abort_h
#define mozilla_mozalloc_abort_h
#if defined(MOZALLOC_EXPORT)
// do nothing: it's been defined to __declspec(dllexport) by
// mozalloc*.cpp on platforms where that's required
#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllimport)
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
/* Make sure symbols are still exported even if we're wrapped in a
* |visibility push(hidden)| blanket. */
# define MOZALLOC_EXPORT __attribute__ ((visibility ("default")))
#else
# define MOZALLOC_EXPORT
#endif
/**
* Terminate this process in such a way that breakpad is triggered, if
* at all possible.
*/
MOZALLOC_EXPORT void mozalloc_abort(const char* const msg) NS_NORETURN;
#endif /* ifndef mozilla_mozalloc_abort_h */

View File

@ -38,52 +38,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include <stdlib.h> // for abort()
#if defined(_WIN32)
# include <signal.h> // for raise
#elif defined(XP_UNIX)
# include <unistd.h> // for _exit
#endif
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#endif
#include "mozilla/mozalloc_abort.h"
#include "mozilla/mozalloc_oom.h"
static int gDummyCounter;
void
mozalloc_handle_oom()
{
// NB: this is handle_oom() stage 1, which simply aborts on OOM.
// we might proceed to a stage 2 in which an attempt is made to
// reclaim memory
// XXX/cjones: most of this function was copied from
// xpcom/base/nsDebugImpl.cpp:Abort(), except that we assume on
// UNIX-like platforms can directly abort() rather than need to go
// through PR_Abort(). we don't want this code to rely on NSPR.
#if defined(_WIN32)
# if !defined(WINCE)
//This should exit us
raise(SIGABRT);
# endif
//If we are ignored exit this way..
_exit(3);
#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
abort();
#else
# warning not attempting to abort() on this platform
#endif
// Still haven't aborted? Try dereferencing null.
// (Written this way to lessen the likelihood of it being optimized away.)
gDummyCounter += *((int*) 0); // TODO annotation saying we know
// this is crazy
// Still haven't aborted? Try _exit().
_exit(127);
mozalloc_abort("out of memory");
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 et :
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -38,127 +38,116 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_functexcept_h
#define mozilla_functexcept_h
#ifndef mozilla_throw_gcc_h
#define mozilla_throw_gcc_h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h> // snprintf
// For gcc, we define these inline to abort so that we're absolutely
// certain that (i) no exceptions are thrown from Gecko; (ii) these
// errors are always terminal and caught by breakpad.
// NB: It would be nice to #include "nsDebug.h" and use
// NS_RUNTIMEABORT(), but because this file is used within chromium,
// and nsDebug pulls in nscore, and nscore pulls in prtypes, and
// chromium can't build with prtypes being included before
// base/basictypes, then we have to roll our own aborting impl.
// Assume that if we're building with gcc, we're on a platform where
// abort() is fatal and triggers breakpad.
#define MOZ_FE_ABORT(_msg) \
do { \
fputs(_msg, stderr); \
fputs("\n", stderr); \
abort(); \
} while (0)
#include "mozilla/mozalloc_abort.h"
namespace std {
// NB: user code is not supposed to touch the std:: namespace. We're
// doing this after careful review because we want to define our own
// exception throwing semantics. Don't try this at home!
inline void NS_NORETURN
__throw_bad_exception(void)
{
MOZ_FE_ABORT("fatal: STL threw bad_exception");
mozalloc_abort("fatal: STL threw bad_exception");
}
inline void NS_NORETURN
__throw_bad_alloc(void)
{
MOZ_FE_ABORT("fatal: STL threw bad_alloc");
mozalloc_abort("fatal: STL threw bad_alloc");
}
inline void NS_NORETURN
__throw_bad_cast(void)
{
MOZ_FE_ABORT("fatal: STL threw bad_cast");
mozalloc_abort("fatal: STL threw bad_cast");
}
inline void NS_NORETURN
__throw_bad_typeid(void)
{
MOZ_FE_ABORT("fatal: STL threw bad_typeid");
mozalloc_abort("fatal: STL threw bad_typeid");
}
inline void NS_NORETURN
__throw_logic_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_domain_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_invalid_argument(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_length_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_out_of_range(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_runtime_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_range_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_overflow_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_underflow_error(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_ios_failure(const char* msg)
{
MOZ_FE_ABORT(msg);
mozalloc_abort(msg);
}
inline void NS_NORETURN
__throw_system_error(int err)
{
char error[128];
snprintf(error, sizeof(error)-1,
"fatal: STL threw system_error: %s (%d)", strerror(err), err);
MOZ_FE_ABORT(error);
char error[128];
snprintf(error, sizeof(error)-1,
"fatal: STL threw system_error: %s (%d)", strerror(err), err);
mozalloc_abort(error);
}
} // namespace std
#endif // mozilla_functexcept_h
#endif // mozilla_throw_gcc_h

View File

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <exception>
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#endif
#include "mozilla/mozalloc_abort.h"
namespace std {
// NB: user code is not supposed to touch the std:: namespace. We're
// doing this after careful review because we want to define our own
// exception throwing semantics. Don't try this at home!
__declspec(dllexport) void mozilla_Throw(const exception& e);
void
mozilla_Throw(const exception& e)
{
mozalloc_abort(e.what());
}
} // namespace std

View File

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_throw_msvc_h
#define mozilla_throw_msvc_h
// For MSVC, we define our own _Throw because the Win2k CRT doesn't
// export it.
#ifdef _EXCEPTION_
# error "Unable to wrap _Throw(); CRT _Throw() already declared"
#endif
#define _Throw mozilla_Throw
#include <exception>
#endif // mozilla_throw_msvc_h

View File

@ -55,6 +55,7 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = -I$(srcdir)/../src
DEFINES += -DXPCOM_GLUE
STL_FLAGS =
export:: $(MODULES_PROFILEDIRSERVICE_SRC_CSRCS)
$(INSTALL) $^ .

View File

@ -47,13 +47,6 @@
/* Definitions of functions and operators that allocate memory. */
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# if defined(__cplusplus)
# include NEW_H /* to give mozalloc std::bad_alloc */
# endif
/* include these to avoid the macro wrappers causing these headers to
* declare system functions with moz_ prefixes */
# include <stdlib.h>
# include <string.h>
# include "mozilla/mozalloc.h"
# include "mozilla/mozalloc_macro_wrappers.h"
#endif

View File

@ -134,12 +134,6 @@ EXPORTS_mozilla = \
SSE.h \
$(NULL)
ifdef WRAP_STL_INCLUDES
ifdef GCC_VERSION
EXPORTS_mozilla += functexcept.h
endif
endif
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)

View File

@ -105,6 +105,9 @@ FORCE_USE_PIC = 1
# for this library on Windows.
USE_STATIC_LIBS = 1
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
STL_FLAGS =
GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(XPCOM_GLUE_SRC_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
SRCS_IN_OBJDIR = 1

View File

@ -46,6 +46,7 @@ MODULE = xpcom
CPPSRCS = regxpcom.cpp
DEFINES += -DXPCOM_GLUE
STL_FLAGS =
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \