Mercurial > hg > xemacs-beta
diff src/lisp.h @ 5934:e2fae7783046 cygwin
lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 12 Dec 2015 19:08:46 +0000 |
parents | f5dfcf2323bc |
children | d5eb0914ca1f |
line wrap: on
line diff
--- a/src/lisp.h Thu Dec 10 17:55:59 2015 +0000 +++ b/src/lisp.h Sat Dec 12 19:08:46 2015 +0000 @@ -467,13 +467,17 @@ # define SIZEOF_EMACS_INT SIZEOF_VOID_P #endif +/* HST moved MOST_POSITIVE_FIXNUM_UNSIGNED here */ #ifndef EMACS_INT # if SIZEOF_EMACS_INT == SIZEOF_LONG # define EMACS_INT long +#define MOST_POSITIVE_FIXNUM_UNSIGNED ((1UL << (FIXNUM_VALBITS - 1)) -1UL) # elif SIZEOF_EMACS_INT == SIZEOF_INT # define EMACS_INT int +#define MOST_POSITIVE_FIXNUM_UNSIGNED ((1U << (FIXNUM_VALBITS - 1)) -1U) # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG # define EMACS_INT long long +#define MOST_POSITIVE_FIXNUM_UNSIGNED ((1ULL << (FIXNUM_VALBITS - 1)) -1ULL) # else # error Unable to determine suitable type for EMACS_INT # endif @@ -1149,7 +1153,7 @@ /* Counts of elements */ typedef EMACS_INT Elemcount; /* Hash codes */ -typedef unsigned long Hashcode; +typedef uintptr_t Hashcode; /* HST: protect wrt _WIN64 short longs */ /* Booleans */ typedef int Boolint; @@ -1385,7 +1389,7 @@ #define ALLOCA_FUNCALL_OK(size) ALLOCA (size) #endif -MODULE_API void *xemacs_c_alloca (unsigned int size) ATTRIBUTE_MALLOC; +MODULE_API void *xemacs_c_alloca (EMACS_UINT size) ATTRIBUTE_MALLOC; MODULE_API int record_unwind_protect_freeing (void *ptr); @@ -1682,7 +1686,6 @@ #define FIXNUM_VALBITS (BITS_PER_EMACS_INT - FIXNUM_GCBITS) #define VALBITS (BITS_PER_EMACS_INT - GCBITS) -#define MOST_POSITIVE_FIXNUM_UNSIGNED ((1UL << (FIXNUM_VALBITS - 1)) -1UL) #define MOST_POSITIVE_FIXNUM ((EMACS_INT) MOST_POSITIVE_FIXNUM_UNSIGNED) #define MOST_NEGATIVE_FIXNUM (-(MOST_POSITIVE_FIXNUM) - 1) /* WARNING: evaluates its arg twice. */ @@ -1747,7 +1750,7 @@ { EMACS_UINT p = (EMACS_UINT) ptr; - type_checking_assert ((p & 1) == 0); + type_checking_assert ((p & (EMACS_UINT)1) == 0); return make_fixnum (p >> 1); } @@ -3106,12 +3109,13 @@ character. */ #define CHAR_OR_CHAR_INTP(x) (CHARP (x) || CHAR_INTP (x)) +/* HST editted in the (int) to stop many warnings */ DECLARE_INLINE_HEADER ( Ichar XCHAR_OR_CHAR_INT (Lisp_Object obj) ) { - return CHARP (obj) ? XCHAR (obj) : XFIXNUM (obj); + return CHARP (obj) ? XCHAR (obj) : (int)XFIXNUM (obj); } /* Signal an error if CH is not a valid character or integer Lisp_Object. @@ -3843,7 +3847,7 @@ #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h)) #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i)) -#define LISP_HASH(obj) ((unsigned long) STORE_LISP_IN_VOID (obj)) +#define LISP_HASH(obj) ((Hashcode) STORE_LISP_IN_VOID (obj)) Hashcode memory_hash (const void *xv, Bytecount size); Hashcode internal_hash (Lisp_Object obj, int depth, Boolint equalp); Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth,