[coreboot] New patch to review for coreboot: b043841 Fix compilation of x86emu with gcc 4.6.x

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu Oct 13 00:48:58 CEST 2011


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/258

-gerrit

commit b0438411e379d3fa1e3e7f43963138eb2d46a2fd
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Tue Oct 4 10:34:37 2011 -0700

    Fix compilation of x86emu with gcc 4.6.x
    
    gcc 4.6 complains about unused but set variables in x86emu.
    Particularly some variables are always set but only used in
    debug mode, or when FPU support is enabled.
    
    Change-Id: Ic53bd2303171ab717eb2d2c0ed72744d3eb6989e
    Signed-off-by: Stefan Reinauer <reinauer at google.com>
---
 src/devices/oprom/x86emu/debug.h |    6 ++++++
 src/devices/oprom/x86emu/fpu.c   |   32 +++++++++++++++++++-------------
 src/devices/oprom/x86emu/ops.c   |    8 ++++----
 src/devices/oprom/x86emu/ops2.c  |    2 +-
 4 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/src/devices/oprom/x86emu/debug.h b/src/devices/oprom/x86emu/debug.h
index ba180ba..1b2c3a3 100644
--- a/src/devices/oprom/x86emu/debug.h
+++ b/src/devices/oprom/x86emu/debug.h
@@ -198,6 +198,12 @@
 #define	DB(x)
 #endif
 
+#ifdef DEBUG
+#define X86EMU_DEBUG_ONLY(x) x
+#else
+#define X86EMU_DEBUG_ONLY(x) X86EMU_UNUSED(x)
+#endif
+
 /*-------------------------- Function Prototypes --------------------------*/
 
 #ifdef  __cplusplus
diff --git a/src/devices/oprom/x86emu/fpu.c b/src/devices/oprom/x86emu/fpu.c
index daa2ffa..7edebd4 100644
--- a/src/devices/oprom/x86emu/fpu.c
+++ b/src/devices/oprom/x86emu/fpu.c
@@ -50,6 +50,12 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
     END_OF_INSTR_NO_TRACE();
 }
 
+#ifdef X86EMU_FPU_PRESENT
+#define X86EMU_FPU_ONLY(x) x
+#else
+#define X86EMU_FPU_ONLY(x) X86EMU_UNUSED(x)
+#endif
+
 #ifdef DEBUG
 
 static const char *x86emu_fpu_op_d9_tab[] = {
@@ -95,8 +101,8 @@ static const char *x86emu_fpu_op_d9_tab1[] = {
 void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -322,8 +328,8 @@ static const char *x86emu_fpu_op_da_tab[] = {
 void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -403,7 +409,7 @@ static const char *x86emu_fpu_op_db_tab[] = {
 void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
+    uint X86EMU_FPU_ONLY(destoffset);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -530,8 +536,8 @@ static const char *x86emu_fpu_op_dc_tab[] = {
 void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -640,8 +646,8 @@ static const char *x86emu_fpu_op_dd_tab[] = {
 void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -747,8 +753,8 @@ static const char *x86emu_fpu_op_de_tab[] =
 void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
@@ -866,8 +872,8 @@ static const char *x86emu_fpu_op_df_tab[] = {
 void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
 {
     int mod, rl, rh;
-    uint destoffset;
-    u8 stkelem;
+    uint X86EMU_FPU_ONLY(destoffset);
+    u8 X86EMU_FPU_ONLY(stkelem);
 
     START_OF_INSTR();
     FETCH_DECODE_MODRM(mod, rh, rl);
diff --git a/src/devices/oprom/x86emu/ops.c b/src/devices/oprom/x86emu/ops.c
index c66da95..70e048d 100644
--- a/src/devices/oprom/x86emu/ops.c
+++ b/src/devices/oprom/x86emu/ops.c
@@ -3562,7 +3562,7 @@ Handles opcode 0xcc
 ****************************************************************************/
 static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
 {
-    u16 tmp;
+    u16 X86EMU_UNUSED(tmp);
 
     START_OF_INSTR();
     DECODE_PRINTF("INT 3\n");
@@ -3590,7 +3590,7 @@ Handles opcode 0xcd
 ****************************************************************************/
 static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
 {
-    u16 tmp;
+    u16 X86EMU_UNUSED(tmp);
     u8 intnum;
 
     START_OF_INSTR();
@@ -3620,7 +3620,7 @@ Handles opcode 0xce
 ****************************************************************************/
 static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
 {
-    u16 tmp;
+    u16 X86EMU_UNUSED(tmp);
 
     START_OF_INSTR();
     DECODE_PRINTF("INTO\n");
@@ -4034,7 +4034,7 @@ Handles opcode 0xd5
 ****************************************************************************/
 static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
 {
-    u8 a;
+    u8 X86EMU_UNUSED(a);
 
     START_OF_INSTR();
     DECODE_PRINTF("AAD\n");
diff --git a/src/devices/oprom/x86emu/ops2.c b/src/devices/oprom/x86emu/ops2.c
index 349a664..f559874 100644
--- a/src/devices/oprom/x86emu/ops2.c
+++ b/src/devices/oprom/x86emu/ops2.c
@@ -336,7 +336,7 @@ static void x86emuOp2_set_byte(u8 op2)
     int mod, rl, rh;
     uint destoffset;
     u8  *destreg;
-    const char *name = 0;
+    const char *X86EMU_DEBUG_ONLY(name) = 0;
     int cond = 0;
 
     START_OF_INSTR();




More information about the coreboot mailing list