From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Darren Kenny" <darren.kenny@oracle.com>
Subject: [PATCH-for-6.2? v2 3/5] docs/devel/style: Improve string format rST rendering
Date: Thu, 18 Nov 2021 15:57:14 +0100 [thread overview]
Message-ID: <20211118145716.4116731-4-philmd@redhat.com> (raw)
In-Reply-To: <20211118145716.4116731-1-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
docs/devel/style.rst | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index 1a23021bc3e..a7487d867e6 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -471,11 +471,11 @@ instead of plain strdup/strndup.
Printf-style functions
======================
-Whenever you add a new printf-style function, i.e., one with a format
-string argument and following "..." in its prototype, be sure to use
-gcc's printf attribute directive in the prototype.
+Whenever you add a new ``printf()``-style function, i.e., one with a format
+string argument and following '``...``' in its prototype, be sure to use
+gcc's ``printf()`` attribute directive in the prototype.
-This makes it so gcc's -Wformat and -Wformat-security options can do
+This makes it so gcc's ``-Wformat`` and ``-Wformat-security`` options can do
their jobs and cross-check format strings with the number and types
of arguments.
@@ -659,10 +659,10 @@ Note that ``&error_fatal`` is just another way to ``exit(1)``, and
trace-events style
==================
-0x prefix
----------
+``0x`` prefix
+-------------
-In trace-events files, use a '0x' prefix to specify hex numbers, as in:
+In trace-events files, use a '``0x``' prefix to specify hex numbers, as in:
.. code-block:: c
@@ -676,27 +676,28 @@ PCI bus id):
another_trace(int cssid, int ssid, int dev_num) "bus id: %x.%x.%04x"
-However, you can use '0x' for such groups if you want. Anyway, be sure that
+However, you can use '``0x``' for such groups if you want. Anyway, be sure that
it is obvious that numbers are in hex, ex.:
.. code-block:: c
data_dump(uint8_t c1, uint8_t c2, uint8_t c3) "bytes (in hex): %02x %02x %02x"
-Rationale: hex numbers are hard to read in logs when there is no 0x prefix,
-especially when (occasionally) the representation doesn't contain any letters
-and especially in one line with other decimal numbers. Number groups are allowed
-to not use '0x' because for some things notations like %x.%x.%x are used not
-only in QEMU. Also dumping raw data bytes with '0x' is less readable.
+Rationale: hex numbers are hard to read in logs when there is no '``0x``'
+prefix, especially when (occasionally) the representation doesn't contain any
+letters and especially in one line with other decimal numbers. Number groups
+are allowed to not use '``0x``' because for some things notations like
+'``%x.%x.%x``' are used not only in QEMU. Also dumping raw data bytes with
+'``0x``' is less readable.
-'#' printf flag
----------------
+'``#``' printf flag
+-------------------
-Do not use printf flag '#', like '%#x'.
+Do not use printf flag '``#``', like '``%#x``'.
-Rationale: there are two ways to add a '0x' prefix to printed number: '0x%...'
-and '%#...'. For consistency the only one way should be used. Arguments for
-'0x%' are:
+Rationale: there are two ways to add a '``0x``' prefix to printed number:
+'``0x%...``' and '``%#...``'. For consistency the only one way should be used.
+Arguments for '``0x%``' are:
* it is more popular
-* '%#' omits the 0x for the value 0 which makes output inconsistent
+* '``%#``' omits the ``0x`` for the value ``0`` which makes output inconsistent
--
2.31.1
next prev parent reply other threads:[~2021-11-18 15:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 14:57 [PATCH-for-6.2? v2 0/5] docs/devel/style: Improve rST rendering Philippe Mathieu-Daudé
2021-11-18 14:57 ` [PATCH-for-6.2? v2 1/5] docs/devel/style: Render C types as monospaced text Philippe Mathieu-Daudé
2021-12-15 14:20 ` Alex Bennée
2021-11-18 14:57 ` [PATCH-for-6.2? v2 2/5] docs/devel/style: Improve Error** functions rST rendering Philippe Mathieu-Daudé
2021-12-15 14:26 ` Alex Bennée
2021-11-18 14:57 ` Philippe Mathieu-Daudé [this message]
2021-12-15 14:31 ` [PATCH-for-6.2? v2 3/5] docs/devel/style: Improve string format " Alex Bennée
2021-11-18 14:57 ` [PATCH-for-6.2? v2 4/5] docs/devel/style: Render C function names as monospaced text Philippe Mathieu-Daudé
2021-12-15 14:36 ` Alex Bennée
2021-11-18 14:57 ` [PATCH-for-6.2? v2 5/5] docs/devel/style: Misc rST rendering improvements Philippe Mathieu-Daudé
2021-12-15 14:39 ` Alex Bennée
2021-11-18 15:32 ` [PATCH-for-6.2? v2 0/5] docs/devel/style: Improve rST rendering Darren Kenny
2021-12-15 10:33 ` Philippe Mathieu-Daudé
2021-12-15 14:39 ` Alex Bennée
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=20211118145716.4116731-4-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=peter.maydell@linaro.org \
--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).