mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	glib: 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 <withnall@endlessm.com> Helps: #1708
This commit is contained in:
		@@ -1304,7 +1304,10 @@ parse_iso8601_date (const gchar *text, gsize length,
 | 
			
		||||
static GTimeZone *
 | 
			
		||||
parse_iso8601_timezone (const gchar *text, gsize length, gssize *tz_offset)
 | 
			
		||||
{
 | 
			
		||||
  gint i, tz_length, offset_sign = 1, offset_hours, offset_minutes;
 | 
			
		||||
  gint i, tz_length, offset_hours, offset_minutes;
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  gint offset_sign = 1;
 | 
			
		||||
#endif
 | 
			
		||||
  GTimeZone *tz;
 | 
			
		||||
 | 
			
		||||
  /* UTC uses Z suffix  */
 | 
			
		||||
@@ -1318,7 +1321,9 @@ parse_iso8601_timezone (const gchar *text, gsize length, gssize *tz_offset)
 | 
			
		||||
  for (i = length - 1; i >= 0; i--)
 | 
			
		||||
    if (text[i] == '+' || text[i] == '-')
 | 
			
		||||
      {
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
        offset_sign = text[i] == '-' ? -1 : 1;
 | 
			
		||||
#endif
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
  if (i < 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -1311,7 +1311,9 @@ g_io_channel_set_encoding (GIOChannel	*channel,
 | 
			
		||||
			   GError      **error)
 | 
			
		||||
{
 | 
			
		||||
  GIConv read_cd, write_cd;
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  gboolean did_encode;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (channel != NULL, G_IO_STATUS_ERROR);
 | 
			
		||||
  g_return_val_if_fail ((error == NULL) || (*error == NULL), G_IO_STATUS_ERROR);
 | 
			
		||||
@@ -1335,7 +1337,9 @@ g_io_channel_set_encoding (GIOChannel	*channel,
 | 
			
		||||
      channel->partial_write_buf[0] = '\0';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  did_encode = channel->do_encode;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  if (!encoding || strcmp (encoding, "UTF8") == 0 || strcmp (encoding, "UTF-8") == 0)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -362,7 +362,7 @@ static void
 | 
			
		||||
token_stream_assert (TokenStream *stream,
 | 
			
		||||
                     const gchar *token)
 | 
			
		||||
{
 | 
			
		||||
  gboolean correct_token;
 | 
			
		||||
  gboolean correct_token G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
 | 
			
		||||
 | 
			
		||||
  correct_token = token_stream_consume (stream, token);
 | 
			
		||||
  g_assert (correct_token);
 | 
			
		||||
 
 | 
			
		||||
@@ -1084,12 +1084,16 @@ g_variant_type_key (const GVariantType *type)
 | 
			
		||||
const GVariantType *
 | 
			
		||||
g_variant_type_value (const GVariantType *type)
 | 
			
		||||
{
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  const gchar *type_string;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (g_variant_type_check (type), NULL);
 | 
			
		||||
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  type_string = g_variant_type_peek_string (type);
 | 
			
		||||
  g_assert (type_string[0] == '{');
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  return g_variant_type_next (g_variant_type_key (type));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -157,6 +157,7 @@ static void
 | 
			
		||||
g_variant_type_info_check (const GVariantTypeInfo *info,
 | 
			
		||||
                           char                    container_class)
 | 
			
		||||
{
 | 
			
		||||
#ifndef G_DISABLE_ASSERT
 | 
			
		||||
  g_assert (!container_class || info->container_class == container_class);
 | 
			
		||||
 | 
			
		||||
  /* alignment can only be one of these */
 | 
			
		||||
@@ -185,6 +186,7 @@ g_variant_type_info_check (const GVariantTypeInfo *info,
 | 
			
		||||
      g_assert (0 <= index && index < 24);
 | 
			
		||||
      g_assert (g_variant_type_info_basic_chars[index][0] != ' ');
 | 
			
		||||
    }
 | 
			
		||||
#endif  /* !G_DISABLE_ASSERT */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* < private >
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user