This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Cast to int32 first when casting pointer to int64
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Roland McGrath <roland at hack dot frob dot com>, GNU C Library<libc-alpha at sourceware dot org>
- Date: Wed, 21 Nov 2012 23:13:09 +0000
- Subject: Re: PATCH: Cast to int32 first when casting pointer to int64
- References: <CAMe9rOpOdaJhN0U_8xUOyGG0JHeO7k9626=v5hdzgxBroLxkOw@mail.gmail.com>
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