Subject: pkg/14150: glib.h defines NULL the wrong way
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 10/03/2001 17:03:37
>Number:         14150
>Category:       pkg
>Synopsis:       glib.h defines NULL the wrong way
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 03 08:04:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Martin Husemann
>Release:        -current pkgsrc as of October 2
>Organization:
>Environment:
	
System: NetBSD night-porter.duskware.de 1.5Y NetBSD 1.5Y (PORTER) #0: Sun Sep 30 20:55:12 MEST 2001 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:

/usr/pkg/include/glib/glib-1.2/glib.h has the following code:

#ifndef NULL
#define NULL    ((void*) 0)
#endif

This is wrong and the new toolchain complains about it (in C++ this NULL
is not allowed as function pointer). If glib.h is included before sys/null.h
then sys/null.h will not define the correct version of NULL.

This happens for example with xbill when building gnome-games:
c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/X11R6/include -DNEED_GNOMESUPPORT_H -I/usr/X11R6/lib/gnome-libs/include -I/usr/pkg/include/glib/glib-1.2 -I/usr/pkg/lib/glib/include -I/usr/pkg/include -I/usr/X11R6/include/gtk-1.2 -DGNOMELOCALDIR=\""/usr/X11R6/share/local"\"  -I/usr/X11R6/include/gtk-1.2 -I/usr/pkg/include/glib/glib-1.2 -I/usr/pkg/lib/glib/include -I/usr/X11R6/include  -O2 -I/usr/pkg/include -pipe -I/usr/pkg/include -pipe -c MCursor.cc
MCursor.cc: In method `void MCursor::load(const char *, int)':
MCursor.cc:5: ANSI C++ forbids implicit conversion from `void *' in initialization
MCursor.cc:14: ANSI C++ forbids implicit conversion from `void *' in argument passing
MCursor.cc:23: ANSI C++ forbids implicit conversion from `void *' in argument passing

	
>How-To-Repeat:
Read the code.

>Fix:
Patch glib.h to include <sys/null.h> on NetBSD instead of defining it itself.
>Release-Note:
>Audit-Trail:
>Unformatted: