[U-Boot] [PATCH 2/3] Fix a few gcc warnings.

Scott Wood scottwood at freescale.com
Mon Apr 25 19:45:00 CEST 2011


On Mon, 25 Apr 2011 00:13:20 -0400
Mike Frysinger <vapier at gentoo.org> wrote:

> On Sun, Apr 24, 2011 at 7:42 PM, Joakim Tjernlund wrote:
> > vapierfilter at gmail.com wrote on 2011/04/25 00:38:31:
> >> probably want to disable this stuff for u-boot since it doesnt make
> >> much sense by adding -Wno-format-nonliteral and -Wno-format-security
> >> when the compiler supports it.
> >>
> >> as for this one particular change, it probably makes sense to change
> >> it to puts(usage) anyways since the usage string contains no format
> >> modifiers.  it'll be faster this way.  and the code should be written:
> >> static const char usage[] = "...";
> >>
> >> the current usage has useless overhead.
> >
> > Yes, but puts() adds an newline so you can't just replace the above printf
> > with puts()
> 
> no, it doesnt.  u-boot's put() doesnt act the same as the standard C library.
> 
> however, that doesnt change my original point ... we shouldnt be
> "fixing" things like this that have no relevance in the u-boot world.
> disable the warning flags in the build system.

Why encourage bad habits?  Are there any instances of this in U-Boot where
conversion to puts() wouldn't be an improvement, especially given the lack
of an automatic newline in U-Boot's version?

If we have an instance where we really want formatting on a dynamic string,
that's another matter.

-Scott



More information about the U-Boot mailing list