[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 24/34] docs/devel: more documentation on the use of suffixes
|
From: |
Alex Bennée |
|
Subject: |
[PATCH v1 24/34] docs/devel: more documentation on the use of suffixes |
|
Date: |
Wed, 5 Jan 2022 13:49:59 +0000 |
Using _qemu is a little confusing. Let's use _compat for these sorts
of things. We should also mention _impl which is another common suffix
in the code base.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211217171902.2668674-1-alex.bennee@linaro.org>
---
v2
- use Paolo's suggested wording for _impl
---
docs/devel/style.rst | 6 ++++++
include/glib-compat.h | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index 4f770002a7..793a8d4280 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -151,6 +151,12 @@ If there are two versions of a function to be called with
or without a
lock held, the function that expects the lock to be already held
usually uses the suffix ``_locked``.
+If a function is a shim designed to deal with compatibility
+workarounds we use the suffix ``_compat``. These are generally not
+called directly and aliased to the plain function name via the
+pre-processor. Another common suffix is ``_impl``; it is used for the
+concrete implementation of a function that will not be called
+directly, but rather through a macro or an inline function.
Block structure
===============
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8d01a8c01f..3113a7d2af 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -46,9 +46,9 @@
* int g_foo(const char *wibble)
*
* We must define a static inline function with the same signature that does
- * what we need, but with a "_qemu" suffix e.g.
+ * what we need, but with a "_compat" suffix e.g.
*
- * static inline void g_foo_qemu(const char *wibble)
+ * static inline void g_foo_compat(const char *wibble)
* {
* #if GLIB_CHECK_VERSION(X, Y, 0)
* g_foo(wibble)
@@ -61,7 +61,7 @@
* ensuring this wrapper function impl doesn't trigger the compiler warning
* about using too new glib APIs. Finally we can do
*
- * #define g_foo(a) g_foo_qemu(a)
+ * #define g_foo(a) g_foo_compat(a)
*
* So now the code elsewhere in QEMU, which *does* have the
* -Wdeprecated-declarations warning active, can call g_foo(...) as normal,
--
2.30.2
- [PATCH v1 27/34] tests/avocado: add :avocado: tags for some tests, (continued)
- [PATCH v1 27/34] tests/avocado: add :avocado: tags for some tests, Alex Bennée, 2022/01/05
- [PATCH v1 12/34] tests/docker: auto-generate opensuse-leap.docker with lcitool, Alex Bennée, 2022/01/05
- [PATCH v1 28/34] tests/tcg/multiarch: Read fp flags before printf, Alex Bennée, 2022/01/05
- [PATCH v1 33/34] docker: include bison in debian-tricore-cross, Alex Bennée, 2022/01/05
- [PATCH v1 31/34] docs/sphinx: fix compatibility with sphinx < 1.8, Alex Bennée, 2022/01/05
- [PATCH v1 23/34] docs/devel: update C standard to C11, Alex Bennée, 2022/01/05
- [PATCH v1 14/34] .gitlab-ci.d/cirrus: auto-generate variables with lcitool, Alex Bennée, 2022/01/05
- [PATCH v1 24/34] docs/devel: more documentation on the use of suffixes,
Alex Bennée <=
- [PATCH v1 29/34] test/tcg/ppc64le: Add float reference files, Alex Bennée, 2022/01/05
- [PATCH v1 30/34] FreeBSD: Upgrade to 12.3 release, Alex Bennée, 2022/01/05
- [PATCH v1 34/34] linux-user: Remove the deprecated ppc64abi32 target, Alex Bennée, 2022/01/05
- [PATCH v1 10/34] tests/docker: auto-generate ubuntu1804.docker with lcitool, Alex Bennée, 2022/01/05
- [PATCH v1 32/34] gitlab-ci: Enable docs in the centos job, Alex Bennée, 2022/01/05
- [PATCH v1 21/34] hw/arm: add control knob to disable kaslr_seed via DTB, Alex Bennée, 2022/01/05
- [PATCH v1 20/34] tests/docker: add libfuse3 development headers, Alex Bennée, 2022/01/05