Skip to contentSkip to conversation

target/arm: add spaces around operator

PATCH In review Xinhao Zhang 2 participants 5 messages Nov 3, 2020 – Nov 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 target/arm: add spaces around operator

Fix code style. Operator needs spaces both sides.

---
 target/arm/arch_dump.c | 8 ++++----
 target/arm/arm-semi.c  | 8 ++++----
 target/arm/helper.c    | 2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
target/arm/arch_dump.c +4 -4
index 7693e17e96..0184845310 100644
@@ -114,8 +114,8 @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f,
 
     for (i = 0; i < 32; ++i) {
         uint64_t *q = aa64_vfp_qreg(env, i);
-        note.vfp.vregs[2*i + 0] = cpu_to_dump64(s, q[0]);
-        note.vfp.vregs[2*i + 1] = cpu_to_dump64(s, q[1]);
+        note.vfp.vregs[2 * i + 0] = cpu_to_dump64(s, q[0]);
+        note.vfp.vregs[2 * i + 1] = cpu_to_dump64(s, q[1]);
     }
 
     if (s->dump_info.d_endian == ELFDATA2MSB) {
@@ -125,8 +125,8 @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f,
          */
         for (i = 0; i < 32; ++i) {
             uint64_t tmp = note.vfp.vregs[2*i];
-            note.vfp.vregs[2*i] = note.vfp.vregs[2*i+1];
-            note.vfp.vregs[2*i+1] = tmp;
+            note.vfp.vregs[2 * i] = note.vfp.vregs[2 * i + 1];
+            note.vfp.vregs[2 * i + 1] = tmp;
         }
     }
 
target/arm/arm-semi.c +4 -4
index 8718fd0194..c1df664f7e 100644
@@ -755,7 +755,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
         if (use_gdb_syscalls()) {
             arm_semi_open_guestfd = guestfd;
             ret = arm_gdb_syscall(cpu, arm_semi_open_cb, "open,%s,%x,1a4", arg0,
-                                  (int)arg2+1, gdb_open_modeflags[arg1]);
+                                  (int)arg2 + 1, gdb_open_modeflags[arg1]);
         } else {
             ret = set_swi_errno(env, open(s, open_modeflags[arg1], 0644));
             if (ret == (uint32_t)-1) {
@@ -852,7 +852,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
         GET_ARG(1);
         if (use_gdb_syscalls()) {
             ret = arm_gdb_syscall(cpu, arm_semi_cb, "unlink,%s",
-                                  arg0, (int)arg1+1);
+                                  arg0, (int)arg1 + 1);
         } else {
             s = lock_user_string(arg0);
             if (!s) {
@@ -870,7 +870,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
         GET_ARG(3);
         if (use_gdb_syscalls()) {
             return arm_gdb_syscall(cpu, arm_semi_cb, "rename,%s,%s",
-                                   arg0, (int)arg1+1, arg2, (int)arg3+1);
+                                   arg0, (int)arg1 + 1, arg2, (int)arg3 + 1);
         } else {
             char *s2;
             s = lock_user_string(arg0);
@@ -896,7 +896,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
         GET_ARG(1);
         if (use_gdb_syscalls()) {
             return arm_gdb_syscall(cpu, arm_semi_cb, "system,%s",
-                                   arg0, (int)arg1+1);
+                                   arg0, (int)arg1 + 1);
         } else {
             s = lock_user_string(arg0);
             if (!s) {
target/arm/helper.c +1 -1
index 97bb6b8c01..4586e33014 100644
@@ -12518,7 +12518,7 @@ uint32_t HELPER(usad8)(uint32_t a, uint32_t b)
     uint32_t sum;
     sum = do_usad(a, b);
     sum += do_usad(a >> 8, b >> 8);
-    sum += do_usad(a >> 16, b >>16);
+    sum += do_usad(a >> 16, b >> 16);
     sum += do_usad(a >> 24, b >> 24);
     return sum;
 }
Signature · 1 line
2.29.0-rc1
#1 lore raw

PATCH 2/3 target/arm: Don't use '#' flag of printf format

Fix code style. Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead

---
 target/arm/translate-a64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/translate-a64.c +2 -2
index 072754fa24..1867ec293f 100644
@@ -12114,7 +12114,7 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn)
                 gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst);
                 break;
             default:
-                fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n",
+                fprintf(stderr, "%s: insn 0x%04x, fpop 0x%2x @ 0x%" PRIx64 "\n",
                         __func__, insn, fpopcode, s->pc_curr);
                 g_assert_not_reached();
             }
@@ -13121,7 +13121,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
     case 0x7f: /* FSQRT (vector) */
         break;
     default:
-        fprintf(stderr, "%s: insn %#04x fpop %#2x\n", __func__, insn, fpop);
+        fprintf(stderr, "%s: insn 0x%04x fpop 0x%2x\n", __func__, insn, fpop);
         g_assert_not_reached();
     }
 
Signature · 1 line
2.29.0-rc1
#2 lore raw

PATCH 3/3 target/arm: add space before the open parenthesis '('

In reply to Xinhao Zhang

Fix code style. Space required before the open parenthesis '('.

---
 target/arm/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/translate.c +1 -1
index 38371db540..efa3b59d04 100644
@@ -9094,7 +9094,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
             - Hardware watchpoints.
            Hardware breakpoints have already been handled and skip this code.
          */
-        switch(dc->base.is_jmp) {
+        switch (dc->base.is_jmp) {
         case DISAS_NEXT:
         case DISAS_TOO_MANY:
             gen_goto_tb(dc, 1, dc->base.pc_next);
Signature · 1 line
2.29.0-rc1
#3 lore raw
In reply to Xinhao Zhang
Quoted 2 lines · Xinhao Zhang

Fix code style. Operator needs spaces both sides.

Thanks; I have applied this series to target-arm.next.

For future patch submissions, please could you include a cover letter if you're submitting a series with more than one patch in it? (Single patches don't need a cover letter). The individual patches should all then be follow-ups to the cover letter (in the usual way that git format-patch --cover-letter sets up).

(We document this and other conventions for our code submission process at:
https://wiki.qemu.org/Contribute/SubmitAPatch )

thanks
-- PMM

#4 lore raw

Thanks for advise. I will study the documents and include a cover letter in next patch series submissions :)

-----邮件原件-----
发件人: Peter Maydell [mailto:[email protected]]
发送时间: 2020年11月5日 2:05
收件人: zhangxinhao <[email protected]>
抄送: QEMU Developers <[email protected]>; qemu-arm <[email protected]>; dengkai (A) <[email protected]>; Chenzhendong (alex) <[email protected]>; QEMU Trivial <[email protected]> 主题: Re: [PATCH 1/3] target/arm: add spaces around operator

Quoted 2 lines · Xinhao Zhang

Fix code style. Operator needs spaces both sides.

Thanks; I have applied this series to target-arm.next.

For future patch submissions, please could you include a cover letter if you're submitting a series with more than one patch in it? (Single patches don't need a cover letter). The individual patches should all then be follow-ups to the cover letter (in the usual way that git format-patch --cover-letter sets up).

(We document this and other conventions for our code submission process at:
https://wiki.qemu.org/Contribute/SubmitAPatch )

thanks
-- PMM