diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-27 11:30:45 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-27 11:30:45 +0000 |
commit | 8392079c544c1f4faf4ad703fa0e76363ca72db9 (patch) | |
tree | 58ba013a9b87b4bd75ae3ce8cb88b1c49daaaa8d /base/allocator | |
parent | 8d88980ec2b828bddafcfda2e6b7e4cadb91da9f (diff) | |
download | chromium_src-8392079c544c1f4faf4ad703fa0e76363ca72db9.zip chromium_src-8392079c544c1f4faf4ad703fa0e76363ca72db9.tar.gz chromium_src-8392079c544c1f4faf4ad703fa0e76363ca72db9.tar.bz2 |
clang/win: Fix a few warnings.
__THROW is not some magical thing, don't pretend it is. Don't add it to
extern "C" functions. Replace it with "throw ()" on the functions where it's
correct since it was defined to nothing on windows (the only place where this
file is used).
Fix an inconsequential enum constant mix-up in media (both enum constants
evaluated to the same value, and the enums had the same size, so it shouldn't
make a difference in practice, but the old code was comparing enum variables
with enum constants from a different enum).
BUG=82385
TBR=dalecurtis
Review URL: https://codereview.chromium.org/419323002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/allocator')
-rw-r--r-- | base/allocator/allocator_shim.cc | 15 | ||||
-rw-r--r-- | base/allocator/generic_allocators.cc | 12 |
2 files changed, 10 insertions, 17 deletions
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc index c0de36e..961cda4 100644 --- a/base/allocator/allocator_shim.cc +++ b/base/allocator/allocator_shim.cc @@ -16,13 +16,6 @@ // TODO(mbelshe): Ensure that all calls to tcmalloc have the proper call depth // from the "user code" so that debugging tools (HeapChecker) can work. -// __THROW is defined in glibc systems. It means, counter-intuitively, -// "This function will never throw an exception." It's an optional -// optimization tool, but we may need to use it to match glibc prototypes. -#ifndef __THROW // I guess we're not on a glibc system -# define __THROW // __THROW is just an optimization, so ok to make it "" -#endif - // new_mode 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, @@ -102,7 +95,7 @@ inline bool call_new_handler(bool nothrow) { } extern "C" { -void* malloc(size_t size) __THROW { +void* malloc(size_t size) { void* ptr; for (;;) { switch (allocator) { @@ -124,7 +117,7 @@ void* malloc(size_t size) __THROW { return ptr; } -void free(void* p) __THROW { +void free(void* p) { switch (allocator) { case WINHEAP: case WINLFH: @@ -136,7 +129,7 @@ void free(void* p) __THROW { } } -void* realloc(void* ptr, size_t size) __THROW { +void* realloc(void* ptr, size_t size) { // Webkit is brittle for allocators that return NULL for malloc(0). The // realloc(0, 0) code path does not guarantee a non-NULL return, so be sure // to call malloc for this case. @@ -168,7 +161,7 @@ void* realloc(void* ptr, size_t size) __THROW { } // TODO(mbelshe): Implement this for other allocators. -void malloc_stats(void) __THROW { +void malloc_stats(void) { switch (allocator) { case WINHEAP: case WINLFH: diff --git a/base/allocator/generic_allocators.cc b/base/allocator/generic_allocators.cc index d4cf19e..5b5f379 100644 --- a/base/allocator/generic_allocators.cc +++ b/base/allocator/generic_allocators.cc @@ -28,7 +28,7 @@ void* __cdecl operator new(size_t size) { return generic_cpp_alloc(size, false); } -void operator delete(void* p) __THROW { +void operator delete(void* p) throw() { free(p); } @@ -36,15 +36,15 @@ void* operator new[](size_t size) { return generic_cpp_alloc(size, false); } -void operator delete[](void* p) __THROW { +void operator delete[](void* p) throw() { 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) throw() { return generic_cpp_alloc(size, true); } -void* operator new[](size_t size, const std::nothrow_t& nt) __THROW { +void* operator new[](size_t size, const std::nothrow_t& nt) throw() { return generic_cpp_alloc(size, true); } @@ -53,7 +53,7 @@ void* operator new[](size_t size, const std::nothrow_t& nt) __THROW { // If flag is 1, calls to malloc will behave like calls to new, // and the std_new_handler will be invoked on failure. // Returns the previous mode. -int _set_new_mode(int flag) __THROW { +int _set_new_mode(int flag) throw() { int old_mode = new_mode; new_mode = flag; return old_mode; @@ -63,7 +63,7 @@ int _set_new_mode(int flag) __THROW { extern "C" { -void* calloc(size_t n, size_t elem_size) __THROW { +void* calloc(size_t n, size_t elem_size) { // Overflow check const size_t size = n * elem_size; if (elem_size != 0 && size / elem_size != n) return NULL; |