[U-Boot] [PATCH] Change dead code in "test" cmd to debug output

Joe Hershberger joe.hershberger at gmail.com
Wed Oct 3 22:46:49 CEST 2012


Hi Mike,

On Fri, Aug 17, 2012 at 6:41 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Friday 17 August 2012 16:56:12 Joe Hershberger wrote:
>> --- a/common/cmd_test.c
>> +++ b/common/cmd_test.c
>>
>> -#if 0
>> +#ifdef DEBUG
>>       {
>> -             printf("test:");
>> +             debug("test(%d):", argc);
>>               left = 1;
>>               while (argv[left])
>> -                     printf(" %s", argv[left++]);
>> +                     debug(" '%s'", argv[left++]);
>>       }
>>  #endif
>
> i think you can even remove the #ifdef DEBUG here since debug() will expand to
> nothing, and gcc should do DCE on the whole block

It looks to me like it would end up with:

>>               while (argv[left]);

which would be an infinite loop, no?

The only reason I changed the printf's to debug is so that the macro
is used consistently and changes to it (like fprintf(stderr, ...) )
would have the intended effect.

Thanks,
-Joe


More information about the U-Boot mailing list