Joe Hershberger | 17 Aug 2012 22:56
Favicon

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

Improve debug output for test by indicating the number of parameters
and quoting the parameters to make it clear exactly what each contains

Signed-off-by: Joe Hershberger <joe.hershberger <at> ni.com>
---
 common/cmd_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/cmd_test.c b/common/cmd_test.c
index fcb5ef2..6da06b9 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
 <at>  <at>  -33,12 +33,12  <at>  <at>  int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 3)
 		return 1;

-#if 0
+#ifdef DEBUG
 	{
-		printf("test:");
+		debug("test(%d):", argc);
 		left = 1;
 		while (argv[left])
-			printf(" %s", argv[left++]);
+			debug(" '%s'", argv[left++]);
 	}
 #endif

--

-- 
1.7.11.5
(Continue reading)

Mike Frysinger | 18 Aug 2012 01:41
Picon
Favicon
Gravatar

Re: [PATCH] Change dead code in "test" cmd to debug output

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
-mike
_______________________________________________
U-Boot mailing list
U-Boot <at> lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Joe Hershberger | 3 Oct 2012 22:46
Picon

Re: [PATCH] Change dead code in "test" cmd to debug output

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, ...) )
(Continue reading)

Tom Rini | 4 Oct 2012 03:19
Picon
Favicon
Gravatar

Re: Change dead code in "test" cmd to debug output

On Fri, Aug 17, 2012 at 10:56:12AM -0000, Joe Hershberger wrote:

> Improve debug output for test by indicating the number of parameters
> and quoting the parameters to make it clear exactly what each contains
> 
> Signed-off-by: Joe Hershberger <joe.hershberger <at> ni.com>

Applied to u-boot/master, thanks!

--

-- 
Tom
_______________________________________________
U-Boot mailing list
U-Boot <at> lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Gmane