[libsoup/ebassi/deprecated-symbol-macros: 1/2] Add own wrappers for deprecation macros




commit e3bedf0655c3e1e4c457cc13f244da59eb6fc81f
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Aug 13 23:11:41 2022 +0100

    Add own wrappers for deprecation macros
    
    We need to ensure that deprecated and unavailable symbols are still
    exported, so we should use our own symbol.
    
    While at it, the deprecation warnings should be toggleable.

 libsoup/soup-version.h.in | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
---
diff --git a/libsoup/soup-version.h.in b/libsoup/soup-version.h.in
index 557bf95f..cc8235d7 100644
--- a/libsoup/soup-version.h.in
+++ b/libsoup/soup-version.h.in
@@ -91,6 +91,52 @@ G_BEGIN_DECLS
 #error "SOUP_VERSION_MIN_REQUIRED must be >= SOUP_VERSION_3_0"
 #endif
 
+/**
+ * SOUP_DISABLE_DEPRECATION_WARNINGS:
+ *
+ * A macro that should be defined before including the `soup.h` header.
+ *
+ * If this symbol is defined, no compiler warnings will be produced for
+ * uses of deprecated libsoup APIs.
+ */
+
+/**
+ * SOUP_DEPRECATED:
+ *
+ * Marks a symbol as deprecated.
+ *
+ * You should use `SOUP_DEPRECATED_IN_*` in order to handle versioning.
+ */
+
+/**
+ * SOUP_DEPRECATED_FOR:
+ * @f: the symbol that replaces the deprecated one
+ *
+ * Marks a symbol as deprecated in favor of another symbol.
+ *
+ * You should use `SOUP_DEPRECATED_FOR_IN_*` in order to handle versioning.
+ */
+
+/**
+ * SOUP_UNAVAILABLE
+ * @maj: the major version that introduced the symbol
+ * @min: the minor version that introduced the symbol
+ *
+ * Marks a symbol unavailable before the given major and minor version.
+ *
+ * You should use `SOUP_AVAILABLE_IN_*` in order to handle versioning.
+ */
+
+#ifdef SOUP_DISABLE_DEPRECATION_WARNINGS
+#define SOUP_DEPRECATED _SOUP_EXTERN
+#define SOUP_DEPRECATED_FOR(f) _SOUP_EXTERN
+#define SOUP_UNAVAILABLE(maj,min) _SOUP_EXTERN
+#else
+#define SOUP_DEPRECATED G_DEPRECATED _SOUP_EXTERN
+#define SOUP_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _SOUP_EXTERN
+#define SOUP_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _SOUP_EXTERN
+#endif
+
 #define SOUP_AVAILABLE_IN_ALL                   _SOUP_EXTERN
 
 {version_attributes}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]