Commit 1b50643c authored by Philip Withnall's avatar Philip Withnall

gio: Fix various compiler warnings when compiling with G_DISABLE_ASSERT

Mostly unused variables which are only used in a g_assert() call
otherwise.
Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>

Helps: #1708
parent 9ce76b97
......@@ -774,7 +774,7 @@ g_application_impl_command_line (GApplicationImpl *impl,
const gchar *object_path = "/org/gtk/Application/CommandLine";
GMainContext *context;
CommandLineData data;
guint object_id;
guint object_id G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
context = g_main_context_new ();
data.loop = g_main_loop_new (context, FALSE);
......
......@@ -936,7 +936,7 @@ g_data_input_stream_read_until (GDataInputStream *stream,
/* If we're not at end of stream then we have a stop_char to consume. */
if (result != NULL && g_buffered_input_stream_get_available (bstream) > 0)
{
gsize res;
gsize res G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
gchar b;
res = g_input_stream_read (G_INPUT_STREAM (stream), &b, 1, NULL, NULL);
......
......@@ -1714,7 +1714,7 @@ parse_value_from_blob (GMemoryBuffer *buf,
if (array_len == 0)
{
GVariant *item;
GVariant *item G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
item = parse_value_from_blob (buf,
element_type,
TRUE,
......@@ -2345,7 +2345,10 @@ append_value_to_blob (GVariant *value,
{
gsize len;
const gchar *v;
#ifndef G_DISABLE_ASSERT
const gchar *end;
#endif
v = g_variant_get_string (value, &len);
g_assert (g_utf8_validate (v, -1, &end) && (end == v + len));
g_memory_buffer_put_uint32 (mbuf, len);
......
......@@ -179,7 +179,8 @@ ensure_attribute_hash (void)
attribute_hash = g_hash_table_new (g_str_hash, g_str_equal);
#define REGISTER_ATTRIBUTE(name) G_STMT_START{\
guint _u = _lookup_attribute (G_FILE_ATTRIBUTE_ ## name); \
guint _u G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */; \
_u = _lookup_attribute (G_FILE_ATTRIBUTE_ ## name); \
/* use for generating the ID: g_print ("#define G_FILE_ATTRIBUTE_ID_%s (%u + %u)\n", #name + 17, _u & ~ID_MASK, _u & ID_MASK); */ \
g_assert (_u == G_FILE_ATTRIBUTE_ID_ ## name); \
}G_STMT_END
......
......@@ -334,7 +334,7 @@ g_keyfile_settings_backend_write_one (gpointer key,
gpointer user_data)
{
WriteManyData *data = user_data;
gboolean success;
gboolean success G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
success = set_to_keyfile (data->kfsb, key, value);
g_assert (success);
......
......@@ -648,8 +648,10 @@ key_state_serialise (KeyState *state)
else
{
GVariantBuilder builder;
gboolean checked G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
g_assert (key_state_check (state, NULL));
checked = key_state_check (state, NULL);
g_assert (checked);
g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
......
......@@ -328,6 +328,7 @@ g_file_monitor_source_send_synthetic_created (GFileMonitorSource *fms,
g_file_monitor_source_queue_event (fms, G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT, child, NULL);
}
#ifndef G_DISABLE_ASSERT
static gboolean
is_basename (const gchar *name)
{
......@@ -336,6 +337,7 @@ is_basename (const gchar *name)
return !strchr (name, '/');
}
#endif /* !G_DISABLE_ASSERT */
gboolean
g_file_monitor_source_handle_event (GFileMonitorSource *fms,
......
......@@ -1455,7 +1455,7 @@ gint
g_settings_schema_key_to_enum (GSettingsSchemaKey *key,
GVariant *value)
{
gboolean it_worked;
gboolean it_worked G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
guint result;
it_worked = strinfo_enum_from_string (key->strinfo, key->strinfo_length,
......@@ -1499,7 +1499,7 @@ g_settings_schema_key_to_flags (GSettingsSchemaKey *key,
g_variant_iter_init (&iter, value);
while (g_variant_iter_next (&iter, "&s", &flag))
{
gboolean it_worked;
gboolean it_worked G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
guint flag_value;
it_worked = strinfo_enum_from_string (key->strinfo, key->strinfo_length, flag, &flag_value);
......
......@@ -389,7 +389,9 @@ g_socket_connection_set_property (GObject *object,
static void
g_socket_connection_constructed (GObject *object)
{
#ifndef G_DISABLE_ASSERT
GSocketConnection *connection = G_SOCKET_CONNECTION (object);
#endif
g_assert (connection->priv->socket != NULL);
}
......
......@@ -575,7 +575,7 @@ initable_init (GInitable *initable,
{
guint64 identifier;
gint s;
gint s G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
#ifdef G_OS_WIN32
identifier = (guint64) GetProcessId (self->pid);
......
......@@ -55,7 +55,7 @@ g_inotify_file_monitor_start (GLocalFileMonitor *local_monitor,
GFileMonitorSource *source)
{
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (local_monitor);
gboolean success;
gboolean success G_GNUC_UNUSED /* when compiling with G_DISABLE_ASSERT */;
/* should already have been called, from is_supported() */
success = _ih_startup ();
......@@ -83,7 +83,9 @@ g_inotify_file_monitor_cancel (GFileMonitor *monitor)
static void
g_inotify_file_monitor_finalize (GObject *object)
{
#ifndef G_DISABLE_ASSERT
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (object);
#endif
/* must surely have been cancelled already */
g_assert (!inotify_monitor->sub);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment