]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: Define nullptr if not provided
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 27 May 2015 23:25:58 +0000 (16:25 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 27 May 2015 23:25:58 +0000 (16:25 -0700)
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.

acinclude/ax_cxx_0x_types.m4
compat/types.h

index 7439f3a6e086305525e67d50ec84291d45f4b677..2657b3f79e4f1a22524fbb2dff769252efca2acc 100644 (file)
@@ -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 <cstddef>],[typedef nullptr_t peng;], [
index 50211aa31091e2d4c732cf1b3fa0527687482e61..6de19f5e94d98fae9fb705474b1a77a93a72a2f2 100644 (file)
@@ -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 */