[RFC] trying to kill a warning in hpread.c (from call to complaint)

Daniel Jacobowitz drow@mvista.com
Fri Jan 10 14:34:00 GMT 2003


On Fri, Jan 10, 2003 at 06:26:39PM +0400, Joel Brobecker wrote:
> Hello,
> 
> I see the following warnings when compiling hpread.c:
> 
>         hpread.c:1920: warning: int format, pointer arg (arg 3)
>         hpread.c:2025: warning: int format, pointer arg (arg 3)
>         hpread.c:2051: warning: int format, pointer arg (arg 3)
>         hpread.c:2072: warning: int format, pointer arg (arg 3)
>         hpread.c:2146: warning: int format, pointer arg (arg 3)
>         hpread.c:2230: warning: int format, pointer arg (arg 3)
> 
> These warnings point to the following macro:
> 
> #define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
>   if (! hpread_has_name ((SYM)->dblock.kind)) \
>     *NAMEP = ""; \
>   else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
>     { \
>       complaint (&symfile_complaints, "bad string table offset in symbol %d", \
>                  (char *) symnum); \
>       *NAMEP = ""; \
>     } \
>   else \
>     *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
> 
> I think that the warning comes from the call to complaint where the
> format string contains "%d", but the next parameter is casted to a
> "char *".
> 
> Is the cast to "char *" necessary? Can/Should I remove it?

Looks like a typo in Kevin's complaint patch.  I'd say yes; and in the
calls to lbrac_unmatched_complaint, too.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb-patches mailing list