mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
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.
This commit is contained in:
parent
05a79d2e20
commit
72794f8ff1
@ -923,7 +923,6 @@ end
|
||||
end
|
||||
if (version >= 30400) then
|
||||
buildoptions {
|
||||
"-Wno-inline-new-delete",
|
||||
"-Wno-constant-logical-operand",
|
||||
}
|
||||
end
|
||||
|
@ -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
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
/* Some optimizations/warnings cleanups for GCC */
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define ATTR_UNUSED __attribute__((__unused__))
|
||||
#define ATTR_USED __attribute__((__used__))
|
||||
#define ATTR_NORETURN __attribute__((noreturn))
|
||||
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
|
||||
#define ATTR_MALLOC __attribute__((malloc))
|
||||
|
Loading…
Reference in New Issue
Block a user