On Sun, Apr 24, 2011 at 7:42 PM, Joakim Tjernlund wrote:
> vapierfil...@gmail.com wrote on 2011/04/25 00:38:31:
>> On Sun, Apr 24, 2011 at 6:14 PM, Wolfgang Denk wrote:
>> > Joakim Tjernlund wrote:
>> >> --- a/examples/standalone/timer.c
>> >> +++ b/examples/standalone/timer.c
>> >> @@ -186,7 +186,7 @@ int timer (int argc, char * const argv[])
>> >>       /* clear all events */
>> >>       *hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF);
>> >>
>> >> -     printf (usage);
>> >> +     printf("%s", usage);
>> >
>> > I dislike this change.  Which warning does the old code produce for
>> > you?
>>
>> i imagine he is using one of those "security conscious" compilers that
>> warn when you try to printf with a dynamic argument as the format.  we
>
> Yes, if gcc 4.4.5 counst as "security conscious" :)

your distro probably enables some default warning flags from the vanilla one

>> 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.
-mike
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to