From 12eb46c8bb2bf8a79a8151f4bd96aa7ce5bfe63d Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sun, 7 Dec 2003 21:10:06 +0000 Subject: Change the definition of NULL on ia64 (for LP64 compilations) from an int constant to a long constant. This change improves consistency in the following two ways: 1. The first 8 arguments are always passed in registers on ia64, which by virtue of the generated code implicitly widens ints to longs and allows the use of an 32-bit integral type for 64-bit arguments. Subsequent arguments are passed onto the memory stack, which does not exhibit the same behaviour and consequently do not allow this. In practice this means that variadic functions taking pointers and given NULL (without cast) work as long as the NULL is passed in one of the first 8 arguments. A SIGSEGV is more likely the result if such would be done for stack-based arguments. This is due to the fact that the upper 4 bytes remain undefined. 2. All 64-bit platforms that FreeBSD supports, with the obvious exception of ia64, allow 32-bit integral types (specifically NULL) when 64-bit pointers are expected in variadic functions by way of how the compiler generates code. As such, code that works correctly (whether rightfully so or not) on any platform other than ia64, may fail on ia64. To more easily allow tweaking of the definition of NULL, this commit removes the 12 definitions in the various headers and puts it in a new header that can be included whenever NULL is to be made visible. This commit fixes GNOME, emacs, xemacs and a whole bunch of ports that I don't particularly care about at this time... --- include/locale.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/locale.h') diff --git a/include/locale.h b/include/locale.h index 2477db4a3af4..ba702140a4ec 100644 --- a/include/locale.h +++ b/include/locale.h @@ -37,6 +37,8 @@ #ifndef _LOCALE_H_ #define _LOCALE_H_ +#include + struct lconv { char *decimal_point; char *thousands_sep; @@ -64,10 +66,6 @@ struct lconv { char int_n_sign_posn; }; -#ifndef NULL -#define NULL 0 -#endif - #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE 2 -- cgit v1.2.3