summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 20:04:19 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 20:04:19 +0000
commit01b7989495957549b0075d23776adb9aebc48714 (patch)
tree898ec9a998944f43c7eed9078466edfe4518f444 /base
parentab968173054760334164b0b4bed481bb0b963046 (diff)
downloadchromium_src-01b7989495957549b0075d23776adb9aebc48714.zip
chromium_src-01b7989495957549b0075d23776adb9aebc48714.tar.gz
chromium_src-01b7989495957549b0075d23776adb9aebc48714.tar.bz2
Follow-up for https://codereview.chromium.org/419323002/
operator delete apparently isn't throw() with msvs (at least in _HAS_EXCEPTIONS=0 builds like ours). This fixes the two remaining warnings in this file: ..\..\base\allocator/generic_allocators.cc(31,6) : warning(clang): function previously declared with an implicit exception specification redeclared with an explicit exception specification [-Wimplicit-exception-spec-mismatch] void operator delete(void* p) throw() { ^ E:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\bin\..\..\VC\include\new(52,16) : note(clang): previous declaration is here void __CRTDECL operator delete(void *) _THROW0(); ^ In file included from ..\..\base\allocator\allocator_shim.cc:334: ..\..\base\allocator/generic_allocators.cc(39,6) : warning(clang): function previously declared with an implicit exception specification redeclared with an explicit exception specification [-Wimplicit-exception-spec-mismatch] void operator delete[](void* p) throw() { ^ E:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\bin\..\..\VC\include\crtdbg.h(1054,16) : note(clang): previous declaration is here void __CRTDECL operator delete[](void *); ^ 2 warnings generated. There also wasn't a std::nothrow overload for delete, so add that for completeness while here. (For C++14, we might have to add sized overloads too at some point.) BUG=82385 NOTRY=true Review URL: https://codereview.chromium.org/447513002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/allocator/generic_allocators.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/base/allocator/generic_allocators.cc b/base/allocator/generic_allocators.cc
index 5b5f379..d12f3b9 100644
--- a/base/allocator/generic_allocators.cc
+++ b/base/allocator/generic_allocators.cc
@@ -24,11 +24,11 @@ inline void* generic_cpp_alloc(size_t size, bool nothrow) {
extern "C++" {
-void* __cdecl operator new(size_t size) {
+void* operator new(size_t size) {
return generic_cpp_alloc(size, false);
}
-void operator delete(void* p) throw() {
+void operator delete(void* p) {
free(p);
}
@@ -36,18 +36,26 @@ void* operator new[](size_t size) {
return generic_cpp_alloc(size, false);
}
-void operator delete[](void* p) throw() {
+void operator delete[](void* p) {
free(p);
}
-void* operator new(size_t size, const std::nothrow_t& nt) throw() {
+void* operator new(size_t size, const std::nothrow_t& nt) {
return generic_cpp_alloc(size, true);
}
-void* operator new[](size_t size, const std::nothrow_t& nt) throw() {
+void operator delete(void* p, const std::nothrow_t& nt) {
+ free(p);
+}
+
+void* operator new[](size_t size, const std::nothrow_t& nt) {
return generic_cpp_alloc(size, true);
}
+void operator delete[](void* p, const std::nothrow_t& nt) {
+ free(p);
+}
+
// This function behaves similarly to MSVC's _set_new_mode.
// If flag is 0 (default), calls to malloc will behave normally.
// If flag is 1, calls to malloc will behave like calls to new,