diff mbox

m68k: Build the opcode table only once to avoid multithreading issues

Message ID 56B226A5.80507@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Blake Feb. 3, 2016, 4:11 p.m. UTC
On 02/03/2016 08:20 AM, John Paul Adrian Glaubitz wrote:
> On 02/03/2016 04:16 PM, Eric Blake wrote:
>> Missing {}.  Are you sure this is the version that passed
>> checkpatch.pl?
> 
> Yes:
> 
> glaubitz@z6:..qemu/target-m68k> ../scripts/checkpatch.pl
> 0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch
> total: 0 errors, 0 warnings, 10 lines checked
> 
> 0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch has no
> obvious style problems and is ready for submission.
> glaubitz@z6:..qemu/target-m68k> cat
> 0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch
> From 2d8ef8d0244db95e41e04ff909560f12676e1dec Mon Sep 17 00:00:00 2001
> From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Date: Wed, 3 Feb 2016 10:22:35 +0100
> Subject: [PATCH 2/2] m68k: Build the opcode table only once to avoid
>  multithreading issues

Weird. Wonder why it doesn't complain on that file?  I'm guessing that
it is due to the #define on the next line.  Because rearranging things
to put the code after the #define changes the situation (but not the
semantics):



properly warns:

$ git commit -a -m tmp
WARNING: braces {} are necessary for all arms of this statement
#10: FILE: target-m68k/translate.c:2836:
+    if (opcode_table[0])
[...]

total: 0 errors, 1 warnings, 10 lines checked

(yes, I've hooked up git to have a pre-commit check to run checkpatch.pl).
diff mbox

Patch

diff --git i/target-m68k/translate.c w/target-m68k/translate.c
index 342c040..587c44f 100644
--- i/target-m68k/translate.c
+++ w/target-m68k/translate.c
@@ -2832,6 +2832,10 @@  void register_m68k_insns (CPUM68KState *env)
     if (m68k_feature(env, M68K_FEATURE_##feature)) \
         register_opcode(disas_##name, 0x##opcode, 0x##mask); \
     } while(0)
+
+    if (0)
+        return;
+
     INSN(undef,     0000, 0000, CF_ISA_A);
     INSN(arith_im,  0080, fff8, CF_ISA_A);
     INSN(bitrev,    00c0, fff8, CF_ISA_APLUSC);