This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is there a HOST_BITS_PER_POINTER macro?
- To: rth at cygnus dot com
- Subject: Re: Is there a HOST_BITS_PER_POINTER macro?
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 6 Feb 1998 11:48:08 -0500 (EST)
- Cc: egcs at cygnus dot com
> From: Richard Henderson <rth@dot.cygnus.com>
>
> On Thu, Feb 05, 1998 at 07:45:09PM -0500, Kaveh R. Ghazi wrote:
> > I get a warning from "-W -Wall" which complains about int format vs
> > pointer argument. Is there a way to define a macro in machmode.h
> > which can cast the pointer to the appropriately sized integer type?
>
> Ideally you would use "%p" everywhere, but to support bootstrapping,
> we should probably autoconf a test for that.
> r~
Good point. I guess it would have to be a runtime check of the
*printf functions in libc. How about using code like this?
> #include <stdio.h>
> main()
> {
> char foo[30];
> char * ptr = (char *) 0;
>
> sprintf(foo, "%p", ptr)
> exit (strcmp(foo, "0"));
> }
and then doing AC_DEFINE(HOST_PTR_PRINTF, "%p") if it passes?
(machmode.h won't define it if its already defined.)
If you think the test is sufficient, I'll whip up a patch.
--Kaveh
--
Kaveh R. Ghazi Project Manager / Custom Development
ghazi@caip.rutgers.edu ICon CMT Corp.