summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorAndrey Semashev <andrey.semashev@gmail.com>2017-09-30 17:47:35 +0300
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2017-11-29 19:51:42 +0000
commit7efb3ecf37d88edf9cf9a43efb89b425eaf81d5e (patch)
tree50f2df3fb387e41c09de0852365589faee918a46 /Makefile.am
parent7a6e25f3b143c35ed6fff8bb2c0f8de1ab348a39 (diff)
downloadgperftools-7efb3ecf37d88edf9cf9a43efb89b425eaf81d5e.tar.gz
Add support for C++17 operator new/delete for overaligned types.
- Add auto-detection of std::align_val_t presence to configure scripts. This indicates that the compiler supports C++17 operator new/delete overloads for overaligned types. - Add auto-detection of -faligned-new compiler option that appeared in gcc 7. The option allows the compiler to generate calls to the new operators. It is needed for tests. - Added overrides for the new operators. The overrides are enabled if the support for std::align_val_t has been detected. The implementation is mostly based on the infrastructure used by memalign, which had to be extended to support being used by C++ operators in addition to C functions. In particular, the debug version of the library has to distinguish memory allocated by memalign from that by operator new. The current implementation of sized overaligned delete operators do not make use of the supplied size argument except for the debug allocator because it is difficult to calculate the exact allocation size that was used to allocate memory with alignment. This can be done in the future. - Removed forward declaration of std::nothrow_t. This was not portable as the standard library is not required to provide nothrow_t directly in namespace std (it could use e.g. an inline namespace within std). The <new> header needs to be included for std::align_val_t anyway. - Fixed operator delete[] implementation in libc_override_redefine.h. - Moved TC_ALIAS definition to the beginning of the file in tcmalloc.cc so that the macro is defined before its first use in nallocx. - Added tests to verify the added operators. [alkondratenko@gmail.com: fixed couple minor warnings, and some whitespace change] [alkondratenko@gmail.com: removed addition of TC_ALIAS in debug allocator] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Diffstat (limited to 'Makefile.am')
-rwxr-xr-xMakefile.am3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index a7f1a81..98cd147 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,9 @@ endif HAVE_W_NO_UNUSED_RESULT
if HAVE_SIZED_DEALLOCATION
AM_CXXFLAGS += -fsized-deallocation
endif HAVE_SIZED_DEALLOCATION
+if HAVE_F_ALIGNED_NEW
+AM_CXXFLAGS += -faligned-new
+endif HAVE_F_ALIGNED_NEW
# The -no-undefined flag allows libtool to generate shared libraries for
# Cygwin and MinGW. LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug.