リビジョン | 3918fe16b0f8c6657928a14f41b7ff50061e33e1 (tree) |
---|---|
日時 | 2022-01-19 01:42:42 |
作者 | Alex Bennée <alex.bennee@lina...> |
コミッター | Alex Bennée |
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>
@@ -151,6 +151,12 @@ If there are two versions of a function to be called with or without a | ||
151 | 151 | lock held, the function that expects the lock to be already held |
152 | 152 | usually uses the suffix ``_locked``. |
153 | 153 | |
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. | |
154 | 160 | |
155 | 161 | Block structure |
156 | 162 | =============== |
@@ -46,9 +46,9 @@ | ||
46 | 46 | * int g_foo(const char *wibble) |
47 | 47 | * |
48 | 48 | * 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. | |
50 | 50 | * |
51 | - * static inline void g_foo_qemu(const char *wibble) | |
51 | + * static inline void g_foo_compat(const char *wibble) | |
52 | 52 | * { |
53 | 53 | * #if GLIB_CHECK_VERSION(X, Y, 0) |
54 | 54 | * g_foo(wibble) |
@@ -61,7 +61,7 @@ | ||
61 | 61 | * ensuring this wrapper function impl doesn't trigger the compiler warning |
62 | 62 | * about using too new glib APIs. Finally we can do |
63 | 63 | * |
64 | - * #define g_foo(a) g_foo_qemu(a) | |
64 | + * #define g_foo(a) g_foo_compat(a) | |
65 | 65 | * |
66 | 66 | * So now the code elsewhere in QEMU, which *does* have the |
67 | 67 | * -Wdeprecated-declarations warning active, can call g_foo(...) as normal, |