* [U-Boot] [PATCH] Change dead code in "test" cmd to debug output
@ 2012-08-17 20:56 Joe Hershberger
2012-08-17 23:41 ` Mike Frysinger
2012-10-04 1:19 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Joe Hershberger @ 2012-08-17 20:56 UTC (permalink / raw)
To: u-boot
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@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
@@ -33,12 +33,12 @@ 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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] Change dead code in "test" cmd to debug output
2012-08-17 20:56 [U-Boot] [PATCH] Change dead code in "test" cmd to debug output Joe Hershberger
@ 2012-08-17 23:41 ` Mike Frysinger
2012-10-03 20:46 ` Joe Hershberger
2012-10-04 1:19 ` [U-Boot] " Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2012-08-17 23:41 UTC (permalink / raw)
To: u-boot
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/a0549fde/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] Change dead code in "test" cmd to debug output
2012-08-17 23:41 ` Mike Frysinger
@ 2012-10-03 20:46 ` Joe Hershberger
0 siblings, 0 replies; 4+ messages in thread
From: Joe Hershberger @ 2012-10-03 20:46 UTC (permalink / raw)
To: u-boot
Hi Mike,
On Fri, Aug 17, 2012 at 6:41 PM, Mike Frysinger <vapier@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] Change dead code in "test" cmd to debug output
2012-08-17 20:56 [U-Boot] [PATCH] Change dead code in "test" cmd to debug output Joe Hershberger
2012-08-17 23:41 ` Mike Frysinger
@ 2012-10-04 1:19 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2012-10-04 1:19 UTC (permalink / raw)
To: u-boot
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@ni.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121003/4a436165/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-04 1:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 20:56 [U-Boot] [PATCH] Change dead code in "test" cmd to debug output Joe Hershberger
2012-08-17 23:41 ` Mike Frysinger
2012-10-03 20:46 ` Joe Hershberger
2012-10-04 1:19 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox