qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	qemu-devel@nongnu.org
Cc: laurent@vivier.eu
Subject: Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
Date: Wed, 3 Feb 2016 09:11:17 -0700	[thread overview]
Message-ID: <56B226A5.80507@redhat.com> (raw)
In-Reply-To: <56B21ACC.1020802@physik.fu-berlin.de>

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

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):

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);


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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-02-03 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 10:14 [Qemu-devel] Updated patch for the opcode table John Paul Adrian Glaubitz
2016-02-03 10:14 ` [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues John Paul Adrian Glaubitz
2016-02-03 15:16   ` Eric Blake
2016-02-03 15:19     ` Laurent Vivier
2016-02-03 15:20     ` John Paul Adrian Glaubitz
2016-02-03 16:11       ` Eric Blake [this message]
2016-02-04 15:18         ` John Paul Adrian Glaubitz
2016-02-08 23:15           ` John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B226A5.80507@redhat.com \
    --to=eblake@redhat.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).