From 72794f8ff1c1e79bd0350bb52fb3757bdf04d004 Mon Sep 17 00:00:00 2001 From: balr0g Date: Sun, 7 Jun 2015 10:20:43 -0400 Subject: Use attribute unused for inlined new/delete. (nw) This is still not compliant code, and will probably break with LTO, but is a cleaner fix for the warning. Using this attribute also ensures that the linker doesn't remove the code. --- src/lib/util/corealloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/util/corealloc.h') diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h index 5b002557769..a3f05ddd270 100644 --- a/src/lib/util/corealloc.h +++ b/src/lib/util/corealloc.h @@ -60,10 +60,10 @@ class zeromem_t { }; #ifndef NO_MEM_TRACKING // standard new/delete operators (try to avoid using) -ATTR_FORCE_INLINE inline void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, false, true, false); } -ATTR_FORCE_INLINE inline void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, true, true, false); } -ATTR_FORCE_INLINE inline void operator delete(void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); } -ATTR_FORCE_INLINE inline void operator delete[](void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); } +ATTR_FORCE_INLINE ATTR_USED inline void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, false, true, false); } +ATTR_FORCE_INLINE ATTR_USED inline void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, true, true, false); } +ATTR_FORCE_INLINE ATTR_USED inline void operator delete(void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); } +ATTR_FORCE_INLINE ATTR_USED inline void operator delete[](void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); } #endif -- cgit v1.2.3-70-g09d2