All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: qemu devel list <qemu-devel@nongnu.org>
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH v2 2/4] qapi: add SysEmuTarget to "common.json"
Date: Thu, 26 Apr 2018 20:34:02 +0200	[thread overview]
Message-ID: <20180426183404.3756-3-lersek@redhat.com> (raw)
In-Reply-To: <20180426183404.3756-1-lersek@redhat.com>

We'll soon need an enumeration type that lists all the softmmu targets
that QEMU (the project) supports. Introduce @SysEmuTarget to
"common.json".

The enum constant @x86_64 is not spelled @x86-64 because the corresponding
emulator is called qemu-system-x86_64.

Like other enum types, @SysEmuTarget too can be used for discriminator
fields in unions. For the @i386 constant, a C-language union member called
"i386" would be generated. On mingw build hosts, "i386" is a macro
however. Add "i386" to "polluted_words" at once.

Cc: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    PATCHv2:
    
    - document the use of the underscore in @x86_64 in both the commit
      message and in the schema [Eric, Dan]
    
    - extend "polluted_words" with "i386" [Eric]
    
    - drop previous R-b's
    
    - update the CC list
    
    PATCHv1:
    
    - pick up R-b's from Markus and Kashyap, no changes
    
    RFCv3:
    
    - The patch is new in this version. [Dan, Markus]
    
    - The original idea was to call the new enum @Target; however, @Target
      generates exactly the TARGET_AARCH64, TARGET_ALPHA, TARGET_ARM, ...
      enumeration constants that conflict with the poisoned preprocessing
      macros of the same names. Hence @SysEmuTarget -- it's more accurate
      anyway, since we want it to stand for system emulation targets.
    
    - Also, we discussed defining the new type in either "common.json" or
      "misc.json". "misc.json" turned out to be a problem: "firmware.json"
      would then include "misc.json" for the new type's sake, but that
      inclusion would become the first appearance of "misc.json" -- within
      "firmware.json". That messed up the generated documentation. By adding
      the new type to "common.json", "misc.json" (see the 2nd patch) and
      "firmware.json" (see the 3rd patch) can both consume the new type
      without problems.

 qapi/common.json       | 27 +++++++++++++++++++++++++++
 scripts/qapi/common.py |  2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/qapi/common.json b/qapi/common.json
index d9b14dd429f3..7daa9b6798ac 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -118,11 +118,38 @@
 #
 # @bar3: PCI BAR3 is used for the feature
 #
 # @bar4: PCI BAR4 is used for the feature
 #
 # @bar5: PCI BAR5 is used for the feature
 #
 # Since: 2.12
 ##
 { 'enum': 'OffAutoPCIBAR',
   'data': [ 'off', 'auto', 'bar0', 'bar1', 'bar2', 'bar3', 'bar4', 'bar5' ] }
+
+##
+# @SysEmuTarget:
+#
+# The comprehensive enumeration of QEMU system emulation ("softmmu")
+# targets. Run "./configure --help" in the project root directory, and
+# look for the *-softmmu targets near the "--target-list" option. The
+# individual target constants are not documented here, for the time
+# being.
+#
+# Notes: @x86_64 doesn't match the QAPI convention of preferring hyphen
+#        ("-") over underscore ("_"). This is intentional; the
+#        @SysEmuTarget constants are supposed to produce QEMU executable
+#        names when stringified and appended to the "qemu-system-"
+#        prefix. Put differently, the replacement text of the
+#        TARGET_NAME preprocessor macro must be possible to look up in
+#        the list of (stringified) enum constants.
+#
+# Since: 2.13
+##
+{ 'enum' : 'SysEmuTarget',
+  'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32',
+             'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
+             'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc',
+             'ppc64', 'ppcemb', 'riscv32', 'riscv64', 's390x', 'sh4',
+             'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32',
+             'x86_64', 'xtensa', 'xtensaeb' ] }
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 3e14bc41f2c0..a032cec37509 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -1814,23 +1814,23 @@ def c_name(name, protect=True):
     # C++ ISO/IEC 14882:2003 2.11
     cpp_words = set(['bool', 'catch', 'class', 'const_cast', 'delete',
                      'dynamic_cast', 'explicit', 'false', 'friend', 'mutable',
                      'namespace', 'new', 'operator', 'private', 'protected',
                      'public', 'reinterpret_cast', 'static_cast', 'template',
                      'this', 'throw', 'true', 'try', 'typeid', 'typename',
                      'using', 'virtual', 'wchar_t',
                      # alternative representations
                      'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
                      'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'])
     # namespace pollution:
-    polluted_words = set(['unix', 'errno', 'mips', 'sparc'])
+    polluted_words = set(['unix', 'errno', 'mips', 'sparc', 'i386'])
     name = name.translate(c_name_trans)
     if protect and (name in c89_words | c99_words | c11_words | gcc_words
                     | cpp_words | polluted_words):
         return 'q_' + name
     return name
 
 eatspace = '\033EATSPACE.'
 pointer_suffix = ' *' + eatspace
 
 
 def genindent(count):
-- 
2.14.1.3.gb7cf6e02401b

  parent reply	other threads:[~2018-04-26 18:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 18:34 [Qemu-devel] [PATCH v2 0/4] qapi: introduce the SysEmuTarget enumeration Laszlo Ersek
2018-04-26 18:34 ` [Qemu-devel] [PATCH v2 1/4] qapi: fill in CpuInfoFast.arch in query-cpus-fast Laszlo Ersek
2018-04-27  7:05   ` Cornelia Huck
2018-04-27  7:18   ` Markus Armbruster
2018-04-26 18:34 ` Laszlo Ersek [this message]
2018-04-26 19:27   ` [Qemu-devel] [PATCH v2 2/4] qapi: add SysEmuTarget to "common.json" Eric Blake
2018-04-27  7:18   ` Markus Armbruster
2018-04-26 18:34 ` [Qemu-devel] [PATCH v2 3/4] qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget Laszlo Ersek
2018-04-26 19:31   ` Eric Blake
2018-04-26 18:34 ` [Qemu-devel] [PATCH v2 4/4] qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch Laszlo Ersek
2018-04-26 19:41   ` Eric Blake
2018-04-26 19:45     ` Eric Blake
2018-04-27  7:29   ` Markus Armbruster

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=20180426183404.3756-3-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.