* [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute
@ 2015-03-01 13:18 Stefan Weil
2015-03-02 11:04 ` Michael Tokarev
2015-03-02 12:20 ` Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Weil @ 2015-03-01 13:18 UTC (permalink / raw)
To: QEMU Trivial; +Cc: Edgar E. Iglesias, QEMU Developer, Stefan Weil
Warnings from the Sparse static analysis tool:
disas/microblaze.c:289:3: warning:
symbol 'opcodes' was not declared. Should it be static?
disas/microblaze.c:570:6: warning:
symbol 'register_prefix' was not declared. Should it be static?
disas/microblaze.c:571:6: warning:
symbol 'special_register_prefix' was not declared. Should it be static?
disas/microblaze.c:572:6: warning:
symbol 'fsl_register_prefix' was not declared. Should it be static?
disas/microblaze.c:573:6: warning:
symbol 'pvr_register_prefix' was not declared. Should it be static?
Remove the unused variable special_register_prefix.
The variable pvr_register_prefix was unused, too, but can be used.
Add also 'const' where possible.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
This patch does not pass checkpatch.pl because of a tab used for indentation (as in most code lines).
Regards
Stefan
disas/microblaze.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/disas/microblaze.c b/disas/microblaze.c
index ec91af3..9f2464d 100644
--- a/disas/microblaze.c
+++ b/disas/microblaze.c
@@ -275,7 +275,7 @@ enum microblaze_instr_type {
#define MAX_OPCODES 280
-struct op_code_struct {
+static struct op_code_struct {
const char *name;
short inst_type; /* registers and immediate values involved */
short inst_offset_type; /* immediate vals offset from PC? (= 1 for branches) */
@@ -567,10 +567,9 @@ struct op_code_struct {
};
/* prefix for register names */
-char register_prefix[] = "r";
-char special_register_prefix[] = "spr";
-char fsl_register_prefix[] = "rfsl";
-char pvr_register_prefix[] = "rpvr";
+static const char register_prefix[] = "r";
+static const char fsl_register_prefix[] = "rfsl";
+static const char pvr_register_prefix[] = "rpvr";
/* #defines for valid immediate range */
@@ -738,7 +737,9 @@ get_field_special (long instr, struct op_code_struct * op)
default :
{
if ( ((((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) & 0xE000) == REG_PVR_MASK) {
- sprintf(tmpstr, "%spvr%d", register_prefix, (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ^ REG_PVR_MASK);
+ sprintf(tmpstr, "%s%u", pvr_register_prefix,
+ (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^
+ op->immval_mask) ^ REG_PVR_MASK);
return(strdup(tmpstr));
} else {
strcpy(spr, "pc");
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute
2015-03-01 13:18 [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute Stefan Weil
@ 2015-03-02 11:04 ` Michael Tokarev
2015-03-02 11:26 ` Stefan Weil
2015-03-02 12:20 ` Michael Tokarev
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2015-03-02 11:04 UTC (permalink / raw)
To: Stefan Weil, QEMU Trivial; +Cc: Edgar E. Iglesias, QEMU Developer
01.03.2015 16:18, Stefan Weil wrote:
> Warnings from the Sparse static analysis tool:
[...]
> @@ -738,7 +737,9 @@ get_field_special (long instr, struct op_code_struct * op)
> default :
> {
> if ( ((((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) & 0xE000) == REG_PVR_MASK) {
> - sprintf(tmpstr, "%spvr%d", register_prefix, (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ^ REG_PVR_MASK);
> + sprintf(tmpstr, "%s%u", pvr_register_prefix,
> + (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^
> + op->immval_mask) ^ REG_PVR_MASK);
Is this word wrapping intentionally put into this patch or
was it supposed to be a separate patch?
Thanks,
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute
2015-03-02 11:04 ` Michael Tokarev
@ 2015-03-02 11:26 ` Stefan Weil
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2015-03-02 11:26 UTC (permalink / raw)
To: Michael Tokarev, QEMU Trivial; +Cc: Edgar E. Iglesias, QEMU Developer
Am 02.03.2015 um 12:04 schrieb Michael Tokarev:
> 01.03.2015 16:18, Stefan Weil wrote:
>> Warnings from the Sparse static analysis tool:
> [...]
>> @@ -738,7 +737,9 @@ get_field_special (long instr, struct op_code_struct * op)
>> default :
>> {
>> if ( ((((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) & 0xE000) == REG_PVR_MASK) {
>> - sprintf(tmpstr, "%spvr%d", register_prefix, (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ^ REG_PVR_MASK);
>> + sprintf(tmpstr, "%s%u", pvr_register_prefix,
>> + (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^
>> + op->immval_mask) ^ REG_PVR_MASK);
> Is this word wrapping intentionally put into this patch or
> was it supposed to be a separate patch?
>
> Thanks,
>
> /mjt
It's part of the fix ("%spvr%d", register_prefix was replaced by "%s%u",
pvr_register_prefix).
The wrapping was needed to satisfy codecheck.pl.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute
2015-03-01 13:18 [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute Stefan Weil
2015-03-02 11:04 ` Michael Tokarev
@ 2015-03-02 12:20 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2015-03-02 12:20 UTC (permalink / raw)
To: Stefan Weil, QEMU Trivial; +Cc: Edgar E. Iglesias, QEMU Developer
Applied to -trivial, thank you!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-02 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-01 13:18 [Qemu-devel] [PATCH] disas/microblaze: Fix warnings caused by missing 'static' attribute Stefan Weil
2015-03-02 11:04 ` Michael Tokarev
2015-03-02 11:26 ` Stefan Weil
2015-03-02 12:20 ` Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.