changeset 21911:abfa9d470305

lib: Redefine NULL only if HAVE_TYPE_CHECKS is set
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 07 Apr 2017 09:14:27 +0300
parents 0bcfd58922bd
children 7a87ed7c9f88
files src/lib/compat.h
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/compat.h	Fri Apr 07 09:11:53 2017 +0300
+++ b/src/lib/compat.h	Fri Apr 07 09:14:27 2017 +0300
@@ -17,8 +17,10 @@
 #endif
 
 /* We really want NULL to be a pointer, since we have various type-checks
-   that may result in compiler warnings/errors if it's not. */
-#ifndef __cplusplus
+   that may result in compiler warnings/errors if it's not. Do this only when
+   type checking is used - it's not otherwise needed and causes compiling
+   problems with e.g. Sun C compiler. */
+#ifdef HAVE_TYPE_CHECKS
 #  undef NULL
 #  define NULL ((void *)0)
 #endif