xref: /netbsd-src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_placement_new.h (revision 04028aa9310ca9c619eca5cf58ddf1e58624d1d7)
1 //===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is shared between AddressSanitizer and ThreadSanitizer
9 // run-time libraries.
10 //
11 // The file provides 'placement new'.
12 // Do not include it into header files, only into source files.
13 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_PLACEMENT_NEW_H
15 #define SANITIZER_PLACEMENT_NEW_H
16 
17 #include "sanitizer_internal_defs.h"
18 #include <cstddef>
19 
20 namespace __sanitizer {
21 #if (SANITIZER_WORDSIZE == 64) || defined(__APPLE__)
22 typedef uptr operator_new_ptr_type;
23 #else
24 typedef u32 operator_new_ptr_type;
25 #endif
26 }  // namespace __sanitizer
27 
28 inline void *operator new(std::size_t sz, void *p) {
29   return p;
30 }
31 
32 #endif  // SANITIZER_PLACEMENT_NEW_H
33