mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
more 'static' adding in testcases
No dead code found this time...
This commit is contained in:
parent
b264fccd23
commit
38e8ecd62a
@ -55,6 +55,7 @@ test_local_cmdline (GApplication *application,
|
||||
typedef GApplication TestApplication;
|
||||
typedef GApplicationClass TestApplicationClass;
|
||||
|
||||
static GType test_application_get_type (void);
|
||||
G_DEFINE_TYPE (TestApplication, test_application, G_TYPE_APPLICATION)
|
||||
|
||||
static void
|
||||
@ -75,7 +76,7 @@ test_application_class_init (TestApplicationClass *class)
|
||||
G_APPLICATION_CLASS (class)->local_command_line = test_local_cmdline;
|
||||
}
|
||||
|
||||
GApplication *
|
||||
static GApplication *
|
||||
test_application_new (const gchar *application_id,
|
||||
GApplicationFlags flags)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ enum
|
||||
PROP_NAME
|
||||
};
|
||||
|
||||
static GType my_object_get_type (void);
|
||||
G_DEFINE_TYPE (MyObject, my_object, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
@ -120,7 +121,7 @@ my_object_class_init (MyObjectClass *class)
|
||||
}
|
||||
|
||||
/* A method that we want to export */
|
||||
void
|
||||
static void
|
||||
my_object_change_count (MyObject *myobj,
|
||||
gint change)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ test_unknown_key (void)
|
||||
/* Check that we get an error when the schema
|
||||
* has not been installed
|
||||
*/
|
||||
void
|
||||
static void
|
||||
test_no_schema (void)
|
||||
{
|
||||
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
|
||||
@ -355,7 +355,7 @@ changed_cb (GSettings *settings,
|
||||
|
||||
/* Test that basic change notification with the changed signal works.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
test_changes (void)
|
||||
{
|
||||
GSettings *settings;
|
||||
@ -401,7 +401,7 @@ changed_cb2 (GSettings *settings,
|
||||
* Also test that the has-unapplied property is properly
|
||||
* maintained.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
test_delay_apply (void)
|
||||
{
|
||||
GSettings *settings;
|
||||
@ -738,6 +738,7 @@ typedef struct
|
||||
GObjectClass parent_class;
|
||||
} TestObjectClass;
|
||||
|
||||
static GType test_object_get_type (void);
|
||||
G_DEFINE_TYPE (TestObject, test_object, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
|
@ -100,7 +100,7 @@ ask_password_with_getpass (GSimpleAsyncResult *res,
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
g_tls_console_interaction_ask_password_async (GTlsInteraction *interaction,
|
||||
GTlsPassword *password,
|
||||
GCancellable *cancellable,
|
||||
@ -117,7 +117,7 @@ g_tls_console_interaction_ask_password_async (GTlsInteraction *interaction,
|
||||
g_object_unref (res);
|
||||
}
|
||||
|
||||
GTlsInteractionResult
|
||||
static GTlsInteractionResult
|
||||
g_tls_console_interaction_ask_password_finish (GTlsInteraction *interaction,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
|
@ -37,6 +37,7 @@ typedef struct
|
||||
GIOStreamClass parent_class;
|
||||
} GTestIOStreamClass;
|
||||
|
||||
static GType g_test_io_stream_get_type (void);
|
||||
G_DEFINE_TYPE (GTestIOStream, g_test_io_stream, G_TYPE_IO_STREAM);
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ socket_address_to_string (GSocketAddress *address)
|
||||
return res;
|
||||
}
|
||||
|
||||
GSocketAddress *
|
||||
static GSocketAddress *
|
||||
socket_address_from_string (const char *name)
|
||||
{
|
||||
#ifdef G_OS_UNIX
|
||||
|
@ -56,6 +56,7 @@ typedef struct {
|
||||
GTlsInteractionClass parent;
|
||||
} TestInteractionClass;
|
||||
|
||||
static GType test_interaction_get_type (void);
|
||||
G_DEFINE_TYPE (TestInteraction, test_interaction, G_TYPE_TLS_INTERACTION);
|
||||
|
||||
#define TEST_TYPE_INTERACTION (test_interaction_get_type ())
|
||||
|
@ -25,6 +25,7 @@ enum
|
||||
PROP_SOURCE_TOGGLE
|
||||
};
|
||||
|
||||
static GType binding_source_get_type (void);
|
||||
G_DEFINE_TYPE (BindingSource, binding_source, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
@ -133,6 +134,7 @@ enum
|
||||
PROP_TARGET_TOGGLE
|
||||
};
|
||||
|
||||
static GType binding_target_get_type (void);
|
||||
G_DEFINE_TYPE (BindingTarget, binding_target, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
|
@ -36,6 +36,7 @@ my_boxed_free (gpointer orig)
|
||||
my_boxed_free_count++;
|
||||
}
|
||||
|
||||
static GType my_boxed_get_type (void);
|
||||
#define MY_TYPE_BOXED (my_boxed_get_type ())
|
||||
|
||||
G_DEFINE_BOXED_TYPE (MyBoxed, my_boxed, my_boxed_copy, my_boxed_free)
|
||||
|
@ -101,7 +101,7 @@ static GType test_module_get_type (void)
|
||||
}
|
||||
|
||||
|
||||
GTypeModule *
|
||||
static GTypeModule *
|
||||
test_module_new (TestModuleRegisterFunc register_func)
|
||||
{
|
||||
TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
|
||||
@ -129,6 +129,7 @@ struct _DynamicObjectClass
|
||||
guint val;
|
||||
};
|
||||
|
||||
static GType dynamic_object_get_type (void);
|
||||
G_DEFINE_DYNAMIC_TYPE(DynamicObject, dynamic_object, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
@ -250,8 +251,10 @@ struct _DynIfaceInterface
|
||||
|
||||
static void dyn_obj_iface_init (DynIfaceInterface *iface);
|
||||
|
||||
static GType dyn_iface_get_type (void);
|
||||
G_DEFINE_INTERFACE (DynIface, dyn_iface, G_TYPE_OBJECT)
|
||||
|
||||
static GType dyn_obj_get_type (void);
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED(DynObj, dyn_obj, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC(dyn_iface_get_type (), dyn_obj_iface_init))
|
||||
|
||||
|
@ -34,9 +34,9 @@
|
||||
* prop3: Defined in TestIface, Implemented in BaseObject, Overridden in DerivedObject
|
||||
* prop4: Defined in BaseObject, Overridden in DerivedObject
|
||||
*/
|
||||
|
||||
static GType base_object_get_type ();
|
||||
static GType derived_object_get_type ();
|
||||
|
||||
static GType base_object_get_type (void);
|
||||
static GType derived_object_get_type (void);
|
||||
|
||||
enum {
|
||||
BASE_PROP_0,
|
||||
@ -552,6 +552,7 @@ struct _Base2ObjectClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType base2_object_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_CODE (Base2Object, base2_object, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE,
|
||||
base2_object_test_iface_init))
|
||||
|
@ -17,6 +17,7 @@ enum { PROP_0, PROP_FOO, PROP_BAR, PROP_BAZ, N_PROPERTIES };
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
|
||||
static GType test_object_get_type (void);
|
||||
G_DEFINE_TYPE (TestObject, test_object, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
|
@ -74,6 +74,7 @@ struct _MyObjectClassPrivate
|
||||
gint secret_class_count;
|
||||
};
|
||||
|
||||
static GType my_object_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT,
|
||||
g_type_add_class_private (g_define_type_id, sizeof (MyObjectClassPrivate)) );
|
||||
|
||||
|
@ -12,7 +12,7 @@ typedef enum {
|
||||
TEST_UNSIGNED_ENUM_BAR = 0x80000000
|
||||
} TestUnsignedEnum;
|
||||
|
||||
GType
|
||||
static GType
|
||||
test_enum_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
@ -34,7 +34,7 @@ test_enum_get_type (void)
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
GType
|
||||
static GType
|
||||
test_unsigned_enum_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
@ -45,18 +45,22 @@ static void interface_per_class_init () { call_counter_init (NULL); }
|
||||
|
||||
/* define 3 test interfaces */
|
||||
typedef GTypeInterface MyFace0Interface;
|
||||
static GType my_face0_get_type (void);
|
||||
G_DEFINE_INTERFACE (MyFace0, my_face0, G_TYPE_OBJECT);
|
||||
static void my_face0_default_init (MyFace0Interface *iface) { call_counter_init (iface); }
|
||||
typedef GTypeInterface MyFace1Interface;
|
||||
static GType my_face1_get_type (void);
|
||||
G_DEFINE_INTERFACE (MyFace1, my_face1, G_TYPE_OBJECT);
|
||||
static void my_face1_default_init (MyFace1Interface *iface) { call_counter_init (iface); }
|
||||
typedef GTypeInterface MyFace2Interface;
|
||||
static GType my_face2_get_type (void);
|
||||
G_DEFINE_INTERFACE (MyFace2, my_face2, G_TYPE_OBJECT);
|
||||
static void my_face2_default_init (MyFace2Interface *iface) { call_counter_init (iface); }
|
||||
|
||||
/* define 3 test objects, adding interfaces 0 & 1, and adding interface 2 after class initialization */
|
||||
typedef GObject MyTester0;
|
||||
typedef GObjectClass MyTester0Class;
|
||||
static GType my_tester0_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_CODE (MyTester0, my_tester0, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (my_face0_get_type(), interface_per_class_init);
|
||||
G_IMPLEMENT_INTERFACE (my_face1_get_type(), interface_per_class_init);
|
||||
@ -65,6 +69,7 @@ static void my_tester0_init (MyTester0*t) {}
|
||||
static void my_tester0_class_init (MyTester0Class*c) { call_counter_init (c); }
|
||||
typedef GObject MyTester1;
|
||||
typedef GObjectClass MyTester1Class;
|
||||
static GType my_tester1_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_CODE (MyTester1, my_tester1, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (my_face0_get_type(), interface_per_class_init);
|
||||
G_IMPLEMENT_INTERFACE (my_face1_get_type(), interface_per_class_init);
|
||||
@ -73,6 +78,7 @@ static void my_tester1_init (MyTester1*t) {}
|
||||
static void my_tester1_class_init (MyTester1Class*c) { call_counter_init (c); }
|
||||
typedef GObject MyTester2;
|
||||
typedef GObjectClass MyTester2Class;
|
||||
static GType my_tester2_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_CODE (MyTester2, my_tester2, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (my_face0_get_type(), interface_per_class_init);
|
||||
G_IMPLEMENT_INTERFACE (my_face1_get_type(), interface_per_class_init);
|
||||
@ -133,6 +139,7 @@ typedef struct {
|
||||
char *name;
|
||||
} PropTester;
|
||||
typedef GObjectClass PropTesterClass;
|
||||
static GType prop_tester_get_type (void);
|
||||
G_DEFINE_TYPE (PropTester, prop_tester, G_TYPE_OBJECT);
|
||||
#define PROP_NAME 1
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user