[sysprof: 31/63] libsysprof-capture: Rework version macros to drop GLib dependency
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof: 31/63] libsysprof-capture: Rework version macros to drop GLib dependency
- Date: Sat, 4 Jul 2020 18:31:56 +0000 (UTC)
commit 284b5fd7cffc5af758aa82588d054baf8841a45b
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jul 2 10:56:58 2020 +0100
libsysprof-capture: Rework version macros to drop GLib dependency
They’re equivalent, using deprecation markers suitable for modern
compilers.
Signed-off-by: Philip Withnall <withnall endlessm com>
Helps: #40
src/libsysprof-capture/sysprof-version-macros.h | 38 +++++++++++++++++--------
1 file changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/libsysprof-capture/sysprof-version-macros.h b/src/libsysprof-capture/sysprof-version-macros.h
index 8fa1df6..8152735 100644
--- a/src/libsysprof-capture/sysprof-version-macros.h
+++ b/src/libsysprof-capture/sysprof-version-macros.h
@@ -64,34 +64,48 @@
#define _SYSPROF_EXTERN extern
#endif
+#if defined(__GNUC__) || defined (__clang__)
+#define _SYSPROF_DEPRECATED __attribute__((__deprecated__))
+#define _SYSPROF_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
+#define _SYSPROF_UNAVAILABLE(maj,min) __attribute__((__deprecated__("Not available before " #maj "." #min)))
+#elif defined(_MSC_VER)
+#define _SYSPROF_DEPRECATED __declspec(deprecated)
+#define _SYSPROF_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
+#define _SYSPROF_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min))
+#else
+#define _SYSPROF_DEPRECATED
+#define _SYSPROF_DEPRECATED_FOR(f)
+#define _SYSPROF_UNAVAILABLE(maj,min)
+#endif
+
#ifdef SYSPROF_DISABLE_DEPRECATION_WARNINGS
#define SYSPROF_DEPRECATED _SYSPROF_EXTERN
#define SYSPROF_DEPRECATED_FOR(f) _SYSPROF_EXTERN
#define SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
#else
-#define SYSPROF_DEPRECATED G_DEPRECATED _SYSPROF_EXTERN
-#define SYSPROF_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _SYSPROF_EXTERN
-#define SYSPROF_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
+#define SYSPROF_DEPRECATED _SYSPROF_DEPRECATED _SYSPROF_EXTERN
+#define SYSPROF_DEPRECATED_FOR(f) _SYSPROF_DEPRECATED_FOR(f) _SYSPROF_EXTERN
+#define SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
#endif
-#define SYSPROF_VERSION_3_34 (G_ENCODE_VERSION (3, 34))
-#define SYSPROF_VERSION_3_36 (G_ENCODE_VERSION (3, 36))
-#define SYSPROF_VERSION_3_38 (G_ENCODE_VERSION (3, 38))
+#define SYSPROF_VERSION_3_34 (SYSPROF_ENCODE_VERSION (3, 34, 0))
+#define SYSPROF_VERSION_3_36 (SYSPROF_ENCODE_VERSION (3, 36, 0))
+#define SYSPROF_VERSION_3_38 (SYSPROF_ENCODE_VERSION (3, 38, 0))
#if (SYSPROF_MINOR_VERSION == 99)
-# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0))
+# define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0, 0))
#elif (SYSPROF_MINOR_VERSION % 2)
-# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION + 1))
+# define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION +
1, 0))
#else
-# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION))
+# define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION,
0))
#endif
#if (SYSPROF_MINOR_VERSION == 99)
-# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0))
+# define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0, 0))
#elif (SYSPROF_MINOR_VERSION % 2)
-# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 1))
+# define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION -
1, 0))
#else
-# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 2))
+# define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION -
2, 0))
#endif
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]