[gnome-builder] build: fix a number of warnings in release builds
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] build: fix a number of warnings in release builds
- Date: Wed, 14 Mar 2018 09:17:57 +0000 (UTC)
commit ad893483ed022faa3bb796271037c6fdc3dc942c
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 14 02:17:01 2018 -0700
build: fix a number of warnings in release builds
These popped up when building with --buildtype=release. All of them are
harmless, but I like keeping the warning counts down.
src/libide/application/ide-application-tests.c | 10 +++++++---
src/libide/buffers/ide-buffer.c | 6 ++----
src/libide/buildsystem/ide-build-manager.c | 8 --------
src/libide/buildsystem/ide-build-pipeline.c | 4 ----
src/libide/buildui/ide-build-panel.c | 3 +--
src/libide/debugger/ide-debug-manager.c | 3 +--
src/libide/langserv/ide-langserv-rename-provider.c | 3 +--
src/libide/sourceview/ide-source-view.c | 3 +--
src/libide/sourceview/ide-word-completion-provider.c | 3 +--
src/libide/subprocess/ide-breakout-subprocess.c | 7 ++-----
src/plugins/beautifier/gb-beautifier-process.c | 7 -------
src/plugins/cmake/gbp-cmake-build-system.c | 3 +--
src/plugins/code-index/ide-persistent-map-builder.c | 3 +--
src/plugins/ctags/ide-ctags-index.c | 8 ++------
src/plugins/ctags/ide-ctags-service.c | 5 +++--
src/plugins/flatpak/gbp-flatpak-application-addin.c | 3 +--
src/plugins/flatpak/gbp-flatpak-configuration-provider.c | 7 +------
src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 4 ----
src/plugins/flatpak/gbp-flatpak-runtime.c | 4 +---
src/plugins/project-tree/gb-project-tree-builder.c | 16 +++++-----------
src/plugins/sysprof/gbp-sysprof-workbench-addin.c | 3 +--
src/plugins/xml-pack/ide-xml-completion-attributes.c | 2 +-
src/plugins/xml-pack/ide-xml-completion-values.c | 2 +-
src/plugins/xml-pack/ide-xml-parser.c | 13 ++++++-------
src/plugins/xml-pack/ide-xml-position.c | 4 ++--
src/plugins/xml-pack/ide-xml-rng-grammar.c | 9 ++-------
src/plugins/xml-pack/ide-xml-tree-builder.c | 5 ++---
src/tests/test-ide-buffer-manager.c | 4 ++++
src/tests/test-line-reader.c | 4 ++++
29 files changed, 54 insertions(+), 102 deletions(-)
---
diff --git a/src/libide/application/ide-application-tests.c b/src/libide/application/ide-application-tests.c
index 150735efb..3f89b4259 100644
--- a/src/libide/application/ide-application-tests.c
+++ b/src/libide/application/ide-application-tests.c
@@ -56,12 +56,16 @@ ide_application_run_tests_cb (GObject *object,
gpointer user_data)
{
AsyncTest *test = user_data;
- GError *error = NULL;
+ g_autoptr(GError) error = NULL;
gboolean ret;
ret = test->test_completion (result, &error);
- g_assert_no_error (error);
- g_assert (ret == TRUE);
+
+ if (error != NULL)
+ g_error ("%s: %s", g_quark_to_string (error->domain), error->message);
+
+ if (ret == FALSE)
+ g_error ("Test failed without an error");
if (test->self->test_funcs)
ide_application_run_next_test (test->self);
diff --git a/src/libide/buffers/ide-buffer.c b/src/libide/buffers/ide-buffer.c
index cc071da44..f98c59ff4 100644
--- a/src/libide/buffers/ide-buffer.c
+++ b/src/libide/buffers/ide-buffer.c
@@ -1196,7 +1196,6 @@ ide_buffer_symbol_resolver_added (IdeExtensionSetAdapter *adapter,
gpointer user_data)
{
IdeSymbolResolver *resolver = (IdeSymbolResolver *)extension;
- IdeBuffer *self = user_data;
IDE_ENTRY;
@@ -1204,7 +1203,7 @@ ide_buffer_symbol_resolver_added (IdeExtensionSetAdapter *adapter,
g_assert (IDE_IS_EXTENSION_SET_ADAPTER (adapter));
g_assert (plugin_info != NULL);
g_assert (IDE_IS_SYMBOL_RESOLVER (resolver));
- g_assert (IDE_IS_BUFFER (self));
+ g_assert (IDE_IS_BUFFER (user_data));
IDE_TRACE_MSG ("Loading symbol resolver %s", G_OBJECT_TYPE_NAME (resolver));
@@ -1220,7 +1219,6 @@ ide_buffer_symbol_resolver_removed (IdeExtensionSetAdapter *adapter,
gpointer user_data)
{
IdeSymbolResolver *resolver = (IdeSymbolResolver *)extension;
- IdeBuffer *self = user_data;
IDE_ENTRY;
@@ -1228,7 +1226,7 @@ ide_buffer_symbol_resolver_removed (IdeExtensionSetAdapter *adapter,
g_assert (IDE_IS_EXTENSION_SET_ADAPTER (adapter));
g_assert (plugin_info != NULL);
g_assert (IDE_IS_SYMBOL_RESOLVER (resolver));
- g_assert (IDE_IS_BUFFER (self));
+ g_assert (IDE_IS_BUFFER (user_data));
IDE_TRACE_MSG ("Unloading symbol resolver %s", G_OBJECT_TYPE_NAME (resolver));
diff --git a/src/libide/buildsystem/ide-build-manager.c b/src/libide/buildsystem/ide-build-manager.c
index ef16710ce..98f0fc427 100644
--- a/src/libide/buildsystem/ide-build-manager.c
+++ b/src/libide/buildsystem/ide-build-manager.c
@@ -1187,7 +1187,6 @@ ide_build_manager_execute_cb (GObject *object,
gpointer user_data)
{
IdeBuildPipeline *pipeline = (IdeBuildPipeline *)object;
- IdeBuildManager *self;
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
@@ -1197,9 +1196,6 @@ ide_build_manager_execute_cb (GObject *object,
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
- self = g_task_get_source_object (task);
- g_assert (IDE_IS_BUILD_MANAGER (self));
-
if (!ide_build_pipeline_execute_finish (pipeline, result, &error))
{
ide_object_warning (pipeline, "%s", error->message);
@@ -1391,7 +1387,6 @@ ide_build_manager_clean_cb (GObject *object,
IdeBuildPipeline *pipeline = (IdeBuildPipeline *)object;
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
- IdeBuildManager *self;
IDE_ENTRY;
@@ -1399,9 +1394,6 @@ ide_build_manager_clean_cb (GObject *object,
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
- self = g_task_get_source_object (task);
- g_assert (IDE_IS_BUILD_MANAGER (self));
-
if (!ide_build_pipeline_clean_finish (pipeline, result, &error))
g_task_return_error (task, g_steal_pointer (&error));
else
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index 7b5d390e2..9bede521a 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -3256,7 +3256,6 @@ ide_build_pipeline_reaper_cb (GObject *object,
IdeBuildPipeline *self;
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
- GCancellable *cancellable;
TaskData *td;
IDE_ENTRY;
@@ -3271,10 +3270,7 @@ ide_build_pipeline_reaper_cb (GObject *object,
g_assert (td->task == task);
g_assert (td->type == TASK_REBUILD);
- cancellable = g_task_get_cancellable (task);
self = g_task_get_source_object (task);
-
- g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
g_assert (IDE_IS_BUILD_PIPELINE (self));
/* Make sure our reaper completed or else we bail */
diff --git a/src/libide/buildui/ide-build-panel.c b/src/libide/buildui/ide-build-panel.c
index 1e81e03ff..e307564d3 100644
--- a/src/libide/buildui/ide-build-panel.c
+++ b/src/libide/buildui/ide-build-panel.c
@@ -197,10 +197,9 @@ ide_build_panel_create_stage_row_cb (gpointer data,
gpointer user_data)
{
IdeBuildStage *stage = data;
- IdeBuildPanel *self = user_data;
g_assert (IDE_IS_BUILD_STAGE (stage));
- g_assert (IDE_IS_BUILD_PANEL (self));
+ g_assert (IDE_IS_BUILD_PANEL (user_data));
return ide_build_stage_row_new (stage);
}
diff --git a/src/libide/debugger/ide-debug-manager.c b/src/libide/debugger/ide-debug-manager.c
index 3a41803c4..c8d993249 100644
--- a/src/libide/debugger/ide-debug-manager.c
+++ b/src/libide/debugger/ide-debug-manager.c
@@ -797,11 +797,10 @@ static void
ide_debug_manager_reset_breakpoints_cb (gpointer item,
gpointer user_data)
{
- IdeDebugManager *self = user_data;
IdeDebuggerBreakpoint *breakpoint = item;
g_assert (IDE_IS_DEBUGGER_BREAKPOINT (breakpoint));
- g_assert (IDE_IS_DEBUG_MANAGER (self));
+ g_assert (IDE_IS_DEBUG_MANAGER (user_data));
_ide_debugger_breakpoint_reset (breakpoint);
}
diff --git a/src/libide/langserv/ide-langserv-rename-provider.c
b/src/libide/langserv/ide-langserv-rename-provider.c
index f3ed0cfc9..5aff09c9e 100644
--- a/src/libide/langserv/ide-langserv-rename-provider.c
+++ b/src/libide/langserv/ide-langserv-rename-provider.c
@@ -326,13 +326,12 @@ ide_langserv_rename_provider_rename_finish (IdeRenameProvider *provider,
GPtrArray **edits,
GError **error)
{
- IdeLangservRenameProvider *self = (IdeLangservRenameProvider *)provider;
g_autoptr(GPtrArray) ar = NULL;
gboolean ret;
IDE_ENTRY;
- g_assert (IDE_IS_LANGSERV_RENAME_PROVIDER (self));
+ g_assert (IDE_IS_LANGSERV_RENAME_PROVIDER (provider));
g_assert (G_IS_TASK (result));
ar = g_task_propagate_pointer (G_TASK (result), error);
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index 1f4dc3bfa..c8749d2fa 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -4989,11 +4989,10 @@ ide_source_view_rename_edits_applied (GObject *object,
gpointer user_data)
{
g_autoptr(IdeSourceView) self = user_data;
- IdeBufferManager *buffer_manager = (IdeBufferManager *)object;
IDE_ENTRY;
- g_assert (IDE_IS_BUFFER_MANAGER (buffer_manager));
+ g_assert (IDE_IS_BUFFER_MANAGER (object));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_SOURCE_VIEW (self));
diff --git a/src/libide/sourceview/ide-word-completion-provider.c
b/src/libide/sourceview/ide-word-completion-provider.c
index d3e28d512..7c311497c 100644
--- a/src/libide/sourceview/ide-word-completion-provider.c
+++ b/src/libide/sourceview/ide-word-completion-provider.c
@@ -428,11 +428,10 @@ static gboolean
ide_word_completion_provider_match (GtkSourceCompletionProvider *provider,
GtkSourceCompletionContext *context)
{
- IdeWordCompletionProvider *self = (IdeWordCompletionProvider *) provider;
GtkSourceCompletionActivation activation;
GtkTextIter iter;
- g_assert (IDE_IS_WORD_COMPLETION_PROVIDER (self));
+ g_assert (IDE_IS_WORD_COMPLETION_PROVIDER (provider));
g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
if (!gtk_source_completion_context_get_iter (context, &iter))
diff --git a/src/libide/subprocess/ide-breakout-subprocess.c b/src/libide/subprocess/ide-breakout-subprocess.c
index 84a22caae..07ab7d212 100644
--- a/src/libide/subprocess/ide-breakout-subprocess.c
+++ b/src/libide/subprocess/ide-breakout-subprocess.c
@@ -566,9 +566,7 @@ ide_breakout_subprocess_send_signal (IdeSubprocess *subprocess,
static void
ide_breakout_subprocess_force_exit (IdeSubprocess *subprocess)
{
- IdeBreakoutSubprocess *self = (IdeBreakoutSubprocess *)subprocess;
-
- g_assert (IDE_IS_BREAKOUT_SUBPROCESS (self));
+ g_assert (IDE_IS_BREAKOUT_SUBPROCESS (subprocess));
ide_breakout_subprocess_send_signal (subprocess, SIGKILL);
}
@@ -835,14 +833,13 @@ ide_breakout_subprocess_communicate_finish (IdeSubprocess *subprocess,
GBytes **stderr_buf,
GError **error)
{
- IdeBreakoutSubprocess *self = (IdeBreakoutSubprocess *)subprocess;
CommunicateState *state;
GTask *task = (GTask *)result;
gboolean success;
IDE_ENTRY;
- g_assert (IDE_IS_BREAKOUT_SUBPROCESS (self));
+ g_assert (IDE_IS_BREAKOUT_SUBPROCESS (subprocess));
g_assert (G_IS_TASK (task));
g_object_ref (task);
diff --git a/src/plugins/beautifier/gb-beautifier-process.c b/src/plugins/beautifier/gb-beautifier-process.c
index a3cdd0d55..a9c99f9ee 100644
--- a/src/plugins/beautifier/gb-beautifier-process.c
+++ b/src/plugins/beautifier/gb-beautifier-process.c
@@ -159,8 +159,6 @@ gb_beautifier_process_create_for_clang_format (GbBeautifierEditorAddin *self,
g_autoptr(GSubprocessLauncher) launcher = NULL;
GSubprocess *subprocess = NULL;
GPtrArray *args;
- gchar *config_path;
- gchar *src_path;
g_autofree gchar *tmp_workdir = NULL;
g_autofree gchar *tmp_config_path = NULL;
g_autofree gchar *tmp_src_path = NULL;
@@ -168,11 +166,6 @@ gb_beautifier_process_create_for_clang_format (GbBeautifierEditorAddin *self,
g_assert (GB_IS_BEAUTIFIER_EDITOR_ADDIN (self));
g_assert (state != NULL);
- config_path = g_file_get_path (state->config_file);
- src_path = g_file_get_path (state->src_file);
-
- g_assert (!dzl_str_empty0 (config_path));
- g_assert (!dzl_str_empty0 (src_path));
g_assert (!dzl_str_empty0 (state->lang_id));
tmp_workdir = g_build_filename (self->tmp_dir, "clang-XXXXXX.txt", NULL);
diff --git a/src/plugins/cmake/gbp-cmake-build-system.c b/src/plugins/cmake/gbp-cmake-build-system.c
index ac5e75c18..a6391cb2a 100644
--- a/src/plugins/cmake/gbp-cmake-build-system.c
+++ b/src/plugins/cmake/gbp-cmake-build-system.c
@@ -516,12 +516,11 @@ gbp_cmake_build_system_get_build_flags_finish (IdeBuildSystem *build_system,
GAsyncResult *result,
GError **error)
{
- GbpCMakeBuildSystem *self = (GbpCMakeBuildSystem *)build_system;
gchar **build_flags;
IDE_ENTRY;
- g_assert (GBP_IS_CMAKE_BUILD_SYSTEM (self));
+ g_assert (GBP_IS_CMAKE_BUILD_SYSTEM (build_system));
g_assert (G_IS_TASK (result));
build_flags = g_task_propagate_pointer (G_TASK (result), error);
diff --git a/src/plugins/code-index/ide-persistent-map-builder.c
b/src/plugins/code-index/ide-persistent-map-builder.c
index 001598d00..b5d24ec48 100644
--- a/src/plugins/code-index/ide-persistent-map-builder.c
+++ b/src/plugins/code-index/ide-persistent-map-builder.c
@@ -159,7 +159,6 @@ ide_persistent_map_builder_write_worker (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- IdePersistentMapBuilder *self = source_object;
BuildState *state = task_data;
g_autoptr(GError) error = NULL;
g_autoptr(GVariant) data = NULL;
@@ -170,7 +169,7 @@ ide_persistent_map_builder_write_worker (GTask *task,
GVariant *metadata;
g_assert (G_IS_TASK (task));
- g_assert (IDE_IS_PERSISTENT_MAP_BUILDER (self));
+ g_assert (IDE_IS_PERSISTENT_MAP_BUILDER (source_object));
g_assert (state != NULL);
g_assert (state->keys != NULL);
g_assert (state->keys_hash != NULL);
diff --git a/src/plugins/ctags/ide-ctags-index.c b/src/plugins/ctags/ide-ctags-index.c
index cdde99b77..929a2508d 100644
--- a/src/plugins/ctags/ide-ctags-index.c
+++ b/src/plugins/ctags/ide-ctags-index.c
@@ -454,14 +454,10 @@ ide_ctags_index_init_finish (GAsyncInitable *initable,
GAsyncResult *result,
GError **error)
{
- IdeCtagsIndex *self = (IdeCtagsIndex *)initable;
- GTask *task = (GTask *)result;
-
- g_assert (IDE_IS_CTAGS_INDEX (self));
+ g_assert (IDE_IS_CTAGS_INDEX (initable));
g_assert (G_IS_TASK (result));
- g_assert (G_IS_TASK (task));
- return g_task_propagate_boolean (task, error);
+ return g_task_propagate_boolean (G_TASK (result), error);
}
static void
diff --git a/src/plugins/ctags/ide-ctags-service.c b/src/plugins/ctags/ide-ctags-service.c
index 9633a4b9f..5bb69a50b 100644
--- a/src/plugins/ctags/ide-ctags-service.c
+++ b/src/plugins/ctags/ide-ctags-service.c
@@ -465,10 +465,11 @@ build_system_tags_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- IdeTagsBuilder *builder = (IdeTagsBuilder *)object;
g_autoptr(IdeCtagsService) self = user_data;
- g_assert (IDE_IS_TAGS_BUILDER (builder));
+ g_assert (IDE_IS_TAGS_BUILDER (object));
+ g_assert (G_IS_ASYNC_RESULT (result));
+ g_assert (IDE_IS_CTAGS_SERVICE (self));
ide_ctags_service_queue_mine (self);
}
diff --git a/src/plugins/flatpak/gbp-flatpak-application-addin.c
b/src/plugins/flatpak/gbp-flatpak-application-addin.c
index eb4e031fb..109233ff7 100644
--- a/src/plugins/flatpak/gbp-flatpak-application-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-application-addin.c
@@ -608,14 +608,13 @@ gbp_flatpak_application_addin_install_runtime_worker (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- GbpFlatpakApplicationAddin *self = source_object;
InstallRequest *request = task_data;
g_autoptr(GError) error = NULL;
IDE_ENTRY;
g_assert (G_IS_TASK (task));
- g_assert (GBP_IS_FLATPAK_APPLICATION_ADDIN (self));
+ g_assert (GBP_IS_FLATPAK_APPLICATION_ADDIN (source_object));
g_assert (request != NULL);
g_assert (request->id != NULL);
g_assert (request->arch != NULL);
diff --git a/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
b/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
index a5ab95f04..26eded25d 100644
--- a/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
@@ -61,14 +61,10 @@ static void
manifest_save_tick (GTask *task)
{
g_autoptr(GbpFlatpakManifest) manifest = NULL;
- GbpFlatpakConfigurationProvider *self;
GPtrArray *manifests;
g_assert (G_IS_TASK (task));
- self = g_task_get_source_object (task);
- g_assert (GBP_IS_FLATPAK_CONFIGURATION_PROVIDER (self));
-
manifests = g_task_get_task_data (task);
g_assert (manifests != NULL);
@@ -606,7 +602,6 @@ static void
gbp_flatpak_configuration_provider_duplicate (IdeConfigurationProvider *provider,
IdeConfiguration *configuration)
{
- GbpFlatpakConfigurationProvider *self = (GbpFlatpakConfigurationProvider *)provider;
GbpFlatpakManifest *manifest = (GbpFlatpakManifest *)configuration;
g_autofree gchar *path = NULL;
g_autofree gchar *base = NULL;
@@ -614,7 +609,7 @@ gbp_flatpak_configuration_provider_duplicate (IdeConfigurationProvider *provider
gchar *dot;
GFile *file;
- g_assert (GBP_IS_FLATPAK_CONFIGURATION_PROVIDER (self));
+ g_assert (GBP_IS_FLATPAK_CONFIGURATION_PROVIDER (provider));
g_assert (GBP_IS_FLATPAK_MANIFEST (manifest));
file = gbp_flatpak_manifest_get_file (manifest);
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 5217d7e01..b9a92bec4 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -322,7 +322,6 @@ gbp_flatpak_runtime_provider_locate_sdk_cb (GObject *object,
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
g_autofree gchar *docs_id = NULL;
- GbpFlatpakRuntimeProvider *self;
IdeTransferManager *transfer_manager;
InstallRuntime *install;
GCancellable *cancellable;
@@ -335,14 +334,11 @@ gbp_flatpak_runtime_provider_locate_sdk_cb (GObject *object,
g_assert (G_IS_TASK (task));
g_assert (!g_task_get_completed (task));
- self = g_task_get_source_object (task);
install = g_task_get_task_data (task);
cancellable = g_task_get_cancellable (task);
g_assert (install != NULL);
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
- g_assert (self != NULL);
- g_assert (GBP_IS_FLATPAK_RUNTIME_PROVIDER (self));
transfer_manager = ide_application_get_transfer_manager (IDE_APPLICATION_DEFAULT);
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index 49168f00f..682c19b50 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -308,9 +308,7 @@ static void
gbp_flatpak_runtime_prepare_configuration (IdeRuntime *runtime,
IdeConfiguration *configuration)
{
- GbpFlatpakRuntime* self = (GbpFlatpakRuntime *)runtime;
-
- g_assert (GBP_IS_FLATPAK_RUNTIME (self));
+ g_assert (GBP_IS_FLATPAK_RUNTIME (runtime));
g_assert (IDE_IS_CONFIGURATION (configuration));
ide_configuration_set_prefix (configuration, "/app");
diff --git a/src/plugins/project-tree/gb-project-tree-builder.c
b/src/plugins/project-tree/gb-project-tree-builder.c
index b9198fadf..599c33eb9 100644
--- a/src/plugins/project-tree/gb-project-tree-builder.c
+++ b/src/plugins/project-tree/gb-project-tree-builder.c
@@ -702,10 +702,9 @@ static gboolean
gb_project_tree_builder_node_draggable (DzlTreeBuilder *builder,
DzlTreeNode *node)
{
- GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)builder;
GObject *item;
- g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+ g_assert (GB_IS_PROJECT_TREE_BUILDER (builder));
g_assert (DZL_IS_TREE_NODE (node));
item = dzl_tree_node_get_item (node);
@@ -718,10 +717,9 @@ gb_project_tree_builder_node_droppable (DzlTreeBuilder *builder,
DzlTreeNode *node,
GtkSelectionData *data)
{
- GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)builder;
GObject *item;
- g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+ g_assert (GB_IS_PROJECT_TREE_BUILDER (builder));
g_assert (DZL_IS_TREE_NODE (node));
item = dzl_tree_node_get_item (node);
@@ -734,10 +732,9 @@ gb_project_tree_builder_drag_data_get (DzlTreeBuilder *builder,
DzlTreeNode *node,
GtkSelectionData *data)
{
- GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)builder;
GObject *item;
- g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+ g_assert (GB_IS_PROJECT_TREE_BUILDER (builder));
g_assert (DZL_IS_TREE_NODE (node));
if (gtk_selection_data_get_target (data) != _ATOM ("text/uri-list"))
@@ -764,9 +761,7 @@ gb_project_tree_builder_drag_data_received (DzlTreeBuilder *builder,
GdkDragAction action,
GtkSelectionData *data)
{
- GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)builder;
-
- g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+ g_assert (GB_IS_PROJECT_TREE_BUILDER (builder));
g_assert (DZL_IS_TREE_NODE (drop_node));
g_assert (data != NULL);
g_assert (action == GDK_ACTION_COPY || action == GDK_ACTION_MOVE);
@@ -843,11 +838,10 @@ gb_project_tree_builder_drag_node_received (DzlTreeBuilder *builder,
GdkDragAction action,
GtkSelectionData *data)
{
- GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)builder;
GObject *drag_item;
GObject *drop_item;
- g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+ g_assert (GB_IS_PROJECT_TREE_BUILDER (builder));
g_assert (DZL_IS_TREE_NODE (drag_node));
g_assert (DZL_IS_TREE_NODE (drop_node));
g_assert (data != NULL);
diff --git a/src/plugins/sysprof/gbp-sysprof-workbench-addin.c
b/src/plugins/sysprof/gbp-sysprof-workbench-addin.c
index a3055ba86..a275d54ea 100644
--- a/src/plugins/sysprof/gbp-sysprof-workbench-addin.c
+++ b/src/plugins/sysprof/gbp-sysprof-workbench-addin.c
@@ -293,14 +293,13 @@ gbp_sysprof_workbench_addin_open_worker (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- GbpSysprofWorkbenchAddin *self = source_object;
g_autofree gchar *path = NULL;
g_autoptr(GError) error = NULL;
SpCaptureReader *reader;
GFile *file = task_data;
g_assert (G_IS_TASK (task));
- g_assert (GBP_IS_SYSPROF_WORKBENCH_ADDIN (self));
+ g_assert (GBP_IS_SYSPROF_WORKBENCH_ADDIN (source_object));
g_assert (G_IS_FILE (file));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
diff --git a/src/plugins/xml-pack/ide-xml-completion-attributes.c
b/src/plugins/xml-pack/ide-xml-completion-attributes.c
index ec72cc75e..c22d3635b 100644
--- a/src/plugins/xml-pack/ide-xml-completion-attributes.c
+++ b/src/plugins/xml-pack/ide-xml-completion-attributes.c
@@ -285,7 +285,7 @@ process_matching_state (MatchingState *state,
{
IdeXmlRngDefine *old_define;
IdeXmlRngDefineType type;
- GPtrArray *match_children;
+ GPtrArray *match_children = NULL;
gboolean old_optional;
g_assert (state != NULL);
diff --git a/src/plugins/xml-pack/ide-xml-completion-values.c
b/src/plugins/xml-pack/ide-xml-completion-values.c
index f3c6b3bc1..c10ee4440 100644
--- a/src/plugins/xml-pack/ide-xml-completion-values.c
+++ b/src/plugins/xml-pack/ide-xml-completion-values.c
@@ -197,7 +197,7 @@ process_matching_state (MatchingState *state,
{
IdeXmlRngDefine *old_define;
IdeXmlRngDefineType type;
- GPtrArray *match_values;
+ GPtrArray *match_values = NULL;
g_assert (state != NULL);
g_assert (define != NULL);
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index f030c645f..dc687cc23 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -316,12 +316,12 @@ ide_xml_parser_warning_sax_cb (ParserState *state,
const xmlChar *name,
...)
{
- IdeXmlParser *self = (IdeXmlParser *)state->self;
IdeDiagnostic *diagnostic;
g_autofree gchar *msg = NULL;
va_list var_args;
- g_assert (IDE_IS_XML_PARSER (self));
+ g_assert (state != NULL);
+ g_assert (IDE_IS_XML_PARSER (state->self));
va_start (var_args, name);
msg = g_strdup_vprintf ((const gchar *)name, var_args);
@@ -399,12 +399,12 @@ ide_xml_parser_fatal_error_sax_cb (ParserState *state,
const xmlChar *name,
...)
{
- IdeXmlParser *self = (IdeXmlParser *)state->self;
IdeDiagnostic *diagnostic;
g_autofree gchar *msg = NULL;
va_list var_args;
- g_assert (IDE_IS_XML_PARSER (self));
+ g_assert (state != NULL);
+ g_assert (IDE_IS_XML_PARSER (state->self));
va_start (var_args, name);
msg = g_strdup_vprintf ((const gchar *)name, var_args);
@@ -439,9 +439,8 @@ ide_xml_parser_external_subset_sax_cb (ParserState *state,
const xmlChar *external_id,
const xmlChar *system_id)
{
- IdeXmlParser *self = (IdeXmlParser *)state->self;
-
- g_assert (IDE_IS_XML_PARSER (self));
+ g_assert (state != NULL);
+ g_assert (IDE_IS_XML_PARSER (state->self));
}
static GFile *
diff --git a/src/plugins/xml-pack/ide-xml-position.c b/src/plugins/xml-pack/ide-xml-position.c
index 01c6fbbcd..d3f3b6434 100644
--- a/src/plugins/xml-pack/ide-xml-position.c
+++ b/src/plugins/xml-pack/ide-xml-position.c
@@ -178,7 +178,7 @@ ide_xml_position_set_siblings (IdeXmlPosition *self,
const gchar *
ide_xml_position_kind_get_str (IdeXmlPositionKind kind)
{
- const gchar *kind_str;
+ const gchar *kind_str = NULL;
switch (kind)
{
@@ -208,7 +208,7 @@ ide_xml_position_kind_get_str (IdeXmlPositionKind kind)
const gchar *
ide_xml_position_detail_get_str (IdeXmlPositionDetail detail)
{
- const gchar *detail_str;
+ const gchar *detail_str = NULL;
switch (detail)
{
diff --git a/src/plugins/xml-pack/ide-xml-rng-grammar.c b/src/plugins/xml-pack/ide-xml-rng-grammar.c
index f4d5375b5..12dde361a 100644
--- a/src/plugins/xml-pack/ide-xml-rng-grammar.c
+++ b/src/plugins/xml-pack/ide-xml-rng-grammar.c
@@ -25,14 +25,9 @@ dump_defines_func (const gchar *name,
GPtrArray *array,
gpointer data)
{
- IdeXmlRngGrammar *self = (IdeXmlRngGrammar *)data;
- IdeXmlRngDefine *def;
-
- g_assert (self != NULL);
-
- for (gint i = 0; i <array->len; ++i)
+ for (guint i = 0; i < array->len; ++i)
{
- def = g_ptr_array_index (array, i);
+ IdeXmlRngDefine *def = g_ptr_array_index (array, i);
ide_xml_rng_define_dump_tree (def, TRUE);
}
}
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder.c b/src/plugins/xml-pack/ide-xml-tree-builder.c
index c9e71595b..51f48cfb8 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/src/plugins/xml-pack/ide-xml-tree-builder.c
@@ -330,7 +330,7 @@ ide_xml_tree_builder_parse_worker (GTask *task,
const gchar *schema_data;
gsize schema_size;
g_autoptr (IdeDiagnostics) diagnostics = NULL;
- gboolean schema_ret;
+ gboolean schema_ret = FALSE;
if (entry->kind == SCHEMA_KIND_RNG || entry->kind == SCHEMA_KIND_XML_SCHEMA)
{
@@ -447,7 +447,6 @@ ide_xml_tree_builder_build_tree_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- IdeXmlParser *parser = (IdeXmlParser *)object;
g_autoptr(IdeXmlAnalysis) analysis = NULL;
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
@@ -455,7 +454,7 @@ ide_xml_tree_builder_build_tree_cb (GObject *object,
TreeBuilderState *state;
GCancellable *cancellable;
- g_assert (IDE_IS_XML_PARSER (parser));
+ g_assert (IDE_IS_XML_PARSER (object));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
diff --git a/src/tests/test-ide-buffer-manager.c b/src/tests/test-ide-buffer-manager.c
index df418cdb4..e9f9d4a4c 100644
--- a/src/tests/test-ide-buffer-manager.c
+++ b/src/tests/test-ide-buffer-manager.c
@@ -23,6 +23,10 @@
#include "application/ide-application-tests.h"
#include "../plugins/gnome-builder-plugins.h"
+#ifdef G_DISABLE_ASSERT
+# undef G_DISABLE_ASSERT
+#endif
+
static gint save_count;
static gint load_count;
static gchar *tmpfilename;
diff --git a/src/tests/test-line-reader.c b/src/tests/test-line-reader.c
index 10bbcaeeb..3357a0608 100644
--- a/src/tests/test-line-reader.c
+++ b/src/tests/test-line-reader.c
@@ -19,6 +19,10 @@
#include <ide.h>
#include <string.h>
+#ifdef G_DISABLE_ASSERT
+# undef G_DISABLE_ASSERT
+#endif
+
static void
test_line_reader_basic (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]