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

login
register
mail settings
Submitter Stefan Weil
Date Dec. 14, 2009, 9:54 a.m.
Message ID <1260784489-15773-1-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/41077/
State New
Headers show

Comments

Stefan Weil - Dec. 14, 2009, 9:54 a.m.
"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.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 target-alpha/helper.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Laurent Desnogues - Dec. 15, 2009, 11:57 a.m.
On Mon, Dec 14, 2009 at 10:54 AM, Stefan Weil <weil@mail.berlios.de> wrote:
> "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.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>

> ---
>  target-alpha/helper.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/target-alpha/helper.c b/target-alpha/helper.c
> index a658f97..be7d37b 100644
> --- a/target-alpha/helper.c
> +++ b/target-alpha/helper.c
> @@ -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
>
>
>
>

Patch

diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index a658f97..be7d37b 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -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;
     }