From 7553649c47ed84441e52e3b90f0df4dee527bc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 7 Mar 2020 15:16:36 +0100 Subject: [PATCH] testsuite/gtk: Add common_cflags to build With a few exceptions. --- testsuite/gtk/builder.c | 6 +++--- testsuite/gtk/check-icon-names.c | 2 +- testsuite/gtk/meson.build | 6 ++++++ testsuite/gtk/rbtree.c | 2 ++ testsuite/gtk/recentmanager.c | 30 +++++++++++++++--------------- testsuite/gtk/revealer-size.c | 24 ++++++++++++------------ testsuite/gtk/textiter.c | 2 +- testsuite/gtk/treemodel.c | 4 ++-- testsuite/gtk/treemodel.h | 10 +++++----- 9 files changed, 47 insertions(+), 39 deletions(-) diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c index 4b5dcc268e..15afb24c4d 100644 --- a/testsuite/gtk/builder.c +++ b/testsuite/gtk/builder.c @@ -1926,8 +1926,8 @@ test_add_objects (void) GError *error; gint ret; GObject *obj; - gchar *objects[2] = {"mainbox", NULL}; - gchar *objects2[3] = {"mainbox", "window2", NULL}; + const gchar *objects[2] = {"mainbox", NULL}; + const gchar *objects2[3] = {"mainbox", "window2", NULL}; const gchar buffer[] = "" " " @@ -2356,7 +2356,7 @@ my_gtk_grid_class_init (MyGtkGridClass *klass) } static void -test_template () +test_template (void) { MyGtkGrid *my_gtk_grid; diff --git a/testsuite/gtk/check-icon-names.c b/testsuite/gtk/check-icon-names.c index 4f752b95eb..8baf8e6d2e 100644 --- a/testsuite/gtk/check-icon-names.c +++ b/testsuite/gtk/check-icon-names.c @@ -1,6 +1,6 @@ #include -static char *icon_names[] = { +static const char *icon_names[] = { /*** Icons used in code or templates, sorted alphabetically ***/ "audio-volume-high", "audio-volume-high-symbolic", diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index 6b338f9bbe..db04dfcabc 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -83,6 +83,12 @@ if os_unix test_cargs += ['-DHAVE_UNIX_PRINT_WIDGETS'] endif +foreach flag: common_cflags + if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden'] + test_cargs += flag + endif +endforeach + foreach t : tests test_name = t.get(0) test_srcs = ['@0@.c'.format(test_name)] + t.get(1, []) diff --git a/testsuite/gtk/rbtree.c b/testsuite/gtk/rbtree.c index 9e636bb47c..0975c47d51 100644 --- a/testsuite/gtk/rbtree.c +++ b/testsuite/gtk/rbtree.c @@ -115,6 +115,8 @@ gtk_tree_rbtree_test_dirty (GtkTreeRBTree *tree, GtkTreeRBNode *node, gint expected_dirtyness) { + g_assert (node); + if (expected_dirtyness) { g_assert (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) || diff --git a/testsuite/gtk/recentmanager.c b/testsuite/gtk/recentmanager.c index e8acfac77f..8173b3f00b 100644 --- a/testsuite/gtk/recentmanager.c +++ b/testsuite/gtk/recentmanager.c @@ -51,8 +51,8 @@ recent_manager_add (void) /* mime type is mandatory */ recent_data->mime_type = NULL; - recent_data->app_name = "testrecentchooser"; - recent_data->app_exec = "testrecentchooser %u"; + recent_data->app_name = (char *)"testrecentchooser"; + recent_data->app_exec = (char *)"testrecentchooser %u"; if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { res = gtk_recent_manager_add_full (manager, @@ -62,9 +62,9 @@ recent_manager_add (void) g_test_trap_assert_failed (); /* app name is mandatory */ - recent_data->mime_type = "text/plain"; + recent_data->mime_type = (char *)"text/plain"; recent_data->app_name = NULL; - recent_data->app_exec = "testrecentchooser %u"; + recent_data->app_exec = (char *)"testrecentchooser %u"; if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { res = gtk_recent_manager_add_full (manager, @@ -74,8 +74,8 @@ recent_manager_add (void) g_test_trap_assert_failed (); /* app exec is mandatory */ - recent_data->mime_type = "text/plain"; - recent_data->app_name = "testrecentchooser"; + recent_data->mime_type = (char *)"text/plain"; + recent_data->app_name = (char *)"testrecentchooser"; recent_data->app_exec = NULL; if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { @@ -87,9 +87,9 @@ recent_manager_add (void) G_GNUC_END_IGNORE_DEPRECATIONS; - recent_data->mime_type = "text/plain"; - recent_data->app_name = "testrecentchooser"; - recent_data->app_exec = "testrecentchooser %u"; + recent_data->mime_type = (char *)"text/plain"; + recent_data->app_name = (char *)"testrecentchooser"; + recent_data->app_exec = (char *)"testrecentchooser %u"; res = gtk_recent_manager_add_full (manager, uri, recent_data); @@ -130,9 +130,9 @@ add_bulk (gpointer data_) { char *new_uri; - data->mime_type = "text/plain"; - data->app_name = "testrecentchooser"; - data->app_exec = "testrecentchooser %u"; + data->mime_type = (char *)"text/plain"; + data->app_name = (char *)"testrecentchooser"; + data->app_exec = (char *)"testrecentchooser %u"; if (g_test_verbose ()) g_print (G_STRLOC ": adding item %d\n", i); @@ -295,9 +295,9 @@ recent_manager_purge (void) g_assert (error == NULL); recent_data = g_slice_new0 (GtkRecentData); - recent_data->mime_type = "text/plain"; - recent_data->app_name = "testrecentchooser"; - recent_data->app_exec = "testrecentchooser %u"; + recent_data->mime_type = (char *)"text/plain"; + recent_data->app_name = (char *)"testrecentchooser"; + recent_data->app_exec = (char *)"testrecentchooser %u"; gtk_recent_manager_add_full (manager, uri, recent_data); g_slice_free (GtkRecentData, recent_data); diff --git a/testsuite/gtk/revealer-size.c b/testsuite/gtk/revealer-size.c index 4fbea9cf19..94340c40fe 100644 --- a/testsuite/gtk/revealer-size.c +++ b/testsuite/gtk/revealer-size.c @@ -59,73 +59,73 @@ keep_size (int direction, static void -slide_right_animations () +slide_right_animations (void) { keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, TRUE); } static void -slide_right_no_animations () +slide_right_no_animations (void) { keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, FALSE); } static void -slide_left_animations () +slide_left_animations (void) { keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, TRUE); } static void -slide_left_no_animations () +slide_left_no_animations (void) { keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, FALSE); } static void -none_animations () +none_animations (void) { keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, TRUE); } static void -none_no_animations () +none_no_animations (void) { keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, FALSE); } static void -crossfade_animations() +crossfade_animations (void) { keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, TRUE); } static void -crossfade_no_animations () +crossfade_no_animations (void) { keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, FALSE); } static void -slide_down_animations () +slide_down_animations (void) { keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, TRUE); } static void -slide_down_no_animations () +slide_down_no_animations (void) { keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, FALSE); } static void -slide_up_animations () +slide_up_animations (void) { keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, TRUE); } static void -slide_up_no_animations () +slide_up_no_animations (void) { keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, FALSE); } diff --git a/testsuite/gtk/textiter.c b/testsuite/gtk/textiter.c index a743903d37..6f6e14f803 100644 --- a/testsuite/gtk/textiter.c +++ b/testsuite/gtk/textiter.c @@ -22,7 +22,7 @@ #include static void -test_empty_search () +test_empty_search (void) { GtkTextBuffer *buffer; GtkTextIter it, s, e; diff --git a/testsuite/gtk/treemodel.c b/testsuite/gtk/treemodel.c index b5615a3057..54db6e94eb 100644 --- a/testsuite/gtk/treemodel.c +++ b/testsuite/gtk/treemodel.c @@ -58,9 +58,9 @@ signal_name_to_string (SignalName signal) case ROWS_REORDERED: return "rows-reordered"; + case LAST_SIGNAL: default: - /* Fall through */ - break; + g_assert_not_reached (); } return "(unknown)"; diff --git a/testsuite/gtk/treemodel.h b/testsuite/gtk/treemodel.h index 3723057dbf..b43c1ad335 100644 --- a/testsuite/gtk/treemodel.h +++ b/testsuite/gtk/treemodel.h @@ -17,11 +17,11 @@ #include -void register_list_store_tests (); -void register_tree_store_tests (); -void register_sort_model_tests (); -void register_filter_model_tests (); -void register_model_ref_count_tests (); +void register_list_store_tests (void); +void register_tree_store_tests (void); +void register_sort_model_tests (void); +void register_filter_model_tests (void); +void register_model_ref_count_tests (void); /* * Signal monitor