This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: two questions about GDB coding standards
- From: Wu Zhou <woodzltc at cn dot ibm dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 18 May 2005 06:24:41 -0400
- Subject: Re: two questions about GDB coding standards
Quoting Mark Kettenis <mark.kettenis@xs4all.nl>:
> The usage of sprintf is mainly historic, and a bad example that
> shouldn't be followed. Patches to get rid of it are welcome, and
> mostly obvious ;-). Whether xasprintf is the right replacement,
> depends on the context. In some cases the usage of xsnprintf might be
> more appropriate. The later is a version of snprintf that checks
> whether the generated string fits in the buffer.
Where can I find any document about xasprintf or xsnprintf? I can find
xasprintf's definition in the source tree of libiberty, but didn't find
any definition for xsnprintf. Where is it defined then?
> As configure.ac says, -Wunused-variable is up for debate. Looks like
> you just started that debate ;-). But before we enable it someone
> will have to do the dirty work of finding most of the unused
> variables, such that compiling with -Werror keeps being possible.
> Elimination of unused variables is defenitely obvious, but watch out
> for tricky #ifdef's.
Sorry I didn't notice that this is mentioned in configure.ac. And my
intention was also not to start debate. But I _do_ think that removing
these unused variables might be achievable. My initial idea is to use
static analysis tool to detect unused variables first. Then double check
to eliminate these false negatives. and then use a script to remove the
definition automatically. What is your thought on this? Please review
and comment. Thanks.
Cheers
- Wu Zhou