summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alkondratenko@gmail.com>2018-03-04 23:29:46 -0800
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2018-03-04 23:41:26 -0800
commitd7be9385609328a03c5cfe775473a7dc8e014fd3 (patch)
treec4f0a252c3c8ca1f5df8f43b02f85f0886cb8907 /configure.ac
parentf1d3fe4a21e339a3fd6e4592ee7444484a7b92dc (diff)
downloadgperftools-d7be9385609328a03c5cfe775473a7dc8e014fd3.tar.gz
implement more robust detection of sized delete support
As reported in issue #954, osx clang compiler is able to optimize our previous detection away while not really having runtime support for sized delete. So this time we use AC_LINK_IFELSE and more robust code to prevent compiler from optimizing away sized delete call. This should reliably catch "bad" compilers. Special thanks to Alexey Serbin for reporting the issue, suggesting a fix and verifying it. Fixes issue #954.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 5 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 24f298b..44e4e8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -364,16 +364,17 @@ AS_IF([test "x$enable_sized_delete" = xyes],
AC_MSG_NOTICE([Will build sized deallocation operators])],
[AS_IF([test "x$enable_dyn_sized_delete" = xyes],
[AC_MSG_NOTICE([Will build dynamically detected sized deallocation operators])],
- [AC_MSG_NOTICE([Will not build sized deallocation operators])])])
+ [AC_MSG_NOTICE([Will build sized deallocation operators that ignore size])])])
AC_CACHE_CHECK([if C++ compiler supports -fsized-deallocation],
[perftools_cv_sized_deallocation_result],
[AC_LANG_PUSH(C++)
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fsized-deallocation"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[#include <new>]],
- [[(::operator delete)(0, 256)]])],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <new>
+#include <stddef.h>]],
+ [[static void (* volatile ptr)(void *, size_t) = ::operator delete; (*ptr)(0, 256);]])],
perftools_cv_sized_deallocation_result=yes,
perftools_cv_sized_deallocation_result=no)
CXXFLAGS="$OLD_CXXFLAGS"