Bug 1570982 - remove `CPP_THROW_NEW`; r=glandium

We always define it to the same thing, and we're inconsistent in whether
we use `CPP_THROW_NEW` or `throw()`, so we might as well just use the
standard C++ thing and get rid of some baggage.

Differential Revision: https://phabricator.services.mozilla.com/D40425

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-08-14 01:32:41 +00:00
Родитель 7894040eac
Коммит 87c432d06a
29 изменённых файлов: 35 добавлений и 44 удалений

Просмотреть файл

@ -79,7 +79,7 @@ nsMappedAttributes* nsMappedAttributes::Clone(bool aWillAddAttr) {
}
void* nsMappedAttributes::operator new(size_t aSize,
uint32_t aAttrCount) CPP_THROW_NEW {
uint32_t aAttrCount) noexcept(true) {
size_t size = aSize + aAttrCount * sizeof(InternalAttr);
// aSize will include the mAttrs buffer so subtract that.

Просмотреть файл

@ -27,7 +27,7 @@ class nsMappedAttributes final {
nsMapRuleToAttributesFunc aMapRuleFunc);
// Do not return null.
void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
void* operator new(size_t size, uint32_t aAttrCount = 1) noexcept(true);
nsMappedAttributes* Clone(bool aWillAddAttr);
NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(nsMappedAttributes, LastRelease())

Просмотреть файл

@ -53,7 +53,7 @@ class MOZ_STACK_CLASS SafeOptionListMutation {
void MutationFailed() { mNeedsRebuild = true; }
private:
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
static void* operator new(size_t) noexcept(true) { return 0; }
static void operator delete(void*, size_t) {}
/** The select element which option list is being mutated. */
RefPtr<HTMLSelectElement> mSelect;

Просмотреть файл

@ -81,7 +81,7 @@ class MOZ_STACK_CLASS ReentrantMonitorConditionallyEnter {
ReentrantMonitorConditionallyEnter(const ReentrantMonitorConditionallyEnter&);
ReentrantMonitorConditionallyEnter& operator=(
const ReentrantMonitorConditionallyEnter&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
static void operator delete(void*);
ReentrantMonitor* mReentrantMonitor;

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsMargin.h" // for nsIntMargin
#include "nsRegionFwd.h" // for nsIntRegion
#include "nsString.h" // for nsCString
#include "xpcom-config.h" // for CPP_THROW_NEW
#include "mozilla/ArrayView.h" // for ArrayView
#include "mozilla/Move.h" // for mozilla::Move
#include "mozilla/gfx/MatrixFwd.h" // for mozilla::gfx::Matrix4x4

Просмотреть файл

@ -4112,7 +4112,7 @@ bool js::AsyncFromSyncIteratorMethod(JSContext* cx, CallArgs& args,
return true;
}
} else {
// throw() steps 5-7.
// noexcept(true) steps 5-7.
MOZ_ASSERT(completionKind == CompletionKind::Throw);
// Step 5: Let throw be GetMethod(syncIterator, "throw").

Просмотреть файл

@ -143,7 +143,7 @@ class AutoJitContextAlloc {
struct TempObject {
inline void* operator new(size_t nbytes,
TempAllocator::Fallible view) throw() {
TempAllocator::Fallible view) noexcept(true) {
return view.alloc.allocate(nbytes);
}
inline void* operator new(size_t nbytes, TempAllocator& alloc) {

Просмотреть файл

@ -1019,7 +1019,7 @@ class MInstruction : public MDefinition, public InlineListNode<MInstruction> {
// following code prevents calls to "new(alloc) MFoo" outside the MFoo
// members.
inline void* operator new(size_t nbytes,
TempAllocator::Fallible view) throw() {
TempAllocator::Fallible view) noexcept(true) {
return TempObject::operator new(nbytes, view);
}
inline void* operator new(size_t nbytes, TempAllocator& alloc) {

Просмотреть файл

@ -1433,7 +1433,6 @@ if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
fi
fi # ! SKIP_COMPILER_CHECKS
AC_DEFINE(CPP_THROW_NEW, [throw()])
AC_LANG_C
MOZ_EXPAND_LIBS

Просмотреть файл

@ -258,13 +258,13 @@ typedef AstVector<AstName> AstNameVector;
typedef AstVector<AstRef> AstRefVector;
struct AstBase {
void* operator new(size_t numBytes, LifoAlloc& astLifo) throw() {
void* operator new(size_t numBytes, LifoAlloc& astLifo) noexcept(true) {
return astLifo.alloc(numBytes);
}
};
struct AstNode {
void* operator new(size_t numBytes, LifoAlloc& astLifo) throw() {
void* operator new(size_t numBytes, LifoAlloc& astLifo) noexcept(true) {
return astLifo.alloc(numBytes);
}
};

Просмотреть файл

@ -1084,7 +1084,7 @@ class XPCNativeInterface final {
: mInfo(aInfo), mName(aName), mMemberCount(0) {}
~XPCNativeInterface();
void* operator new(size_t, void* p) CPP_THROW_NEW { return p; }
void* operator new(size_t, void* p) noexcept(true) { return p; }
XPCNativeInterface(const XPCNativeInterface& r) = delete;
XPCNativeInterface& operator=(const XPCNativeInterface& r) = delete;
@ -1205,7 +1205,7 @@ class XPCNativeSet final {
XPCNativeSet() : mMemberCount(0), mInterfaceCount(0) {}
~XPCNativeSet();
void* operator new(size_t, void* p) CPP_THROW_NEW { return p; }
void* operator new(size_t, void* p) noexcept(true) { return p; }
static void DestroyInstance(XPCNativeSet* inst);

Просмотреть файл

@ -49,7 +49,7 @@ nsFloatManager::nsFloatManager(PresShell* aPresShell, WritingMode aWM)
nsFloatManager::~nsFloatManager() { MOZ_COUNT_DTOR(nsFloatManager); }
// static
void* nsFloatManager::operator new(size_t aSize) CPP_THROW_NEW {
void* nsFloatManager::operator new(size_t aSize) noexcept(true) {
if (sCachedFloatManagerCount > 0) {
// We have cached unused instances of this class, return a cached
// instance in stead of always creating a new one.

Просмотреть файл

@ -95,7 +95,7 @@ class nsFloatManager {
mozilla::WritingMode aWM);
~nsFloatManager();
void* operator new(size_t aSize) CPP_THROW_NEW;
void* operator new(size_t aSize) noexcept(true);
void operator delete(void* aPtr, size_t aSize);
static void Shutdown();

Просмотреть файл

@ -136,7 +136,7 @@ class nsFrame : public nsBox {
private:
// Left undefined; nsFrame objects are never allocated from the heap.
void* operator new(size_t sz) CPP_THROW_NEW;
void* operator new(size_t sz) noexcept(true);
protected:
// Overridden to prevent the global delete from being called, since

Просмотреть файл

@ -3736,7 +3736,7 @@ class nsDisplayListSet {
private:
// This class is only used on stack, so we don't have to worry about leaking
// it. Don't let us be heap-allocated!
void* operator new(size_t sz) CPP_THROW_NEW;
void* operator new(size_t sz) noexcept(true);
protected:
nsDisplayList* mBorderBackground;
@ -3782,7 +3782,7 @@ struct nsDisplayListCollection : public nsDisplayListSet {
private:
// This class is only used on stack, so we don't have to worry about leaking
// it. Don't let us be heap-allocated!
void* operator new(size_t sz) CPP_THROW_NEW;
void* operator new(size_t sz) noexcept(true);
nsDisplayList mLists[6];
};

Просмотреть файл

@ -43,7 +43,7 @@ class CSSFontFaceRuleDecl final : public nsICSSDeclaration {
RefPtr<RawServoFontFaceRule> mRawRule;
private:
void* operator new(size_t size) CPP_THROW_NEW = delete;
void* operator new(size_t size) noexcept(true) = delete;
};
class CSSFontFaceRule final : public css::Rule {

Просмотреть файл

@ -84,7 +84,7 @@ class MOZ_STACK_CLASS SpanningCellSorter {
* memory, which much be pushed and popped at points matching a
* push/pop on the C++ stack.
*/
void* operator new(size_t sz) CPP_THROW_NEW { return nullptr; }
void* operator new(size_t sz) noexcept(true) { return nullptr; }
};
#endif

Просмотреть файл

@ -105,7 +105,7 @@ class nsDisplayTableBackgroundSet {
private:
// This class is only used on stack, so we don't have to worry about leaking
// it. Don't let us be heap-allocated!
void* operator new(size_t sz) CPP_THROW_NEW;
void* operator new(size_t sz) noexcept(true);
protected:
nsDisplayListBuilder* mBuilder;

Просмотреть файл

@ -1504,14 +1504,14 @@ nsBoxSize::nsBoxSize() {
}
void* nsBoxSize::operator new(size_t sz,
nsBoxLayoutState& aState) CPP_THROW_NEW {
nsBoxLayoutState& aState) noexcept(true) {
return mozilla::AutoStackArena::Allocate(sz);
}
void nsBoxSize::operator delete(void* aPtr, size_t sz) {}
void* nsComputedBoxSize::operator new(size_t sz,
nsBoxLayoutState& aState) CPP_THROW_NEW {
nsBoxLayoutState& aState) noexcept(true) {
return mozilla::AutoStackArena::Allocate(sz);
}

Просмотреть файл

@ -27,7 +27,7 @@ class nsBoxSize {
nsBoxSize* next;
void* operator new(size_t sz, nsBoxLayoutState& aState) CPP_THROW_NEW;
void* operator new(size_t sz, nsBoxLayoutState& aState) noexcept(true);
void operator delete(void* aPtr, size_t sz);
};
@ -40,7 +40,7 @@ class nsComputedBoxSize {
bool resized;
nsComputedBoxSize* next;
void* operator new(size_t sz, nsBoxLayoutState& aState) CPP_THROW_NEW;
void* operator new(size_t sz, nsBoxLayoutState& aState) noexcept(true);
void operator delete(void* aPtr, size_t sz);
};

Просмотреть файл

@ -2571,7 +2571,6 @@ fi
fi # ! SKIP_COMPILER_CHECKS
AC_DEFINE(CPP_THROW_NEW, [throw()])
AC_LANG_C
if test "$COMPILE_ENVIRONMENT"; then
@ -3276,7 +3275,6 @@ dnl ========================================================
dnl The following defines are used by xpcom
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
CPP_THROW_NEW
HAVE_GETPAGESIZE
HAVE_STATVFS64
HAVE_STATVFS

Просмотреть файл

@ -78,7 +78,7 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticMonitor {
// Disallow these operators.
StaticMonitor& operator=(const StaticMonitor& aRhs);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
static void operator delete(void*);
};
@ -101,7 +101,7 @@ class MOZ_STACK_CLASS StaticMonitorAutoLock {
StaticMonitorAutoLock();
StaticMonitorAutoLock(const StaticMonitorAutoLock&);
StaticMonitorAutoLock& operator=(const StaticMonitorAutoLock&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
StaticMonitor* mMonitor;
};

Просмотреть файл

@ -72,7 +72,7 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS BaseStaticMutex {
// Disallow these operators.
BaseStaticMutex& operator=(BaseStaticMutex* aRhs);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
static void operator delete(void*);
};

Просмотреть файл

@ -79,7 +79,7 @@ class MOZ_STACK_CLASS MonitorAutoLock {
MonitorAutoLock();
MonitorAutoLock(const MonitorAutoLock&);
MonitorAutoLock& operator=(const MonitorAutoLock&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
friend class MonitorAutoUnlock;
@ -110,7 +110,7 @@ class MOZ_STACK_CLASS MonitorAutoUnlock {
MonitorAutoUnlock();
MonitorAutoUnlock(const MonitorAutoUnlock&);
MonitorAutoUnlock& operator=(const MonitorAutoUnlock&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
Monitor* mMonitor;
};

Просмотреть файл

@ -201,7 +201,7 @@ class MOZ_RAII BaseAutoLock {
BaseAutoLock();
BaseAutoLock(BaseAutoLock&);
BaseAutoLock& operator=(BaseAutoLock&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
friend class BaseAutoUnlock<T>;
@ -242,7 +242,7 @@ class MOZ_RAII BaseAutoUnlock {
BaseAutoUnlock();
BaseAutoUnlock(BaseAutoUnlock&);
BaseAutoUnlock& operator=(BaseAutoUnlock&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
T mLock;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

Просмотреть файл

@ -87,7 +87,7 @@ class MOZ_RAII RecursiveMutexAutoLock {
RecursiveMutexAutoLock() = delete;
RecursiveMutexAutoLock(const RecursiveMutexAutoLock&) = delete;
RecursiveMutexAutoLock& operator=(const RecursiveMutexAutoLock&) = delete;
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
mozilla::RecursiveMutex* mRecursiveMutex;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
@ -109,7 +109,7 @@ class MOZ_RAII RecursiveMutexAutoUnlock {
RecursiveMutexAutoUnlock() = delete;
RecursiveMutexAutoUnlock(const RecursiveMutexAutoUnlock&) = delete;
RecursiveMutexAutoUnlock& operator=(const RecursiveMutexAutoUnlock&) = delete;
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
mozilla::RecursiveMutex* mRecursiveMutex;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

Просмотреть файл

@ -192,7 +192,7 @@ class MOZ_STACK_CLASS ReentrantMonitorAutoEnter {
ReentrantMonitorAutoEnter();
ReentrantMonitorAutoEnter(const ReentrantMonitorAutoEnter&);
ReentrantMonitorAutoEnter& operator=(const ReentrantMonitorAutoEnter&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
friend class ReentrantMonitorAutoExit;
@ -238,7 +238,7 @@ class MOZ_STACK_CLASS ReentrantMonitorAutoExit {
ReentrantMonitorAutoExit();
ReentrantMonitorAutoExit(const ReentrantMonitorAutoExit&);
ReentrantMonitorAutoExit& operator=(const ReentrantMonitorAutoExit&);
static void* operator new(size_t) CPP_THROW_NEW;
static void* operator new(size_t) noexcept(true);
ReentrantMonitor* mReentrantMonitor;
};

Просмотреть файл

@ -151,7 +151,7 @@ class nsTimerEvent final : public CancelableRunnable {
static void Shutdown();
static void DeleteAllocatorIfNeeded();
static void* operator new(size_t aSize) CPP_THROW_NEW {
static void* operator new(size_t aSize) noexcept(true) {
return sAllocator->Alloc(aSize);
}
void operator delete(void* aPtr) {

Просмотреть файл

@ -7,11 +7,6 @@
#ifndef _XPCOM_CONFIG_H_
#define _XPCOM_CONFIG_H_
/* Define this to throw() if the compiler complains about
* constructors returning NULL
*/
#undef CPP_THROW_NEW
/* Define to a string describing the XPCOM ABI in use */
#undef TARGET_XPCOM_ABI