[Spice-devel] [protocol] macros: Use GLib's G_DEPRECATED macro if available
Francois Gouget
fgouget at codeweavers.com
Fri Oct 28 09:27:02 UTC 2016
This gains us automatic support for whichever compilers GLib supports in
this macro when used in projects that use GLib.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
This can make sense if we consider GLib to be a platform similar to gcc,
MSVC: it just provides a G_XXX API instead of an __attribute((xxx)) or
__declspec(xxx) one.
Also note that the same thing could be done with a number of other
macros like SPICE_GNUC_WARN_UNUSED_RESULT, SPICE_GNUC_MAY_ALIAS,
SPICE_GNUC_CONST, etc. Let me know if I should submit one patch for
each, one for all or something else...
spice/macros.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/spice/macros.h b/spice/macros.h
index a0413f3..42916b9 100644
--- a/spice/macros.h
+++ b/spice/macros.h
@@ -78,7 +78,9 @@
#define SPICE_GNUC_NO_INSTRUMENT
#endif /* !__GNUC__ */
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+#ifdef G_DEPRECATED
+#define SPICE_GNUC_DEPRECATED G_DEPRECATED
+#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__))
#else
#define SPICE_GNUC_DEPRECATED
--
2.9.3
More information about the Spice-devel
mailing list