Annotate various types and macros as deprecated

These have all been documented as deprecated for a long time, but we’ve
never had a way to programmatically mark them as deprecated. Do that
now.

This is based on the list of deprecations from the reverted commit
80fcb1bc2.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #638
This commit is contained in:
Philip Withnall 2019-05-27 19:50:09 +01:00
parent 1741fc2c6e
commit 40ff475977
24 changed files with 72 additions and 17 deletions

View File

@ -369,6 +369,7 @@ g_async_initable_new_async (GType object_type,
* Deprecated: 2.54: Use g_object_new_with_properties() and
* g_async_initable_init_async() instead. See #GParameter for more information.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void
g_async_initable_newv_async (GType object_type,
guint n_parameters,
@ -382,15 +383,14 @@ g_async_initable_newv_async (GType object_type,
g_return_if_fail (G_TYPE_IS_ASYNC_INITABLE (object_type));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
obj = g_object_newv (object_type, n_parameters, parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
g_async_initable_init_async (G_ASYNC_INITABLE (obj),
io_priority, cancellable,
callback, user_data);
g_object_unref (obj); /* Passed ownership to async call */
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_async_initable_new_valist_async:

View File

@ -95,6 +95,8 @@ void g_async_initable_new_async (GType object_type,
gpointer user_data,
const gchar *first_property_name,
...);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async)
void g_async_initable_newv_async (GType object_type,
guint n_parameters,
@ -103,6 +105,8 @@ void g_async_initable_newv_async (GType object_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_ALL
void g_async_initable_new_valist_async (GType object_type,
const gchar *first_property_name,

View File

@ -24,6 +24,10 @@
#include "config.h"
/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented
* in the preprocessor, we need to define this before including glib.h*/
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <errno.h>
#include <string.h>
#include <unistd.h>

View File

@ -638,6 +638,7 @@ g_dtls_connection_get_require_close_notify (GDtlsConnection *conn)
* required for compatibility. Also, rehandshaking has been removed
* from the TLS protocol in TLS 1.3.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void
g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
GTlsRehandshakeMode mode)
@ -648,6 +649,7 @@ g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
"rehandshake-mode", mode,
NULL);
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_dtls_connection_get_rehandshake_mode:
@ -660,6 +662,7 @@ g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
*
* Since: 2.48
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GTlsRehandshakeMode
g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn)
{
@ -672,6 +675,7 @@ g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn)
NULL);
return mode;
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_dtls_connection_handshake:

View File

@ -129,11 +129,13 @@ void g_dtls_connection_set_require_close_notify (GDtlsConnec
GLIB_AVAILABLE_IN_2_48
gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_60
void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
GTlsRehandshakeMode mode);
GLIB_DEPRECATED_IN_2_60
GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_2_48
gboolean g_dtls_connection_handshake (GDtlsConnection *conn,

View File

@ -187,6 +187,7 @@ g_initable_new (GType object_type,
* Deprecated: 2.54: Use g_object_new_with_properties() and
* g_initable_init() instead. See #GParameter for more information.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gpointer
g_initable_newv (GType object_type,
guint n_parameters,
@ -198,9 +199,7 @@ g_initable_newv (GType object_type,
g_return_val_if_fail (G_TYPE_IS_INITABLE (object_type), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
obj = g_object_newv (object_type, n_parameters, parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
if (!g_initable_init (G_INITABLE (obj), cancellable, error))
{
@ -210,6 +209,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
return (gpointer)obj;
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_initable_new_valist:

View File

@ -81,12 +81,15 @@ gpointer g_initable_new (GType object_type,
const gchar *first_property_name,
...);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_initable_init)
gpointer g_initable_newv (GType object_type,
guint n_parameters,
GParameter *parameters,
GCancellable *cancellable,
GError **error);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_ALL
GObject* g_initable_new_valist (GType object_type,
const gchar *first_property_name,

View File

@ -1628,7 +1628,7 @@ typedef enum {
G_TLS_REHANDSHAKE_NEVER,
G_TLS_REHANDSHAKE_SAFELY,
G_TLS_REHANDSHAKE_UNSAFELY
} GTlsRehandshakeMode;
} GTlsRehandshakeMode GLIB_DEPRECATED_TYPE_IN_2_60;
/**
* GTlsPasswordFlags:

View File

@ -754,6 +754,7 @@ g_tls_connection_get_require_close_notify (GTlsConnection *conn)
* required for compatibility. Also, rehandshaking has been removed
* from the TLS protocol in TLS 1.3.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void
g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
GTlsRehandshakeMode mode)
@ -764,6 +765,7 @@ g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
"rehandshake-mode", mode,
NULL);
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_tls_connection_get_rehandshake_mode:
@ -780,6 +782,7 @@ g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
* required for compatibility. Also, rehandshaking has been removed
* from the TLS protocol in TLS 1.3.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GTlsRehandshakeMode
g_tls_connection_get_rehandshake_mode (GTlsConnection *conn)
{
@ -792,6 +795,7 @@ g_tls_connection_get_rehandshake_mode (GTlsConnection *conn)
NULL);
return mode;
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_tls_connection_set_advertised_protocols:

View File

@ -109,11 +109,13 @@ void g_tls_connection_set_require_close_notify (GTlsConnecti
GLIB_AVAILABLE_IN_ALL
gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_60
void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
GTlsRehandshakeMode mode);
GLIB_DEPRECATED_IN_2_60
GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_2_60
void g_tls_connection_set_advertised_protocols (GTlsConnection *conn,

View File

@ -1397,7 +1397,9 @@ slab_allocator_free_chunk (gsize chunk_size,
*/
#if !(HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GTrashStack *compat_valloc_trash = NULL;
G_GNUC_END_IGNORE_DEPRECATIONS
#endif
static gpointer

View File

@ -3268,6 +3268,7 @@ wait_for_child (GPid pid,
* and is not always reliable due to problems inherent in
* fork-without-exec. Use g_test_trap_subprocess() instead.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gboolean
g_test_trap_fork (guint64 usec_timeout,
GTestTrapFlags test_trap_flags)
@ -3330,6 +3331,7 @@ g_test_trap_fork (guint64 usec_timeout,
return FALSE;
#endif
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_test_trap_subprocess:

View File

@ -356,7 +356,7 @@ void g_test_queue_destroy (GDestroyNotify destroy_func,
* Test traps are guards around forked tests.
* These flags determine what traps to set.
*
* Deprecated: #GTestTrapFlags is used only with g_test_trap_fork(),
* Deprecated: 2.38: #GTestTrapFlags is used only with g_test_trap_fork(),
* which is deprecated. g_test_trap_subprocess() uses
* #GTestSubprocessFlags.
*/
@ -364,11 +364,13 @@ typedef enum {
G_TEST_TRAP_SILENCE_STDOUT = 1 << 7,
G_TEST_TRAP_SILENCE_STDERR = 1 << 8,
G_TEST_TRAP_INHERIT_STDIN = 1 << 9
} GTestTrapFlags;
} GTestTrapFlags GLIB_DEPRECATED_TYPE_IN_2_38_FOR(GTestSubprocessFlags);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess)
gboolean g_test_trap_fork (guint64 usec_timeout,
GTestTrapFlags test_trap_flags);
G_GNUC_END_IGNORE_DEPRECATIONS
typedef enum {
G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0,

View File

@ -24,6 +24,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gtrashstack.h"
/**

View File

@ -33,11 +33,13 @@
G_BEGIN_DECLS
typedef struct _GTrashStack GTrashStack;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct _GTrashStack GTrashStack GLIB_DEPRECATED_TYPE_IN_2_48;
struct _GTrashStack
{
GTrashStack *next;
};
} GLIB_DEPRECATED_TYPE_IN_2_48;
GLIB_DEPRECATED_IN_2_48
void g_trash_stack_push (GTrashStack **stack_p,
@ -49,6 +51,8 @@ gpointer g_trash_stack_peek (GTrashStack **stack_p);
GLIB_DEPRECATED_IN_2_48
guint g_trash_stack_height (GTrashStack **stack_p);
G_GNUC_END_IGNORE_DEPRECATIONS
G_END_DECLS
#endif /* __G_TRASH_STACK_H_ */

View File

@ -2017,6 +2017,7 @@ g_object_new_with_properties (GType object_type,
* Deprecated: 2.54: Use g_object_new_with_properties() instead.
* deprecated. See #GParameter for more information.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gpointer
g_object_newv (GType object_type,
guint n_parameters,
@ -2068,6 +2069,7 @@ g_object_newv (GType object_type,
return object;
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_object_new_valist: (skip)

View File

@ -424,10 +424,14 @@ GObject* g_object_new_with_properties (GType object_type,
guint n_properties,
const char *names[],
const GValue values[]);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties)
gpointer g_object_newv (GType object_type,
guint n_parameters,
GParameter *parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_ALL
GObject* g_object_new_valist (GType object_type,
const gchar *first_property_name,

View File

@ -191,7 +191,7 @@ typedef enum
/* --- typedefs & structures --- */
typedef struct _GParamSpec GParamSpec;
typedef struct _GParamSpecClass GParamSpecClass;
typedef struct _GParameter GParameter;
typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54;
typedef struct _GParamSpecPool GParamSpecPool;
/**
* GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param)
@ -272,7 +272,7 @@ struct _GParameter /* auxiliary structure for _setv() variants */
{
const gchar *name;
GValue value;
};
} GLIB_DEPRECATED_TYPE_IN_2_54;
/* --- prototypes --- */

View File

@ -452,7 +452,7 @@ G_BEGIN_DECLS
*
* Deprecated: 2.32: Use #GArray instead of #GValueArray
*/
#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18])
#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) GLIB_DEPRECATED_MACRO_IN_2_32
/**
* G_IS_PARAM_SPEC_VALUE_ARRAY:
* @pspec: a valid #GParamSpec instance
@ -463,7 +463,7 @@ G_BEGIN_DECLS
*
* Deprecated: 2.32: Use #GArray instead of #GValueArray
*/
#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)) GLIB_DEPRECATED_MACRO_IN_2_32
/**
* G_PARAM_SPEC_VALUE_ARRAY:
* @pspec: a valid #GParamSpec instance
@ -472,7 +472,7 @@ G_BEGIN_DECLS
*
* Deprecated: 2.32: Use #GArray instead of #GValueArray
*/
#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)) GLIB_DEPRECATED_MACRO_IN_2_32
/**
* G_TYPE_PARAM_OBJECT:

View File

@ -44,7 +44,9 @@ G_STMT_START { \
G_BEGIN_DECLS
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
extern GTypeDebugFlags _g_type_debug_flags;
G_GNUC_END_IGNORE_DEPRECATIONS
typedef struct _GRealClosure GRealClosure;
struct _GRealClosure

View File

@ -380,7 +380,10 @@ static GQuark static_quark_type_flags = 0;
static GQuark static_quark_iface_holder = 0;
static GQuark static_quark_dependants_array = 0;
static guint type_registration_serial = 0;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GTypeDebugFlags _g_type_debug_flags = 0;
G_GNUC_END_IGNORE_DEPRECATIONS
/* --- type nodes --- */
static GHashTable *static_type_nodes_ht = NULL;
@ -4332,6 +4335,7 @@ _g_type_boxed_init (GType type,
*
* Deprecated: 2.36: the type system is now initialised automatically
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void
g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
{
@ -4340,6 +4344,7 @@ g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
if (debug_flags)
g_message ("g_type_init_with_debug_flags() is no longer supported. Use the GOBJECT_DEBUG environment variable.");
}
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* g_type_init:

View File

@ -638,7 +638,7 @@ struct _GTypeQuery
* `your_type_get_instance_private()` function instead
* 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))) GLIB_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE)
/**
* G_TYPE_CLASS_GET_PRIVATE:
@ -680,14 +680,17 @@ typedef enum /*< skip >*/
G_TYPE_DEBUG_SIGNALS = 1 << 1,
G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
G_TYPE_DEBUG_MASK = 0x07
} GTypeDebugFlags;
} GTypeDebugFlags GLIB_DEPRECATED_TYPE_IN_2_36;
/* --- prototypes --- */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GLIB_DEPRECATED_IN_2_36
void g_type_init (void);
GLIB_DEPRECATED_IN_2_36
void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);
G_GNUC_END_IGNORE_DEPRECATIONS
GLIB_AVAILABLE_IN_ALL
const gchar * g_type_name (GType type);
GLIB_AVAILABLE_IN_ALL

View File

@ -35,7 +35,7 @@ G_BEGIN_DECLS
*
* Deprecated: 2.32: Use #GArray instead of #GValueArray
*/
#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_TYPE_ARRAY)
/* --- typedefs & structs --- */
typedef struct _GValueArray GValueArray;

View File

@ -1,3 +1,6 @@
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib-object.h>
typedef struct {