From: Amos Jeffries Date: Sat, 23 May 2015 12:24:21 +0000 (-0700) Subject: Portability: Define nullptr if not provided X-Git-Tag: merge-candidate-3-v1~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e513d9f1dc52f3532c1bc00d4d018e3a4e71a3d7;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, removethe 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 f3ff94af55..5898a7f400 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 */