va-mips.h patch
Gavin Koch
gavin@cygnus.com
Fri Feb 13 10:58:00 GMT 1998
This is to avoid loosing when a pointer is wider than an int.
OK to push?
-gavin...
* ginclude/va-mips.h: Replace casts of pointers to int with
casts of pointers to __PTRDIFF_TYPE__.
Index: va-mips.h
===================================================================
*** va-mips.h 1997/10/26 09:09:12 1.14
--- va-mips.h 1998/02/13 00:47:39
***************
*** 200,206 ****
#define __va_next_addr(__AP, __type) \
(((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
! ? __AP = (char *) (((int) __AP + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP += __va_reg_size) - __va_reg_size \
--- 200,206 ----
#define __va_next_addr(__AP, __type) \
(((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
! ? __AP = (char *) (((__PTRDIFF_TYPE__) __AP + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP += __va_reg_size) - __va_reg_size \
***************
*** 240,247 ****
#ifdef __mips64
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
! ((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
! + __va_rounded_size (__type))))[-1]
#else
#define va_arg(__AP, __type) \
((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
--- 240,248 ----
#ifdef __mips64
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
! ((__type *) (void *) (__AP = (char *) \
! ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
! + __va_rounded_size (__type))))[-1]
#else
#define va_arg(__AP, __type) \
((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
***************
*** 255,270 ****
/* For big-endian machines. */
#define va_arg(__AP, __type) \
((__AP = (char *) ((__alignof__ (__type) > 4 \
! ? ((int)__AP + 8 - 1) & -8 \
! : ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#else
/* For little-endian machines. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
! ? ((int)__AP + 8 - 1) & -8 \
! : ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif
#endif
--- 256,271 ----
/* For big-endian machines. */
#define va_arg(__AP, __type) \
((__AP = (char *) ((__alignof__ (__type) > 4 \
! ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
! : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#else
/* For little-endian machines. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
! ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
! : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif
#endif
More information about the Gcc
mailing list