This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: Is there a HOST_BITS_PER_POINTER macro?


 > 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.


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