For the benefit of G++'s null pointer constant implementation, #define NULL

as __null with egcs 1.0 (GCC 2.90) and above.  As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
This commit is contained in:
kleink 1999-12-22 21:26:15 +00:00
parent 7ec3575193
commit c07f17e8d9
12 changed files with 39 additions and 44 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.79 1999/09/13 18:38:04 kleink Exp $
# $NetBSD: Makefile,v 1.80 1999/12/22 21:26:16 kleink Exp $
# @(#)Makefile 8.2 (Berkeley) 1/4/94
SRCTOP= ..
@ -13,10 +13,11 @@ INCS= a.out.h ar.h assert.h bitstring.h bm.h cpio.h ctype.h db.h dirent.h \
glob.h grp.h hesiod.h ieeefp.h iso646.h kvm.h langinfo.h libgen.h \
limits.h link.h link_aout.h link_elf.h locale.h malloc.h math.h md4.h \
memory.h mpool.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h \
nsswitch.h paths.h pwd.h ranlib.h re_comp.h regex.h regexp.h resolv.h \
rmt.h search.h setjmp.h sgtty.h signal.h stab.h stddef.h stdio.h \
stdlib.h string.h strings.h stringlist.h struct.h sysexits.h tar.h \
time.h ttyent.h tzfile.h ulimit.h unistd.h util.h utime.h utmp.h vis.h
nsswitch.h null.h paths.h pwd.h ranlib.h re_comp.h regex.h regexp.h \
resolv.h rmt.h search.h setjmp.h sgtty.h signal.h stab.h stddef.h \
stdio.h stdlib.h string.h strings.h stringlist.h struct.h sysexits.h \
tar.h time.h ttyent.h tzfile.h ulimit.h unistd.h util.h utime.h \
utmp.h vis.h
INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/telnet.h arpa/tftp.h
INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
protocols/talkd.h protocols/timed.h

View File

@ -1,4 +1,4 @@
/* $NetBSD: dirent.h,v 1.14 1998/05/06 19:05:51 kleink Exp $ */
/* $NetBSD: dirent.h,v 1.15 1999/12/22 21:26:17 kleink Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -78,9 +78,7 @@ typedef struct _dirdesc {
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
#define __DTF_READALL 0x0008 /* everything has been read */
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE */

View File

@ -1,4 +1,4 @@
/* $NetBSD: locale.h,v 1.7 1998/02/02 21:07:29 perry Exp $ */
/* $NetBSD: locale.h,v 1.8 1999/12/22 21:26:17 kleink Exp $ */
/*
* Copyright (c) 1991, 1993
@ -59,9 +59,7 @@ struct lconv {
char n_sign_posn;
};
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#define LC_ALL 0
#define LC_COLLATE 1

9
include/null.h Normal file
View File

@ -0,0 +1,9 @@
/* $NetBSD: null.h,v 1.1 1999/12/22 21:26:17 kleink Exp $ */
#ifndef NULL
#if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 90)
#define NULL 0
#else
#define NULL __null
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: stddef.h,v 1.5 1998/02/02 17:13:49 perry Exp $ */
/* $NetBSD: stddef.h,v 1.6 1999/12/22 21:26:18 kleink Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -52,9 +52,7 @@ typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#define offsetof(type, member) ((size_t)(&((type *)0)->member))

View File

@ -1,4 +1,4 @@
/* $NetBSD: stdio.h,v 1.30 1998/11/20 14:39:38 kleink Exp $ */
/* $NetBSD: stdio.h,v 1.31 1999/12/22 21:26:18 kleink Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -54,9 +54,7 @@ typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
/*
* This is fairly grotesque, but pure ANSI code must not inspect the

View File

@ -1,4 +1,4 @@
/* $NetBSD: stdlib.h,v 1.42 1999/02/06 15:04:05 kleink Exp $ */
/* $NetBSD: stdlib.h,v 1.43 1999/12/22 21:26:19 kleink Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -77,9 +77,7 @@ typedef struct {
#endif
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: string.h,v 1.20 1999/09/09 09:30:40 kleink Exp $ */
/* $NetBSD: string.h,v 1.21 1999/12/22 21:26:19 kleink Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -44,9 +44,7 @@ typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#include <sys/cdefs.h>
#include <sys/featuretest.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: strings.h,v 1.6 1998/05/06 17:12:45 kleink Exp $ */
/* $NetBSD: strings.h,v 1.7 1999/12/22 21:26:19 kleink Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -48,9 +48,7 @@ typedef _BSD_SIZE_T_ size_t;
#endif
#ifndef _XOPEN_SOURCE
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#endif
#include <sys/cdefs.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: time.h,v 1.22 1998/09/15 12:24:28 kleink Exp $ */
/* $NetBSD: time.h,v 1.23 1999/12/22 21:26:20 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -48,9 +48,7 @@
#include <machine/ansi.h>
#include <machine/limits.h> /* Include file containing CLK_TCK. */
#ifndef NULL
#define NULL 0
#endif
#include <null.h>
#ifdef _BSD_CLOCK_T_
typedef _BSD_CLOCK_T_ clock_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: unistd.h,v 1.78 1999/12/02 13:15:55 kleink Exp $ */
/* $NetBSD: unistd.h,v 1.79 1999/12/22 21:26:20 kleink Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -88,9 +88,7 @@
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#include <null.h>
__BEGIN_DECLS
__dead void _exit __P((int)) __attribute__((__noreturn__));

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.78 1999/12/04 21:13:19 ragge Exp $ */
/* $NetBSD: param.h,v 1.79 1999/12/22 21:26:15 kleink Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -81,12 +81,15 @@
#define NetBSD 199905 /* NetBSD version (year & month). */
#ifdef _KERNEL
#ifndef NULL
#define NULL 0
#endif
#endif /* NULL */
#else
#include <null.h>
#endif /* _KERNEL */
#ifndef _LOCORE
#include <sys/inttypes.h>
#include <sys/types.h>
#endif