This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ Patch: possible bug pointed out by non-literal format warning
- To: rth at cygnus dot com
- Subject: Re: C++ Patch: possible bug pointed out by non-literal format warning
- From: Alan Modra <alan at SPRI dot Levels dot UniSA dot Edu dot Au>
- Date: Tue, 1 Feb 2000 00:55:55 +1030 (CST)
- cc: gcc-patches at gcc dot gnu dot org, jason at cygnus dot com, mark at codesourcery dot com
On Thu, 27 Jan 2000 13:55:22 -0800, Richard Henderson wrote:
> On Thu, Jan 27, 2000 at 03:30:47PM -0500, Kaveh R. Ghazi wrote:
> > - if (!format[0])
> > - sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4);
>
> Perhaps more of the same hackery?
>
> sprintf (format, "%s%%0%d%s", HOST_WIDE_INT_PRINT_HEX,
> HOST_BITS_PER_WIDE_INT / 4,
> strchr (HOST_WIDE_INT_PRINT_HEX, '%')+1);
Not quite right for c4x. You'll get an extra `h'
config/c4x/c4x.h:# define HOST_WIDE_INT_PRINT_HEX "0%xh"
config/c4x/c4x.h:# define HOST_WIDE_INT_PRINT_HEX "0%lxh"
config/c4x/c4x.h:# define HOST_WIDE_INT_PRINT_HEX "0%llxh"