OLD | NEW |
---|---|
1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 #ifndef __THROW // I guess we're not on a glibc-like system | 46 #ifndef __THROW // I guess we're not on a glibc-like system |
47 # define __THROW // __THROW is just an optimization, so ok to make it "" | 47 # define __THROW // __THROW is just an optimization, so ok to make it "" |
48 #endif | 48 #endif |
49 | 49 |
50 #ifndef __GNUC__ | 50 #ifndef __GNUC__ |
51 # error libc_override_gcc_and_weak.h is for gcc distributions only. | 51 # error libc_override_gcc_and_weak.h is for gcc distributions only. |
52 #endif | 52 #endif |
53 | 53 |
54 #define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn))) | 54 #define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn))) |
55 | 55 |
56 void* operator new(size_t size) throw (std::bad_alloc) | 56 // Bionic throws an exception, but there's no std::bad_alloc. |
57 void* operator new(size_t size) throw (/* std::bad_alloc */) | |
Dai Mikurube (NOT FULLTIME)
2013/05/08 14:53:25
How about simply using #ifdef instead of a new fil
bulach
2013/05/08 16:09:10
good idea! I originally thought we'd have more dif
| |
57 ALIAS(tc_new); | 58 ALIAS(tc_new); |
58 void operator delete(void* p) __THROW | 59 void operator delete(void* p) __THROW |
59 ALIAS(tc_delete); | 60 ALIAS(tc_delete); |
60 void* operator new[](size_t size) throw (std::bad_alloc) | 61 void* operator new[](size_t size) throw (/* std::bad_alloc */) |
61 ALIAS(tc_newarray); | 62 ALIAS(tc_newarray); |
62 void operator delete[](void* p) __THROW | 63 void operator delete[](void* p) __THROW |
63 ALIAS(tc_deletearray); | 64 ALIAS(tc_deletearray); |
64 void* operator new(size_t size, const std::nothrow_t& nt) __THROW | 65 void* operator new(size_t size, const std::nothrow_t& nt) __THROW |
65 ALIAS(tc_new_nothrow); | 66 ALIAS(tc_new_nothrow); |
66 void* operator new[](size_t size, const std::nothrow_t& nt) __THROW | 67 void* operator new[](size_t size, const std::nothrow_t& nt) __THROW |
67 ALIAS(tc_newarray_nothrow); | 68 ALIAS(tc_newarray_nothrow); |
68 void operator delete(void* p, const std::nothrow_t& nt) __THROW | 69 void operator delete(void* p, const std::nothrow_t& nt) __THROW |
69 ALIAS(tc_delete_nothrow); | 70 ALIAS(tc_delete_nothrow); |
70 void operator delete[](void* p, const std::nothrow_t& nt) __THROW | 71 void operator delete[](void* p, const std::nothrow_t& nt) __THROW |
(...skipping 19 matching lines...) Expand all Loading... | |
90 size_t malloc_usable_size(void* p) __THROW ALIAS(tc_malloc_size); | 91 size_t malloc_usable_size(void* p) __THROW ALIAS(tc_malloc_size); |
91 } // extern "C" | 92 } // extern "C" |
92 | 93 |
93 #undef ALIAS | 94 #undef ALIAS |
94 | 95 |
95 // No need to do anything at tcmalloc-registration time: we do it all | 96 // No need to do anything at tcmalloc-registration time: we do it all |
96 // via overriding weak symbols (at link time). | 97 // via overriding weak symbols (at link time). |
97 static void ReplaceSystemAlloc() { } | 98 static void ReplaceSystemAlloc() { } |
98 | 99 |
99 #endif // TCMALLOC_LIBC_OVERRIDE_GCC_AND_WEAK_INL_H_ | 100 #endif // TCMALLOC_LIBC_OVERRIDE_GCC_AND_WEAK_INL_H_ |
OLD | NEW |