Skip to contentSkip to conversation

target-alpha: Fix compiler warning for gcc-4.3 (and older)

PATCH In review Stefan Weil 2 participants 2 messages Dec 14, 2009 – Dec 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-alpha: Fix compiler warning for gcc-4.3 (and older)

"Old" compilers obviously are not able to recognise that all cases are handled here:

qemu/target-alpha/helper.c:70: error: ‘round_mode’ may be used uninitialized in this function

A small modification helps the compiler to do its jobs.

gcc-4.4 does not need this, but is still not standard on all platforms.

---
 target-alpha/helper.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
target-alpha/helper.c +1 -0
index a658f97..be7d37b 100644
@@ -95,6 +95,7 @@ void cpu_alpha_store_fpcr (CPUState *env, uint64_t val)
         round_mode = float_round_nearest_even;
         break;
     case 3:
+    default: /* this avoids a gcc (< 4.4) warning */
         round_mode = float_round_up;
         break;
     }
Signature · 1 line
1.6.5
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Stefan Weil

"Old" compilers obviously are not able to recognise that all cases are handled here:

qemu/target-alpha/helper.c:70: error: ‘round_mode’ may be used uninitialized in this function

A small modification helps the compiler to do its jobs.

gcc-4.4 does not need this, but is still not standard on all platforms.

Quoted 22 lines

---
 target-alpha/helper.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
target-alpha/helper.c +0 -0
index a658f97..be7d37b 100644
@@ -95,6 +95,7 @@ void cpu_alpha_store_fpcr (CPUState *env, uint64_t val)
         round_mode = float_round_nearest_even;
         break;

    case 3:
+    default: /* this avoids a gcc (< 4.4) warning */ round_mode = float_round_up;
        break;
    }
--
1.6.5