Skip to contentSkip to conversation

hppa: avoid anonymous unions in designated initializers.

PATCH In review Paolo Bonzini 4 participants 4 messages Mar 3, 2017 – Mar 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hppa: avoid anonymous unions in designated initializers.

These cause compilation failures on CentOS 6 or other operating systems with older GCCs.

Cc Richard Henderson <[email protected]>
Cc Peter Maydell <[email protected]>

---
Peter, please consider applying this as a build fix, because the centos6 docker target is broken.

 target/hppa/translate.c | 66 ++++++++++++++++++++++++-------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
target/hppa/translate.c +33 -33
index 5d571f0..9e8c233 100644
@@ -84,14 +84,14 @@ typedef struct DisasInsn {
     ExitStatus (*trans)(DisasContext *ctx, uint32_t insn,
                         const struct DisasInsn *f);
     union {
-        void (*f_ttt)(TCGv, TCGv, TCGv);
-        void (*f_weww)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32);
-        void (*f_dedd)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64);
-        void (*f_wew)(TCGv_i32, TCGv_env, TCGv_i32);
-        void (*f_ded)(TCGv_i64, TCGv_env, TCGv_i64);
-        void (*f_wed)(TCGv_i32, TCGv_env, TCGv_i64);
-        void (*f_dew)(TCGv_i64, TCGv_env, TCGv_i32);
-    };
+        void (*ttt)(TCGv, TCGv, TCGv);
+        void (*weww)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32);
+        void (*dedd)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64);
+        void (*wew)(TCGv_i32, TCGv_env, TCGv_i32);
+        void (*ded)(TCGv_i64, TCGv_env, TCGv_i64);
+        void (*wed)(TCGv_i32, TCGv_env, TCGv_i64);
+        void (*dew)(TCGv_i64, TCGv_env, TCGv_i32);
+    } f;
 } DisasInsn;
 
 /* global register indexes */
@@ -1934,7 +1934,7 @@ static ExitStatus trans_log(DisasContext *ctx, uint32_t insn,
     }
     tcg_r1 = load_gpr(ctx, r1);
     tcg_r2 = load_gpr(ctx, r2);
-    ret = do_log(ctx, rt, tcg_r1, tcg_r2, cf, di->f_ttt);
+    ret = do_log(ctx, rt, tcg_r1, tcg_r2, cf, di->f.ttt);
     return nullify_end(ctx, ret);
 }
 
@@ -2111,10 +2111,10 @@ static ExitStatus trans_ds(DisasContext *ctx, uint32_t insn,
 static const DisasInsn table_arith_log[] = {
     { 0x08000240u, 0xfc00ffffu, trans_nop },  /* or x,y,0 */
     { 0x08000240u, 0xffe0ffe0u, trans_copy }, /* or x,0,t */
-    { 0x08000000u, 0xfc000fe0u, trans_log, .f_ttt = tcg_gen_andc_tl },
-    { 0x08000200u, 0xfc000fe0u, trans_log, .f_ttt = tcg_gen_and_tl },
-    { 0x08000240u, 0xfc000fe0u, trans_log, .f_ttt = tcg_gen_or_tl },
-    { 0x08000280u, 0xfc000fe0u, trans_log, .f_ttt = tcg_gen_xor_tl },
+    { 0x08000000u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_andc_tl },
+    { 0x08000200u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_and_tl },
+    { 0x08000240u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_or_tl },
+    { 0x08000280u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_xor_tl },
     { 0x08000880u, 0xfc000fe0u, trans_cmpclr },
     { 0x08000380u, 0xfc000fe0u, trans_uxor },
     { 0x08000980u, 0xfc000fa0u, trans_uaddcm },
@@ -3061,7 +3061,7 @@ static ExitStatus trans_fop_wew_0c(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = extract32(insn, 0, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_wew(ctx, rt, ra, di->f_wew);
+    return do_fop_wew(ctx, rt, ra, di->f.wew);
 }
 
 static ExitStatus trans_fop_wew_0e(DisasContext *ctx, uint32_t insn,
@@ -3069,7 +3069,7 @@ static ExitStatus trans_fop_wew_0e(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = assemble_rt64(insn);
     unsigned ra = assemble_ra64(insn);
-    return do_fop_wew(ctx, rt, ra, di->f_wew);
+    return do_fop_wew(ctx, rt, ra, di->f.wew);
 }
 
 static ExitStatus trans_fop_ded(DisasContext *ctx, uint32_t insn,
@@ -3077,7 +3077,7 @@ static ExitStatus trans_fop_ded(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = extract32(insn, 0, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_ded(ctx, rt, ra, di->f_ded);
+    return do_fop_ded(ctx, rt, ra, di->f.ded);
 }
 
 static ExitStatus trans_fop_wed_0c(DisasContext *ctx, uint32_t insn,
@@ -3085,7 +3085,7 @@ static ExitStatus trans_fop_wed_0c(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = extract32(insn, 0, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_wed(ctx, rt, ra, di->f_wed);
+    return do_fop_wed(ctx, rt, ra, di->f.wed);
 }
 
 static ExitStatus trans_fop_wed_0e(DisasContext *ctx, uint32_t insn,
@@ -3093,7 +3093,7 @@ static ExitStatus trans_fop_wed_0e(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = assemble_rt64(insn);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_wed(ctx, rt, ra, di->f_wed);
+    return do_fop_wed(ctx, rt, ra, di->f.wed);
 }
 
 static ExitStatus trans_fop_dew_0c(DisasContext *ctx, uint32_t insn,
@@ -3101,7 +3101,7 @@ static ExitStatus trans_fop_dew_0c(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = extract32(insn, 0, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_dew(ctx, rt, ra, di->f_dew);
+    return do_fop_dew(ctx, rt, ra, di->f.dew);
 }
 
 static ExitStatus trans_fop_dew_0e(DisasContext *ctx, uint32_t insn,
@@ -3109,7 +3109,7 @@ static ExitStatus trans_fop_dew_0e(DisasContext *ctx, uint32_t insn,
 {
     unsigned rt = extract32(insn, 0, 5);
     unsigned ra = assemble_ra64(insn);
-    return do_fop_dew(ctx, rt, ra, di->f_dew);
+    return do_fop_dew(ctx, rt, ra, di->f.dew);
 }
 
 static ExitStatus trans_fop_weww_0c(DisasContext *ctx, uint32_t insn,
@@ -3118,7 +3118,7 @@ static ExitStatus trans_fop_weww_0c(DisasContext *ctx, uint32_t insn,
     unsigned rt = extract32(insn, 0, 5);
     unsigned rb = extract32(insn, 16, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_weww(ctx, rt, ra, rb, di->f_weww);
+    return do_fop_weww(ctx, rt, ra, rb, di->f.weww);
 }
 
 static ExitStatus trans_fop_weww_0e(DisasContext *ctx, uint32_t insn,
@@ -3127,7 +3127,7 @@ static ExitStatus trans_fop_weww_0e(DisasContext *ctx, uint32_t insn,
     unsigned rt = assemble_rt64(insn);
     unsigned rb = assemble_rb64(insn);
     unsigned ra = assemble_ra64(insn);
-    return do_fop_weww(ctx, rt, ra, rb, di->f_weww);
+    return do_fop_weww(ctx, rt, ra, rb, di->f.weww);
 }
 
 static ExitStatus trans_fop_dedd(DisasContext *ctx, uint32_t insn,
@@ -3136,7 +3136,7 @@ static ExitStatus trans_fop_dedd(DisasContext *ctx, uint32_t insn,
     unsigned rt = extract32(insn, 0, 5);
     unsigned rb = extract32(insn, 16, 5);
     unsigned ra = extract32(insn, 21, 5);
-    return do_fop_dedd(ctx, rt, ra, rb, di->f_dedd);
+    return do_fop_dedd(ctx, rt, ra, rb, di->f.dedd);
 }
 
 static void gen_fcpy_s(TCGv_i32 dst, TCGv_env unused, TCGv_i32 src)
@@ -3340,13 +3340,13 @@ static ExitStatus trans_xmpyu(DisasContext *ctx, uint32_t insn,
     return nullify_end(ctx, NO_EXIT);
 }
 
-#define FOP_DED  trans_fop_ded, .f_ded
-#define FOP_DEDD trans_fop_dedd, .f_dedd
+#define FOP_DED  trans_fop_ded, .f.ded
+#define FOP_DEDD trans_fop_dedd, .f.dedd
 
-#define FOP_WEW  trans_fop_wew_0c, .f_wew
-#define FOP_DEW  trans_fop_dew_0c, .f_dew
-#define FOP_WED  trans_fop_wed_0c, .f_wed
-#define FOP_WEWW trans_fop_weww_0c, .f_weww
+#define FOP_WEW  trans_fop_wew_0c, .f.wew
+#define FOP_DEW  trans_fop_dew_0c, .f.dew
+#define FOP_WED  trans_fop_wed_0c, .f.wed
+#define FOP_WEWW trans_fop_weww_0c, .f.weww
 
 static const DisasInsn table_float_0c[] = {
     /* floating point class zero */
@@ -3425,10 +3425,10 @@ static const DisasInsn table_float_0c[] = {
 #undef FOP_DEW
 #undef FOP_WED
 #undef FOP_WEWW
-#define FOP_WEW  trans_fop_wew_0e, .f_wew
-#define FOP_DEW  trans_fop_dew_0e, .f_dew
-#define FOP_WED  trans_fop_wed_0e, .f_wed
-#define FOP_WEWW trans_fop_weww_0e, .f_weww
+#define FOP_WEW  trans_fop_wew_0e, .f.wew
+#define FOP_DEW  trans_fop_dew_0e, .f.dew
+#define FOP_WED  trans_fop_wed_0e, .f.wed
+#define FOP_WEWW trans_fop_weww_0e, .f.weww
 
 static const DisasInsn table_float_0e[] = {
     /* floating point class zero */
Signature · 1 line
1.8.3.1
#1 lore raw
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PATCH] hppa: avoid anonymous unions in designated initializers.

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
0eaaa9f hppa: avoid anonymous unions in designated initializers.

=== OUTPUT BEGIN ===
Checking PATCH 1/1: hppa: avoid anonymous unions in designated initializers....
ERROR: Macros with complex values should be enclosed in parenthesis #161: FILE: target/hppa/translate.c:3343:
+#define FOP_DED trans_fop_ded, .f.ded

ERROR: Macros with complex values should be enclosed in parenthesis #162: FILE: target/hppa/translate.c:3344:
+#define FOP_DEDD trans_fop_dedd, .f.dedd

ERROR: Macros with complex values should be enclosed in parenthesis #168: FILE: target/hppa/translate.c:3346:
+#define FOP_WEW trans_fop_wew_0c, .f.wew

ERROR: Macros with complex values should be enclosed in parenthesis #169: FILE: target/hppa/translate.c:3347:
+#define FOP_DEW trans_fop_dew_0c, .f.dew

ERROR: Macros with complex values should be enclosed in parenthesis #170: FILE: target/hppa/translate.c:3348:
+#define FOP_WED trans_fop_wed_0c, .f.wed

ERROR: Macros with complex values should be enclosed in parenthesis #171: FILE: target/hppa/translate.c:3349:
+#define FOP_WEWW trans_fop_weww_0c, .f.weww

ERROR: Macros with complex values should be enclosed in parenthesis #183: FILE: target/hppa/translate.c:3428:
+#define FOP_WEW trans_fop_wew_0e, .f.wew

ERROR: Macros with complex values should be enclosed in parenthesis #184: FILE: target/hppa/translate.c:3429:
+#define FOP_DEW trans_fop_dew_0e, .f.dew

ERROR: Macros with complex values should be enclosed in parenthesis #185: FILE: target/hppa/translate.c:3430:
+#define FOP_WED trans_fop_wed_0e, .f.wed

ERROR: Macros with complex values should be enclosed in parenthesis #186: FILE: target/hppa/translate.c:3431:
+#define FOP_WEWW trans_fop_weww_0e, .f.weww

total: 10 errors, 0 warnings, 157 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#3 lore raw
Quoted 13 lines · Richard Henderson
Quoted 10 lines · Paolo Bonzini

These cause compilation failures on CentOS 6 or other operating systems with older GCCs.

Cc Richard Henderson <[email protected]>
Cc Peter Maydell <[email protected]>

---
Peter, please consider applying this as a build fix, because the centos6 docker target is broken.

Quoted 1 line

Thanks; applied to master as a buildfix.

-- PMM