[Spice-devel] [spice-protocol v2] macros: Mark unused SPICE_GNUC_XXX macros as deprecated
Christophe Fergeau
cfergeau at redhat.com
Wed Dec 14 16:59:49 UTC 2016
We don't want to maintain more macros than necessary and in the end
the equivalent G_GNUC_XXX macros should be preferred.
Should any project actually depend on these macros they can keep using
them by defining the usual SPICE_DEPRECATED macro until they migrate
away from them or the macros are reinstated.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
spice/macros.h | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/spice/macros.h b/spice/macros.h
index 1f8a5c8..a13f364 100644
--- a/spice/macros.h
+++ b/spice/macros.h
@@ -33,8 +33,14 @@
#include <spice/types.h>
+#ifndef SPICE_DEPRECATED
+#define SPICE_ATTRIBUTE_DEPRECATED(attribute) __attribute__((attribute, warning("deprecated, use -DSPICE_DEPRECATED or G_GNUC_CONST instead")))
+#else
+#define SPICE_ATTRIBUTE_DEPRECATED(attribute) __attribute__((attribute))
+#endif
+
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-#define SPICE_GNUC_PURE __attribute__((__pure__))
+#define SPICE_GNUC_PURE SPICE_ATTRIBUTE_DEPRECATED(__pure__)
#define SPICE_GNUC_MALLOC __attribute__((__malloc__))
#else
#define SPICE_GNUC_PURE
@@ -42,7 +48,7 @@
#endif
#if __GNUC__ >= 4
-#define SPICE_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#define SPICE_GNUC_NULL_TERMINATED SPICE_ATTRIBUTE_DEPRECATED(__sentinel__)
#else
#define SPICE_GNUC_NULL_TERMINATED
#endif
@@ -62,12 +68,12 @@
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define SPICE_GNUC_PRINTF( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
-#define SPICE_GNUC_SCANF( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
-#define SPICE_GNUC_FORMAT( arg_idx ) __attribute__((__format_arg__ (arg_idx)))
+#define SPICE_GNUC_SCANF( format_idx, arg_idx ) SPICE_ATTRIBUTE_DEPRECATED(__format__ (__scanf__, format_idx, arg_idx))
+#define SPICE_GNUC_FORMAT( arg_idx ) SPICE_ATTRIBUTE_DEPRECATED(__format_arg__ (arg_idx))
#define SPICE_GNUC_NORETURN __attribute__((__noreturn__))
-#define SPICE_GNUC_CONST __attribute__((__const__))
+#define SPICE_GNUC_CONST SPICE_ATTRIBUTE_DEPRECATED(__const__)
#define SPICE_GNUC_UNUSED __attribute__((__unused__))
-#define SPICE_GNUC_NO_INSTRUMENT __attribute__((__no_instrument_function__))
+#define SPICE_GNUC_NO_INSTRUMENT SPICE_ATTRIBUTE_DEPRECATED(__no_instrument_function__)
#else /* !__GNUC__ */
#define SPICE_GNUC_PRINTF( format_idx, arg_idx )
#define SPICE_GNUC_SCANF( format_idx, arg_idx )
--
2.9.3
More information about the Spice-devel
mailing list