[U-Boot] [PATCH 2/3] Fix a few gcc warnings.
Mike Frysinger
vapier at gentoo.org
Mon Apr 25 19:53:50 CEST 2011
On Mon, Apr 25, 2011 at 13:45, Scott Wood wrote:
> On Mon, 25 Apr 2011 00:13:20 -0400 Mike Frysinger 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?
that wasnt what i was saying. my point is simply that changing
printf(foo); to printf("%s", foo); simply to satisfy a gcc warning is
wrong and unnecessarily bloats the compiled code. if you want to
change it from printf(foo) to puts(foo), that's fine by me (and is
actually what i suggested).
-mike
More information about the U-Boot
mailing list