mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Fix the -Werror=format-nonliteral fixes for older GCCs
They don't allow that pragma inside functions.
This commit is contained in:
parent
09d83640a8
commit
ab5aa2aa3a
@ -393,6 +393,8 @@ g_content_type_get_mime_type (const char *type)
|
||||
return g_strdup (type);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
static GIcon *
|
||||
g_content_type_get_icon_internal (const gchar *type,
|
||||
@ -423,8 +425,6 @@ g_content_type_get_icon_internal (const gchar *type,
|
||||
G_LOCK (gio_xdgmime);
|
||||
xdg_icon = xdg_mime_get_icon (type);
|
||||
G_UNLOCK (gio_xdgmime);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
if (xdg_icon != NULL)
|
||||
xdg_mimetype_icon = g_strdup_printf (file_template, xdg_icon);
|
||||
|
||||
@ -440,7 +440,6 @@ g_content_type_get_icon_internal (const gchar *type,
|
||||
xdg_mimetype_generic_icon = g_content_type_get_generic_icon_name (type);
|
||||
if (xdg_mimetype_generic_icon)
|
||||
generic_mimetype_icon = g_strdup_printf (file_template, xdg_mimetype_generic_icon);
|
||||
#pragma GCC diagnostic pop
|
||||
if (generic_mimetype_icon)
|
||||
icon_names[n++] = generic_mimetype_icon;
|
||||
|
||||
@ -453,6 +452,7 @@ g_content_type_get_icon_internal (const gchar *type,
|
||||
|
||||
return themed_icon;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* g_content_type_get_icon:
|
||||
|
@ -505,6 +505,9 @@ g_resolver_record_type_to_rrtype (GResolverRecordType type)
|
||||
g_return_val_if_reached (-1);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
static GList *
|
||||
g_resolver_records_from_res_query (const gchar *rrname,
|
||||
gint rrtype,
|
||||
@ -543,10 +546,7 @@ g_resolver_records_from_res_query (const gchar *rrname,
|
||||
format = _("Error resolving '%s'");
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
|
||||
#pragma GCC diagnostic pop
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -622,6 +622,8 @@ g_resolver_records_from_res_query (const gchar *rrname,
|
||||
return records;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#elif defined(G_OS_WIN32)
|
||||
|
||||
static GVariant *
|
||||
|
@ -1008,6 +1008,9 @@ static char *
|
||||
format_error_message (const gchar *filename,
|
||||
const gchar *format_string) G_GNUC_FORMAT(2);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
static char *
|
||||
format_error_message (const gchar *filename,
|
||||
const gchar *format_string)
|
||||
@ -1016,18 +1019,15 @@ format_error_message (const gchar *filename,
|
||||
gchar *display_name;
|
||||
gchar *msg;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
display_name = g_filename_display_name (filename);
|
||||
msg = g_strdup_printf (format_string, display_name, g_strerror (saved_errno));
|
||||
g_free (display_name);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* format string must have two '%s':
|
||||
*
|
||||
* - the place for the filename
|
||||
|
@ -2366,6 +2366,9 @@ find_conversion (const char *format,
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
gchar *
|
||||
g_markup_vprintf_escaped (const gchar *format,
|
||||
va_list args)
|
||||
@ -2428,8 +2431,6 @@ g_markup_vprintf_escaped (const gchar *format,
|
||||
/* Use them to format the arguments
|
||||
*/
|
||||
G_VA_COPY (args2, args);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
output1 = g_strdup_vprintf (format1->str, args);
|
||||
|
||||
@ -2443,7 +2444,6 @@ g_markup_vprintf_escaped (const gchar *format,
|
||||
va_end (args2);
|
||||
if (!output2)
|
||||
goto cleanup;
|
||||
#pragma GCC diagnostic pop
|
||||
result = g_string_new (NULL);
|
||||
|
||||
/* Iterate through the original format string again,
|
||||
@ -2495,6 +2495,8 @@ g_markup_vprintf_escaped (const gchar *format,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* g_markup_printf_escaped:
|
||||
* @format: printf() style format string
|
||||
|
@ -881,6 +881,9 @@ g_ascii_dtostr (gchar *buffer,
|
||||
return g_ascii_formatd (buffer, buf_len, "%.17g", d);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
/**
|
||||
* g_ascii_formatd:
|
||||
* @buffer: A buffer to place the resulting string in
|
||||
@ -909,10 +912,7 @@ g_ascii_formatd (gchar *buffer,
|
||||
locale_t old_locale;
|
||||
|
||||
old_locale = uselocale (get_C_locale ());
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
_g_snprintf (buffer, buf_len, format, d);
|
||||
#pragma GCC diagnostic pop
|
||||
uselocale (old_locale);
|
||||
|
||||
return buffer;
|
||||
@ -991,6 +991,7 @@ g_ascii_formatd (gchar *buffer,
|
||||
return buffer;
|
||||
#endif
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
|
||||
(c) == '\r' || (c) == '\t' || (c) == '\v')
|
||||
|
@ -2148,6 +2148,9 @@ g_format_size (guint64 size)
|
||||
* Flags to modify the format of the string returned by g_format_size_full().
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
/**
|
||||
* g_format_size_full:
|
||||
* @size: a size in bytes
|
||||
@ -2273,10 +2276,7 @@ g_format_size_full (guint64 size,
|
||||
#endif
|
||||
|
||||
g_string_append (string, " (");
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
g_string_append_printf (string, translated_format, formatted_number);
|
||||
#pragma GCC diagnostic pop
|
||||
g_free (formatted_number);
|
||||
g_string_append (string, ")");
|
||||
}
|
||||
@ -2284,6 +2284,8 @@ g_format_size_full (guint64 size,
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* g_format_size_for_display:
|
||||
* @size: a size in bytes
|
||||
|
Loading…
Reference in New Issue
Block a user