]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: Define nullptr if not provided
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 23 May 2015 12:24:21 +0000 (05:24 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 23 May 2015 12:24:21 +0000 (05:24 -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, removethe 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 f3ff94af559fbd6286b60d09bbce6c0a4363fbf3..5898a7f40049772f6abe6b483cebb2244076d4e5 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 */