[Spice-devel] [protocol] macros: Update SPICE_GNUC_DEPRECATED for MSVC
Francois Gouget
fgouget at codeweavers.com
Fri Oct 28 09:57:33 UTC 2016
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
This is an alternative take on the previous patch: instead of reusing
the GLib macro it just duplicates its logic.
GLib approach
-------------
Pros: - Automatic support for whichever platforms GLib supports.
- Simple.
Cons: - If the project uses GLib it might as well use the GLib macros
directly.
This approach
-------------
Pros: - Support for non-gcc compilers is available even if the project
does not use GLib.
Cons: - Duplicates GLib's code.
As before the same treatment could be applied to a bunch of other
macros.
spice/macros.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/spice/macros.h b/spice/macros.h
index a0413f3..0df3da4 100644
--- a/spice/macros.h
+++ b/spice/macros.h
@@ -80,6 +80,8 @@
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__))
+#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+#define SPICE_GNUC_DEPRECATED __declspec(deprecated)
#else
#define SPICE_GNUC_DEPRECATED
#endif /* __GNUC__ */
--
2.9.3
More information about the Spice-devel
mailing list