[Openocd-development] -Wshadow is now default

2010-06-16 Thread Øyvind Harboe
I've made -Wshadow default.

Lots of tiny fixes and, no, I haven't regression tested
them all.

(It's a bit of fantasy that something like this would be
tested before merged w/master branch...)

That said, most of the fixes were trivial and chances
are very slight that they should cause problems.

-Wshadow has caught a couple of nasty problems to
test for, especially correct handling of retval when
copying and pasting code...

-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] -Wshadow is now default

2010-06-16 Thread Michael Schwingen

Øyvind Harboe wrote:

I've made -Wshadow default.
  

Great!

cu
Michael

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] -Wshadow is now default

2010-06-16 Thread Xiaofan Chen
On Wed, Jun 16, 2010 at 3:07 PM, Øyvind Harboe  wrote:
> I've made -Wshadow default.
>
> Lots of tiny fixes and, no, I haven't regression tested
> them all.
>

Now it failed to be built under Cygwin.

make[5]: Entering directory `/home/mcuee/mcu/openocd/git/build/src/helper'
/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H
-I. -I../../../openocd/src/helper -I../..  -I../../../openocd/src -I../../src -D
PKGDATADIR=\"/usr/local/share/openocd\"   -g -O2 -Wall -Wstrict-prototypes -Wfor
mat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-a
lign -Wredundant-decls -Werror -MT libhelper_la-binarybuffer.lo -MD -MP -MF .dep
s/libhelper_la-binarybuffer.Tpo -c -o libhelper_la-binarybuffer.lo `test -f 'bin
arybuffer.c' || echo '../../../openocd/src/helper/'`binarybuffer.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../openocd/src/hel
per -I../.. -I../../../openocd/src -I../../src -DPKGDATADIR=\"/usr/local/share/o
penocd\" -g -O2 -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wn
o-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -M
T libhelper_la-binarybuffer.lo -MD -MP -MF .deps/libhelper_la-binarybuffer.Tpo -
c ../../../openocd/src/helper/binarybuffer.c -o libhelper_la-binarybuffer.o
In file included from ../../../openocd/src/helper/command.h:35,
 from ../../../openocd/src/helper/log.h:29,
 from ../../../openocd/src/helper/binarybuffer.c:27:
../../../openocd/src/helper/jim.h:812: warning: declaration of 'index' shadows a
 global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
../../../openocd/src/helper/jim.h:820: warning: declaration of 'index' shadows a
 global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
make[5]: *** [libhelper_la-binarybuffer.lo] Error 1

In file included from ../../../openocd/src/helper/jim.c:97:
../../../openocd/src/helper/jim.h:812: warning: declaration of 'index'
shadows a global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
../../../openocd/src/helper/jim.h:820: warning: declaration of 'index'
shadows a global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
../../../openocd/src/helper/jim.c: In function `Jim_LoadLibrary':
../../../openocd/src/helper/jim.c:7925: warning: declaration of
'interp' shadows a parameter
../../../openocd/src/helper/jim.c:7920: warning: shadowed declaration is here

In file included from ../../../openocd/src/helper/command.h:35,
 from ../../../openocd/src/target/arm.h:29,
 from ../../../openocd/src/target/etm.c:24:
../../../openocd/src/helper/jim.h:812: warning: declaration of 'index'
shadows a global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
../../../openocd/src/helper/jim.h:820: warning: declaration of 'index'
shadows a global declaration
/usr/include/string.h:56: warning: shadowed declaration is here
In file included from ../../../openocd/src/target/image.h:29,
 from ../../../openocd/src/target/etm.c:27:
../../../openocd/src/helper/fileio.h:58: warning: declaration of
'access' shadows a global declaration
/usr/include/sys/unistd.h:19: warning: shadowed declaration is here

In file included from ../../../openocd/src/target/mips32_pracc.h:26,
 from ../../../openocd/src/target/mips32.h:27,
 from ../../../openocd/src/target/mips32_pracc.c:77:
../../../openocd/src/target/mips_ejtag.h:140: warning: declaration of
'write' shadows a global declaration
/usr/include/sys/unistd.h:183: warning: shadowed declaration is here
In file included from ../../../openocd/src/target/mips32.h:27,
 from ../../../openocd/src/target/mips32_pracc.c:77:
../../../openocd/src/target/mips32_pracc.h:48: warning: declaration of
'write' shadows a global declaration
/usr/include/sys/unistd.h:183: warning: shadowed declaration is here

...

-- 
Xiaofan http://mcuee.blogspot.com
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] -Wshadow is now default

2010-06-16 Thread Øyvind Harboe
Are you running w/origin/master?



-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] -Wshadow is now default

2010-06-16 Thread Xiaofan Chen
On Wed, Jun 16, 2010 at 10:09 PM, Øyvind Harboe  wrote:
>
> Are you running w/origin/master?

Should be.

mc...@acerpc ~/mcu/openocd/git/openocd
$ git pull
Already up-to-date.

mc...@acerpc ~/mcu/openocd/git/openocd
$ git log

commit 814c2a8f9a41a6445f131ee35474dced4bbed210
Author: Øyvind Harboe 
Date:   Wed Jun 16 08:33:32 2010 +0200

   build: enable -Wshadow by default

   Signed-off-by: Øyvind Harboe 

commit 818120d4092be0d0a7cae50140dc339581cae7fc
Author: Øyvind Harboe 
Date:   Wed Jun 16 08:27:50 2010 +0200

   gdb: -Wshadow warning fixes

   Signed-off-by: Øyvind Harboe 
- Show quoted text -

-- 
Xiaofan http://mcuee.blogspot.com
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] [PATCH] don't print Jim stacktrace

2010-06-16 Thread Andreas Fritiofson
The stack trace provides no valuable information to the user for
interactive commands. If debug output isn't enabled, print the command
result as a regular error message instead of using Jim's stacktrace
feature. This has the added benefit that syntax errors are properly marked
as such in the log.

Signed-off-by: Andreas Fritiofson 
---
 src/helper/command.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/helper/command.c b/src/helper/command.c
index be262f2..54267fc 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -661,7 +661,11 @@ int command_run_line(struct command_context *context, char 
*line)
if (retval != ERROR_COMMAND_CLOSE_CONNECTION)
{
/* We do not print the connection closed error message 
*/
-   Jim_PrintErrorMessage(interp);
+   if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
+   Jim_PrintErrorMessage(interp);
+   } else {
+   LOG_ERROR("%s", 
Jim_GetString(Jim_GetResult(interp), NULL));
+   }
}
if (retval == ERROR_OK)
{
-- 
1.6.3.3

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] don't print Jim stacktrace

2010-06-16 Thread Øyvind Harboe
On Wed, Jun 16, 2010 at 11:40 PM, Andreas Fritiofson
 wrote:
>
> The stack trace provides no valuable information to the user for
> interactive commands.

What about nested proc's?

--
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] -Wshadow is now default

2010-06-16 Thread Xiaofan Chen
On Wed, Jun 16, 2010 at 10:55 PM, Øyvind Harboe  wrote:
> I don't know why these warnings didn't crop up when
> I built w/Linux.
>
> Could you submit a patch series to address them?
>

I will try but do not count me on fixing the codes.
I do not trust my own C proficiency...


-- 
Xiaofan http://mcuee.blogspot.com
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] don't print Jim stacktrace

2010-06-16 Thread Andreas Fritiofson
On Thu, Jun 17, 2010 at 12:30 AM, Øyvind Harboe  wrote:
> On Wed, Jun 16, 2010 at 11:40 PM, Andreas Fritiofson
>  wrote:
>>
>> The stack trace provides no valuable information to the user for
>> interactive commands.
>
> What about nested proc's?
>

You mean when calling user defined tcl procedures calling other tcl
procedures that fails?

My guess is the *user* doesn't particularly care about the chain of
events leading up to the fault. It's probably due to either misuse of
the first procedure, in which case the user is fully aware of what the
called procedure was, or a bug in one of the following. If it's a bug
it calls for debugging, a job for a *developer* (might of course be
the same person with another hat). The developer could flip the debug
level switch and see the stack trace as previously.

Then on the other hand I don't get a stack trace when a shell script
in multiple nesting levels fails, and I'm not very bothered about
that.

I think the current error messages do more harm than good in the
majority of cases. If there's a better solution I'm open to
suggestions.

/Andreas
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] don't print Jim stacktrace

2010-06-16 Thread Øyvind Harboe
On Thu, Jun 17, 2010 at 2:05 AM, Andreas Fritiofson
 wrote:
> On Thu, Jun 17, 2010 at 12:30 AM, Øyvind Harboe  
> wrote:
>> On Wed, Jun 16, 2010 at 11:40 PM, Andreas Fritiofson
>>  wrote:
>>>
>>> The stack trace provides no valuable information to the user for
>>> interactive commands.
>>
>> What about nested proc's?
>>
>
> You mean when calling user defined tcl procedures calling other tcl
> procedures that fails?
>
> My guess is the *user* doesn't particularly care about the chain of
> events leading up to the fault. It's probably due to either misuse of
> the first procedure, in which case the user is fully aware of what the
> called procedure was, or a bug in one of the following. If it's a bug
> it calls for debugging, a job for a *developer* (might of course be
> the same person with another hat). The developer could flip the debug
> level switch and see the stack trace as previously.
>
> Then on the other hand I don't get a stack trace when a shell script
> in multiple nesting levels fails, and I'm not very bothered about
> that.
>
> I think the current error messages do more harm than good in the
> majority of cases. If there's a better solution I'm open to
> suggestions.

I agree that the current error messages are ugly, but I don't
agree that we should not print file and line # of e.g. syntax
error.

However, we may be able to address this in a more fine
grained fashion than simply turning the stack traces on
and off.

Perhaps you could post some examples and show what
parts of the stack trace that is useful and what's just (debug)
noise?

>
> /Andreas
>



-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] membuf and at91sam3

2010-06-16 Thread Øyvind Harboe
Merged!

If you have any more code that can be deleted or disackwarded
similarly it would be most welcome :-)

-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development