headers: Add various missing G_DISABLE_DEPRECATED guards

As pointed out by gtk-doc, these are all symbols which have been marked
as deprecated, but which aren’t protected by a deprecation guard. We
can’t use G_DEPRECATED_IN_* for them, as they are all non-function
symbols. Instead, wrap them in #ifndef G_DISABLE_DEPRECATED.

In some cases, we also need to wrap one or two functions which use the
deprecated types in G_DISABLE_DEPRECATED too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-03-07 17:25:55 +00:00
parent 9e56d39bb4
commit 80fcb1bc26
13 changed files with 48 additions and 3 deletions

View File

@ -129,11 +129,13 @@ void g_dtls_connection_set_require_close_notify (GDtlsConnec
GLIB_AVAILABLE_IN_2_48 GLIB_AVAILABLE_IN_2_48
gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn); gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn);
#ifndef G_DISABLE_DEPRECATED
GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED_IN_2_60
void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
GTlsRehandshakeMode mode); GTlsRehandshakeMode mode);
GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED_IN_2_60
GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn); GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn);
#endif /* !G_DISABLE_DEPRECATED */
GLIB_AVAILABLE_IN_2_48 GLIB_AVAILABLE_IN_2_48
gboolean g_dtls_connection_handshake (GDtlsConnection *conn, gboolean g_dtls_connection_handshake (GDtlsConnection *conn,

View File

@ -1603,6 +1603,7 @@ typedef enum {
G_TLS_AUTHENTICATION_REQUIRED G_TLS_AUTHENTICATION_REQUIRED
} GTlsAuthenticationMode; } GTlsAuthenticationMode;
#ifndef G_DISABLE_DEPRECATED
/** /**
* GTlsRehandshakeMode: * GTlsRehandshakeMode:
* @G_TLS_REHANDSHAKE_NEVER: Never allow rehandshaking * @G_TLS_REHANDSHAKE_NEVER: Never allow rehandshaking
@ -1623,6 +1624,7 @@ typedef enum {
G_TLS_REHANDSHAKE_SAFELY, G_TLS_REHANDSHAKE_SAFELY,
G_TLS_REHANDSHAKE_UNSAFELY G_TLS_REHANDSHAKE_UNSAFELY
} GTlsRehandshakeMode; } GTlsRehandshakeMode;
#endif /* !G_DISABLE_DEPRECATED */
/** /**
* GTlsPasswordFlags: * GTlsPasswordFlags:

View File

@ -92,9 +92,12 @@ gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResul
#ifndef G_DISABLE_DEPRECATED
GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */ GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple, void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
GCancellable *check_cancellable); GCancellable *check_cancellable);
#endif /* !G_DISABLE_DEPRECATED */
GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED_IN_2_46
gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple); gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED_IN_2_46

View File

@ -109,11 +109,13 @@ void g_tls_connection_set_require_close_notify (GTlsConnecti
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn); gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn);
#ifndef G_DISABLE_DEPRECATED
GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED_IN_2_60
void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
GTlsRehandshakeMode mode); GTlsRehandshakeMode mode);
GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED_IN_2_60
GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn); GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn);
#endif /* !G_DISABLE_DEPRECATED */
GLIB_AVAILABLE_IN_2_60 GLIB_AVAILABLE_IN_2_60
void g_tls_connection_set_advertised_protocols (GTlsConnection *conn, void g_tls_connection_set_advertised_protocols (GTlsConnection *conn,

View File

@ -97,6 +97,9 @@
* Deprecated:2.32:POSIX threads are in use on all non-Windows systems. * Deprecated:2.32:POSIX threads are in use on all non-Windows systems.
* Use G_OS_WIN32 to detect Windows. * Use G_OS_WIN32 to detect Windows.
*/ */
#ifdef G_DISABLE_DEPRECATED
#undef G_THREADS_IMPL_POSIX
#endif
/** /**
* G_THREADS_IMPL_WIN32: * G_THREADS_IMPL_WIN32:
@ -105,7 +108,9 @@
* *
* Deprecated:2.32:Use G_OS_WIN32 to detect Windows. * Deprecated:2.32:Use G_OS_WIN32 to detect Windows.
*/ */
#ifdef G_DISABLE_DEPRECATED
#undef G_THREADS_IMPL_WIN32
#endif
/* {{{1 Exported Variables */ /* {{{1 Exported Variables */

View File

@ -82,6 +82,7 @@
#undef G_INLINE_DEFINE_NEEDED #undef G_INLINE_DEFINE_NEEDED
#ifndef G_DISABLE_DEPRECATED
/* For historical reasons we need to continue to support those who /* For historical reasons we need to continue to support those who
* define G_IMPLEMENT_INLINES to mean "don't implement this here". * define G_IMPLEMENT_INLINES to mean "don't implement this here".
*/ */
@ -91,6 +92,7 @@
#else #else
# define G_INLINE_FUNC static inline # define G_INLINE_FUNC static inline
#endif /* G_IMPLEMENT_INLINES */ #endif /* G_IMPLEMENT_INLINES */
#endif /* !G_DISABLE_DEPRECATED */
/* Provide macros to feature the GCC function attribute. /* Provide macros to feature the GCC function attribute.
*/ */

View File

@ -381,7 +381,10 @@ GLIB_VAR gboolean g_mem_gc_friendly;
/* Memory profiler and checker, has to be enabled via g_mem_set_vtable() /* Memory profiler and checker, has to be enabled via g_mem_set_vtable()
*/ */
#ifndef G_DISABLE_DEPRECATED
GLIB_VAR GMemVTable *glib_mem_profiler_table; GLIB_VAR GMemVTable *glib_mem_profiler_table;
#endif
GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED_IN_2_46
void g_mem_profile (void); void g_mem_profile (void);

View File

@ -337,6 +337,7 @@ void g_test_queue_destroy (GDestroyNotify destroy_func,
gpointer destroy_data); gpointer destroy_data);
#define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject) #define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject)
#ifndef G_DISABLE_DEPRECATED
typedef enum { typedef enum {
G_TEST_TRAP_SILENCE_STDOUT = 1 << 7, G_TEST_TRAP_SILENCE_STDOUT = 1 << 7,
G_TEST_TRAP_SILENCE_STDERR = 1 << 8, G_TEST_TRAP_SILENCE_STDERR = 1 << 8,
@ -346,6 +347,7 @@ typedef enum {
GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess) GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess)
gboolean g_test_trap_fork (guint64 usec_timeout, gboolean g_test_trap_fork (guint64 usec_timeout,
GTestTrapFlags test_trap_flags); GTestTrapFlags test_trap_flags);
#endif /* !G_DISABLE_DEPRECATED */
typedef enum { typedef enum {
G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0, G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0,

View File

@ -33,6 +33,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#ifndef G_DISABLE_DEPRECATED
typedef struct _GTrashStack GTrashStack; typedef struct _GTrashStack GTrashStack;
struct _GTrashStack struct _GTrashStack
{ {
@ -49,6 +51,8 @@ gpointer g_trash_stack_peek (GTrashStack **stack_p);
GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED_IN_2_48
guint g_trash_stack_height (GTrashStack **stack_p); guint g_trash_stack_height (GTrashStack **stack_p);
#endif /* !G_DISABLE_DEPRECATED */
G_END_DECLS G_END_DECLS
#endif /* __G_TRASH_STACK_H_ */ #endif /* __G_TRASH_STACK_H_ */

View File

@ -260,6 +260,8 @@ struct _GParamSpecClass
/*< private >*/ /*< private >*/
gpointer dummy[4]; gpointer dummy[4];
}; };
#ifndef G_DISABLE_DEPRECATED
/** /**
* GParameter: * GParameter:
* @name: the parameter name * @name: the parameter name
@ -275,7 +277,7 @@ struct _GParameter /* auxiliary structure for _setv() variants */
const gchar *name; const gchar *name;
GValue value; GValue value;
}; };
#endif /* !G_DISABLE_DEPRECATED */
/* --- prototypes --- */ /* --- prototypes --- */
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL

View File

@ -452,7 +452,10 @@ G_BEGIN_DECLS
* *
* Deprecated: 2.32: Use #GArray instead of #GValueArray * Deprecated: 2.32: Use #GArray instead of #GValueArray
*/ */
#ifndef G_DISABLE_DEPRECATED
#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) #define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18])
#endif
/** /**
* G_IS_PARAM_SPEC_VALUE_ARRAY: * G_IS_PARAM_SPEC_VALUE_ARRAY:
* @pspec: a valid #GParamSpec instance * @pspec: a valid #GParamSpec instance
@ -463,7 +466,10 @@ G_BEGIN_DECLS
* *
* Deprecated: 2.32: Use #GArray instead of #GValueArray * Deprecated: 2.32: Use #GArray instead of #GValueArray
*/ */
#ifndef G_DISABLE_DEPRECATED
#define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY)) #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
#endif
/** /**
* G_PARAM_SPEC_VALUE_ARRAY: * G_PARAM_SPEC_VALUE_ARRAY:
* @pspec: a valid #GParamSpec instance * @pspec: a valid #GParamSpec instance
@ -472,7 +478,9 @@ G_BEGIN_DECLS
* *
* Deprecated: 2.32: Use #GArray instead of #GValueArray * Deprecated: 2.32: Use #GArray instead of #GValueArray
*/ */
#ifndef G_DISABLE_DEPRECATED
#define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray)) #define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
#endif
/** /**
* G_TYPE_PARAM_OBJECT: * G_TYPE_PARAM_OBJECT:

View File

@ -621,6 +621,7 @@ struct _GTypeQuery
*/ */
#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type) #define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type)
#ifndef G_DISABLE_DEPRECATED
/** /**
* G_TYPE_INSTANCE_GET_PRIVATE: * G_TYPE_INSTANCE_GET_PRIVATE:
* @instance: the instance of a type deriving from @private_type * @instance: the instance of a type deriving from @private_type
@ -639,6 +640,7 @@ struct _GTypeQuery
* Returns: (not nullable): a pointer to the private data structure * Returns: (not nullable): a pointer to the private data structure
*/ */
#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) #define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))
#endif /* !G_DISABLE_DEPRECATED */
/** /**
* G_TYPE_CLASS_GET_PRIVATE: * G_TYPE_CLASS_GET_PRIVATE:
@ -657,6 +659,7 @@ struct _GTypeQuery
*/ */
#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type))) #define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type)))
#ifndef G_DISABLE_DEPRECATED
/** /**
* GTypeDebugFlags: * GTypeDebugFlags:
* @G_TYPE_DEBUG_NONE: Print no messages * @G_TYPE_DEBUG_NONE: Print no messages
@ -681,13 +684,17 @@ typedef enum /*< skip >*/
G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2, G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
G_TYPE_DEBUG_MASK = 0x07 G_TYPE_DEBUG_MASK = 0x07
} GTypeDebugFlags; } GTypeDebugFlags;
#endif /* !G_DISABLE_DEPRECATED */
/* --- prototypes --- */ /* --- prototypes --- */
GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED_IN_2_36
void g_type_init (void); void g_type_init (void);
#ifndef G_DISABLE_DEPRECATED
GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED_IN_2_36
void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags); void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);
#endif
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
const gchar * g_type_name (GType type); const gchar * g_type_name (GType type);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL

View File

@ -27,6 +27,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#ifndef G_DISABLE_DEPRECATED
/** /**
* G_TYPE_VALUE_ARRAY: * G_TYPE_VALUE_ARRAY:
* *
@ -98,6 +100,7 @@ GValueArray* g_value_array_sort_with_data (GValueArray *value_array,
GCompareDataFunc compare_func, GCompareDataFunc compare_func,
gpointer user_data); gpointer user_data);
#endif /* !G_DISABLE_DEPRECATED */
G_END_DECLS G_END_DECLS