Skip to contentSkip to conversation

docs/sphinx: change default `role` to "any"

PATCH In review John Snow 2 participants 7 messages Nov 2, 2021 – Nov 3, 2021 KVM

lore
Share & tools
lore

John Snow

author
#0 lore raw

v5 cover docs/sphinx: change default `role` to "any"

(Patches 1-3 can be squashed on merge, I just found it easier to tack on new changes as part of the rebase so that reviewers can easily see what's new each time.)

V5: Rebased
V4: Rebased
V3: Removed bad rebase confetti
fixed the OSS-Fuzz link to ... actually be a link.

--js

John Snow (4):
docs: remove non-reference uses of single backticks
docs: (further) remove non-reference uses of single backticks
docs: (further further) remove non-reference uses of single backticks docs/sphinx: change default role to "any"

 docs/conf.py                           |  5 +++++
 docs/devel/build-system.rst            | 21 +++++++++++----------
 docs/devel/fuzzing.rst                 |  9 +++++----
 docs/devel/tcg-plugins.rst             |  2 +-
 docs/interop/live-block-operations.rst |  2 +-
 docs/system/guest-loader.rst           |  2 +-
 docs/system/i386/sgx.rst               |  6 +++---
 qapi/block-core.json                   |  4 ++--
 include/qemu/module.h                  |  6 +++---
 qemu-options.hx                        |  4 ++--
 10 files changed, 34 insertions(+), 27 deletions(-)
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v5 1/4 docs: remove non-reference uses of single backticks

The single backtick markup in ReST is the "default role". Currently, Sphinx's default role is called "content". Sphinx suggests you can use the "Any" role instead to turn any single-backtick enclosed item into a cross-reference.

This is useful for things like autodoc for Python docstrings, where it's often nicer to reference other types with foo instead of the more laborious :py:meth:foo. It's also useful in multi-domain cases to easily reference definitions from other Sphinx domains, such as referencing C code definitions from outside of kerneldoc comments.

Before we do that, though, we'll need to turn all existing usages of the "content" role to inline verbatim markup wherever it does not correctly resolve into a cross-refernece by using double backticks instead.

---
 docs/devel/fuzzing.rst                 | 9 +++++----
 docs/devel/tcg-plugins.rst             | 2 +-
 docs/interop/live-block-operations.rst | 2 +-
 docs/system/guest-loader.rst           | 2 +-
 qapi/block-core.json                   | 4 ++--
 include/qemu/module.h                  | 6 +++---
 qemu-options.hx                        | 4 ++--
 7 files changed, 15 insertions(+), 14 deletions(-)
docs/devel/fuzzing.rst +5 -4
index 2749bb9bed..784ecb99e6 100644
@@ -182,10 +182,11 @@ The output should contain a complete list of matched MemoryRegions.
 
 OSS-Fuzz
 --------
-QEMU is continuously fuzzed on `OSS-Fuzz` __(https://github.com/google/oss-fuzz).
-By default, the OSS-Fuzz build will try to fuzz every fuzz-target. Since the
-generic-fuzz target requires additional information provided in environment
-variables, we pre-define some generic-fuzz configs in
+QEMU is continuously fuzzed on `OSS-Fuzz
+<https://github.com/google/oss-fuzz>`_.  By default, the OSS-Fuzz build
+will try to fuzz every fuzz-target. Since the generic-fuzz target
+requires additional information provided in environment variables, we
+pre-define some generic-fuzz configs in
 ``tests/qtest/fuzz/generic_fuzz_configs.h``. Each config must specify:
 
 - ``.name``: To identify the fuzzer config
docs/devel/tcg-plugins.rst +1 -1
index 842ae01a4c..72a1cd932c 100644
@@ -211,7 +211,7 @@ The hotpages plugin can be configured using the following arguments:
 
 This is an instruction classifier so can be used to count different
 types of instructions. It has a number of options to refine which get
-counted. You can give a value to the `count` argument for a class of
+counted. You can give a value to the ``count`` argument for a class of
 instructions to break it down fully, so for example to see all the system
 registers accesses::
 
docs/interop/live-block-operations.rst +1 -1
index 9e3635b233..814c29bbe1 100644
@@ -640,7 +640,7 @@ at this point:
         (QEMU) block-job-complete device=job0
 
 In either of the above cases, if you once again run the
-`query-block-jobs` command, there should not be any active block
+``query-block-jobs`` command, there should not be any active block
 operation.
 
 Comparing 'commit' and 'mirror': In both then cases, the overlay images
docs/system/guest-loader.rst +1 -1
index 4320d1183f..9ef9776bf0 100644
@@ -51,4 +51,4 @@ The full syntax of the guest-loader is::
 
 ``bootargs=<args>``
   This is an optional field for kernel blobs which will pass command
-  like via the `/chosen/module@<addr>/bootargs` node.
+  like via the ``/chosen/module@<addr>/bootargs`` node.
qapi/block-core.json +2 -2
index ce2c1352cb..96f4156890 100644
@@ -491,11 +491,11 @@
 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
 #
 # @recording: true if the bitmap is recording new writes from the guest.
-#             Replaces `active` and `disabled` statuses. (since 4.0)
+#             Replaces ``active`` and ``disabled`` statuses. (since 4.0)
 #
 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
 #        and cannot be modified via QMP or used by another operation.
-#        Replaces `locked` and `frozen` statuses. (since 4.0)
+#        Replaces ``locked`` and ``frozen`` statuses. (since 4.0)
 #
 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
 #              on disk, or both. (since 4.0)
include/qemu/module.h +3 -3
index 3deac0078b..5fcc323b2a 100644
@@ -77,14 +77,14 @@ void module_allow_arch(const char *arch);
 /**
  * DOC: module info annotation macros
  *
- * `scripts/modinfo-collect.py` will collect module info,
+ * ``scripts/modinfo-collect.py`` will collect module info,
  * using the preprocessor and -DQEMU_MODINFO.
  *
- * `scripts/modinfo-generate.py` will create a module meta-data database
+ * ``scripts/modinfo-generate.py`` will create a module meta-data database
  * from the collected information so qemu knows about module
  * dependencies and QOM objects implemented by modules.
  *
- * See `*.modinfo` and `modinfo.c` in the build directory to check the
+ * See ``*.modinfo`` and ``modinfo.c`` in the build directory to check the
  * script results.
  */
 #ifdef QEMU_MODINFO
qemu-options.hx +2 -2
index f051536b63..7749f59300 100644
@@ -1895,8 +1895,8 @@ SRST
         Valid parameters are:
 
         ``grab-mod=<mods>`` : Used to select the modifier keys for toggling
-        the mouse grabbing in conjunction with the "g" key. `<mods>` can be
-        either `lshift-lctrl-lalt` or `rctrl`.
+        the mouse grabbing in conjunction with the "g" key. ``<mods>`` can be
+        either ``lshift-lctrl-lalt`` or ``rctrl``.
 
         ``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing.
         This parameter is deprecated - use ``grab-mod`` instead.
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH v5 2/4 docs: (further) remove non-reference uses of single backticks

In reply to John Snow

The series rotted already. Here's the new changes.

---
 docs/system/i386/sgx.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
docs/system/i386/sgx.rst +3 -3
index f103ae2a2f..9aa161af1a 100644
@@ -77,9 +77,9 @@ CPUID
 
 Due to its myriad dependencies, SGX is currently not listed as supported
 in any of Qemu's built-in CPU configuration. To expose SGX (and SGX Launch
-Control) to a guest, you must either use `-cpu host` to pass-through the
+Control) to a guest, you must either use ``-cpu host`` to pass-through the
 host CPU model, or explicitly enable SGX when using a built-in CPU model,
-e.g. via `-cpu <model>,+sgx` or `-cpu <model>,+sgx,+sgxlc`.
+e.g. via ``-cpu <model>,+sgx`` or ``-cpu <model>,+sgx,+sgxlc``.
 
 All SGX sub-features enumerated through CPUID, e.g. SGX2, MISCSELECT,
 ATTRIBUTES, etc... can be restricted via CPUID flags. Be aware that enforcing
@@ -126,7 +126,7 @@ creating VM with SGX.
 Feature Control
 ~~~~~~~~~~~~~~~
 
-Qemu SGX updates the `etc/msr_feature_control` fw_cfg entry to set the SGX
+Qemu SGX updates the ``etc/msr_feature_control`` fw_cfg entry to set the SGX
 (bit 18) and SGX LC (bit 17) flags based on their respective CPUID support,
 i.e. existing guest firmware will automatically set SGX and SGX LC accordingly,
 assuming said firmware supports fw_cfg.msr_feature_control.
Signature · 1 line
2.31.1
Reviewed-by on v5 2/4
#3 lore raw

Re: [PATCH v5 2/4] docs: (further) remove non-reference uses of single backticks

Quoted 1 line · John Snow

The series rotted already. Here's the new changes.

Please change the patch description for the final commit (looks ugly in the git log otherwise)

Quoted 4 lines
---
  docs/system/i386/sgx.rst | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
author
#4 lore raw

PATCH v5 3/4 docs: (further further) remove non-reference uses of single backticks

In reply to John Snow
---
 docs/devel/build-system.rst | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
docs/devel/build-system.rst +11 -10
index 7f106d2f1c..48e56d7ea9 100644
@@ -47,16 +47,17 @@ command line options for which a same-named Meson option exists;
 dashes in the command line are replaced with underscores.
 
 Many checks on the compilation environment are still found in configure
-rather than `meson.build`, but new checks should be added directly to
-`meson.build`.
+rather than ``meson.build``, but new checks should be added directly to
+``meson.build``.
 
 Patches are also welcome to move existing checks from the configure
-phase to `meson.build`.  When doing so, ensure that `meson.build` does
-not use anymore the keys that you have removed from `config-host.mak`.
-Typically these will be replaced in `meson.build` by boolean variables,
-``get_option('optname')`` invocations, or `dep.found()` expressions.
-In general, the remaining checks have little or no interdependencies,
-so they can be moved one by one.
+phase to ``meson.build``.  When doing so, ensure that ``meson.build``
+does not use anymore the keys that you have removed from
+``config-host.mak``.  Typically these will be replaced in
+``meson.build`` by boolean variables, ``get_option('optname')``
+invocations, or ``dep.found()`` expressions.  In general, the remaining
+checks have little or no interdependencies, so they can be moved one by
+one.
 
 Helper functions
 ----------------
@@ -298,7 +299,7 @@ comprises the following tasks:
 
  - Add code to perform the actual feature check.
 
- - Add code to include the feature status in `config-host.h`
+ - Add code to include the feature status in ``config-host.h``
 
  - Add code to print out the feature status in the configure summary
    upon completion.
@@ -334,7 +335,7 @@ The other supporting code is generally simple::
 
 For the configure script to parse the new option, the
 ``scripts/meson-buildoptions.sh`` file must be up-to-date; ``make
-update-buildoptions`` (or just `make`) will take care of updating it.
+update-buildoptions`` (or just ``make``) will take care of updating it.
 
 
 Support scripts
Signature · 1 line
2.31.1
Reviewed-by on v5 3/4
#5 lore raw

Re: [PATCH v5 3/4] docs: (further further) remove non-reference uses of single backticks

Quoted 46 lines · John Snow
---
  docs/devel/build-system.rst | 21 +++++++++++----------
  1 file changed, 11 insertions(+), 10 deletions(-)
docs/devel/build-system.rst +10 -9
index 7f106d2f1c..48e56d7ea9 100644
@@ -47,16 +47,17 @@ command line options for which a same-named Meson option exists;
  dashes in the command line are replaced with underscores.
 
  Many checks on the compilation environment are still found in configure
-rather than `meson.build`, but new checks should be added directly to
-`meson.build`.
+rather than ``meson.build``, but new checks should be added directly to
+``meson.build``.
 
  Patches are also welcome to move existing checks from the configure
-phase to `meson.build`.  When doing so, ensure that `meson.build` does
-not use anymore the keys that you have removed from `config-host.mak`.
-Typically these will be replaced in `meson.build` by boolean variables,
-``get_option('optname')`` invocations, or `dep.found()` expressions.
-In general, the remaining checks have little or no interdependencies,
-so they can be moved one by one.
+phase to ``meson.build``.  When doing so, ensure that ``meson.build``
+does not use anymore the keys that you have removed from
+``config-host.mak``.  Typically these will be replaced in
+``meson.build`` by boolean variables, ``get_option('optname')``
+invocations, or ``dep.found()`` expressions.  In general, the remaining
+checks have little or no interdependencies, so they can be moved one by
+one.
 
  Helper functions
  ----------------
@@ -298,7 +299,7 @@ comprises the following tasks:
 
   - Add code to perform the actual feature check.
 
- - Add code to include the feature status in `config-host.h`
+ - Add code to include the feature status in ``config-host.h``
 
   - Add code to print out the feature status in the configure summary
     upon completion.

docs/devel/build-system.rst The other supporting code is generally simple:: · line 341

Quoted 8 lines
docs/devel/build-system.rst +1 -1
@@ -334,7 +335,7 @@ The other supporting code is generally simple::
 
  For the configure script to parse the new option, the
  ``scripts/meson-buildoptions.sh`` file must be up-to-date; ``make
-update-buildoptions`` (or just `make`) will take care of updating it.
+update-buildoptions`` (or just ``make``) will take care of updating it.
 
 
  Support scripts
author
#6 lore raw

PATCH v5 4/4 docs/sphinx: change default role to "any"

In reply to John Snow

This interprets single-backtick syntax in all of our Sphinx docs as a cross-reference to *something*, including Python symbols.

From here on out, new uses of backticks will cause a build failure if the target cannot be referenced.

---
 docs/conf.py | 5 +++++
 1 file changed, 5 insertions(+)
docs/conf.py +5 -0
index ff6e92c6e2..4d9f56601f 100644
@@ -85,6 +85,11 @@
 # The master toctree document.
 master_doc = 'index'
 
+# Interpret `single-backticks` to be a cross-reference to any kind of
+# referenceable object. Unresolvable or ambiguous references will emit a
+# warning at build time.
+default_role = 'any'
+
 # General information about the project.
 project = u'QEMU'
 copyright = u'2021, The QEMU Project Developers'
Signature · 1 line
2.31.1