• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión3918fe16b0f8c6657928a14f41b7ff50061e33e1 (tree)
Tiempo2022-01-19 01:42:42
AutorAlex Bennée <alex.bennee@lina...>
CommiterAlex Bennée

Log Message

docs/devel: more documentation on the use of suffixes

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: <20220105135009.1584676-25-alex.bennee@linaro.org>

Cambiar Resumen

Diferencia incremental

--- 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
151151 lock held, the function that expects the lock to be already held
152152 usually uses the suffix ``_locked``.
153153
154+If a function is a shim designed to deal with compatibility
155+workarounds we use the suffix ``_compat``. These are generally not
156+called directly and aliased to the plain function name via the
157+pre-processor. Another common suffix is ``_impl``; it is used for the
158+concrete implementation of a function that will not be called
159+directly, but rather through a macro or an inline function.
154160
155161 Block structure
156162 ===============
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -46,9 +46,9 @@
4646 * int g_foo(const char *wibble)
4747 *
4848 * We must define a static inline function with the same signature that does
49- * what we need, but with a "_qemu" suffix e.g.
49+ * what we need, but with a "_compat" suffix e.g.
5050 *
51- * static inline void g_foo_qemu(const char *wibble)
51+ * static inline void g_foo_compat(const char *wibble)
5252 * {
5353 * #if GLIB_CHECK_VERSION(X, Y, 0)
5454 * g_foo(wibble)
@@ -61,7 +61,7 @@
6161 * ensuring this wrapper function impl doesn't trigger the compiler warning
6262 * about using too new glib APIs. Finally we can do
6363 *
64- * #define g_foo(a) g_foo_qemu(a)
64+ * #define g_foo(a) g_foo_compat(a)
6565 *
6666 * So now the code elsewhere in QEMU, which *does* have the
6767 * -Wdeprecated-declarations warning active, can call g_foo(...) as normal,