This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Cast to int32 first when casting pointer to int64


On Wed, 21 Nov 2012, H.J. Lu wrote:

> +/* The real type for T, where P is 1 if T is a pointer.  */
> +#define __real_type_sub(T, P) \
> +  __typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
> +		  : (__typeof__ (0 ? (__intptr_t *) 0 : (void *) (!(P)))) 0))
> +
> +/* The real type for EXPR.  */
> +#define __real_type(expr) \
> +  __real_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
> +		  __pointer_type (__typeof__ (expr)))

Referring to "real type" is hardly appropriate here; the point in tgmath.h 
is distinguishing real and complex types and referring to the standard 
rules for how tgmath.h determines a common real type.  I think you mean 
something like "intptr_t if P is true, or T if P is false" and then 
"intptr_t if EXPR has a pointer type, or the type of EXPR otherwise".

I don't think you need the x86_64 changes (I haven't seen such warnings 
there).  I'd have expected a smaller local patch in i386/tls.h, not 
changing common code at all.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]