From: Amos Jeffries Date: Wed, 27 May 2015 23:25:58 +0000 (-0700) Subject: Portability: Define nullptr if not provided X-Git-Tag: SQUID_3_5_5~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=81669deaba8270cef5ddfd84d1e2fe1a3bbcdbb0;p=thirdparty%2Fsquid.git Portability: Define nullptr if not provided For use building with non-C++11 compilers, or broken stdlib definitions. In the absence of nullptr we define it to be a synonym for NULL. Also, remove the old hack defining NULL in terms of nullptr. It has never worked properly and C++11 compilers define NULL explicitly. --- diff --git a/acinclude/ax_cxx_0x_types.m4 b/acinclude/ax_cxx_0x_types.m4 index 7439f3a6e0..2657b3f79e 100644 --- a/acinclude/ax_cxx_0x_types.m4 +++ b/acinclude/ax_cxx_0x_types.m4 @@ -17,8 +17,8 @@ AC_DEFUN([AX_CXX_TYPE_NULLPTR],[ AC_MSG_RESULT(yes)], [ HAVE_NULLPTR=no AC_MSG_RESULT(no)]) - if test "x$HAVE_NULLPTR" = xyes; then - AC_DEFINE(HAVE_NULLPTR, 1, [Define to 1 if nullptr is supported]) + if test "x$HAVE_NULLPTR" = xno; then + AC_DEFINE(nullptr, NULL, [Leave undefined if nullptr is supported]) fi AC_MSG_CHECKING([whether nullptr_t is supported]) AC_TRY_COMPILE([#include ],[typedef nullptr_t peng;], [ diff --git a/compat/types.h b/compat/types.h index 50211aa310..6de19f5e94 100644 --- a/compat/types.h +++ b/compat/types.h @@ -157,12 +157,8 @@ typedef long mtyp_t; #endif #ifndef NULL -#if defined(__cplusplus) && HAVE_NULLPTR -#define NULL nullptr -#else #define NULL 0 #endif -#endif #endif /* SQUID_TYPES_H */