Change dead code in "test" cmd to debug output
PATCH 1/1 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
--- common/cmd_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/cmd_test.c +3 -3
@@ -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
Signature · 1 line
1.7.11.5
PATCH 1/1 Change dead code in "test" cmd to debug output
Quoted 4 lines · On Friday 17 August 2012 16:56:12 Joe Hershberger wrote:
common/cmd_test.c +0
-1-#if 0
common/cmd_test.c int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 43
Quoted 10 lines
common/cmd_test.c +3
-2+#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>
PATCH 1/1 Change dead code in "test" cmd to debug output
Hi Mike,
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Friday 17 August 2012 16:56:12 Joe Hershberger wrote:
common/cmd_test.c +0
-0
Quoted 14 lines
common/cmd_test.c int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 43
Quoted 11 lines
common/cmd_test.c +3
-3-#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:
Quoted 1 line
Quoted 1 line
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
Quoted 4 lines · Joe Hershberger
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>