Skip to contentSkip to conversation

darwin-user: Remove two unused variables

PATCH Applied Stefan Weil 3 participants 4 messages Jul 20, 2011 – Aug 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 darwin-user: Remove two unused variables

cppcheck report:

darwin-user/signal.c:322: style: Unused variable: i darwin-user/signal.c:322: style:
Variable 'err' is assigned a value that is never used

---
 darwin-user/signal.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
darwin-user/signal.c +0 -1
index e2adca3..c530227 100644
@@ -319,7 +319,6 @@ static void setup_frame(int sig, struct emulated_sigaction *ka,
 			void *set, CPUState *env)
 {
 	void *frame;
-	int i, err = 0;
 
     fprintf(stderr, "setup_frame %d\n", sig);
 	frame = get_sigframe(ka, env, sizeof(*frame));
Signature · 1 line
1.7.2.5
#1 lore raw

Hi Stefan W.,

Am 20.07.2011 um 21:40 schrieb Stefan Weil:

Quoted 5 lines

cppcheck report:

darwin-user/signal.c:322: style: Unused variable: i darwin-user/signal.c:322: style:
Variable 'err' is assigned a value that is never used

Does this really bug you? I'm a bit skeptical towards trying to fix warnings in code that doesn't compile either way... (or does it by now?)

Andreas

Quoted 23 lines

---
darwin-user/signal.c | 1 -

1 files changed, 0 insertions(+), 1 deletions(-)
darwin-user/signal.c +0 -1
index e2adca3..c530227 100644
@@ -319,7 +319,6 @@ static void setup_frame(int sig, struct  
 emulated_sigaction *ka,
 			void *set, CPUState *env)
 {
 	void *frame;
-	int i, err = 0;
 
    fprintf(stderr, "setup_frame %d\n", sig);
	frame = get_sigframe(ka, env, sizeof(*frame));
Signature · 1 line
1.7.2.5
#2 lore raw

Am 22.07.2011 22:48, schrieb Andreas Färber:

Quoted 6 lines

Hi Stefan W.,

Am 20.07.2011 um 21:40 schrieb Stefan Weil:

Quoted 2 lines

cppcheck report:

Quoted 7 lines
Quoted 3 lines

darwin-user/signal.c:322: style: Unused variable: i darwin-user/signal.c:322: style:
Variable 'err' is assigned a value that is never used

Does this really bug you? I'm a bit skeptical towards trying to fix warnings in code that doesn't compile either way... (or does it by now?)

Andreas

Hi Andreas,

the warnings were the result of a static code inspection with a program called cppcheck. I don't compile darwin code, so I did not notice that the code does not compile.

Is there a good reason to keep those two unused variables? Fixing the issue helps with static code analysis because unnecessary manual code checks can be avoided.

Cheers,
Stefan

Applied
#3 lore raw

Thanks, applied.

Quoted 32 lines · Stefan Weil

Am 22.07.2011 22:48, schrieb Andreas Färber:

Quoted 7 lines

Hi Stefan W.,

Am 20.07.2011 um 21:40 schrieb Stefan Weil:

Quoted 2 lines

cppcheck report:

Quoted 8 lines
Quoted 3 lines

darwin-user/signal.c:322: style: Unused variable: i darwin-user/signal.c:322: style:
Variable 'err' is assigned a value that is never used

Does this really bug you? I'm a bit skeptical towards trying to fix warnings in code that doesn't compile either way... (or does it by now?)

Andreas

Hi Andreas,

the warnings were the result of a static code inspection with a program called cppcheck. I don't compile darwin code, so I did not notice that the code does not compile.

Is there a good reason to keep those two unused variables? Fixing the issue helps with static code analysis because unnecessary manual code checks can be avoided.

Cheers,
Stefan