1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

tree-wide: use DISABLE_WARNING_FORMAT_NONLITERAL where appropriate

This commit is contained in:
Lennart Poettering 2020-05-25 18:16:33 +02:00
parent 6a5b28def2
commit 56e577c62f
5 changed files with 12 additions and 15 deletions

View File

@ -123,12 +123,12 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
fmt2 = strjoina("selinux: ", fmt);
va_start(ap, fmt);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
DISABLE_WARNING_FORMAT_NONLITERAL;
log_internalv(LOG_AUTH | callback_type_to_priority(type),
0, PROJECT_FILE, __LINE__, __FUNCTION__,
fmt2, ap);
#pragma GCC diagnostic pop
REENABLE_WARNING;
va_end(ap);
return 0;

View File

@ -263,10 +263,10 @@ static int write_dependency(
res = strv_join(units, " ");
if (!res)
return log_oom();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
DISABLE_WARNING_FORMAT_NONLITERAL;
fprintf(f, format, res);
#pragma GCC diagnostic pop
REENABLE_WARNING;
}
return 0;

View File

@ -78,10 +78,9 @@ int mhd_respondf(struct MHD_Connection *connection,
errno = -error;
fmt = strjoina(format, "\n");
va_start(ap, format);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
DISABLE_WARNING_FORMAT_NONLITERAL;
r = vasprintf(&m, fmt, ap);
#pragma GCC diagnostic pop
REENABLE_WARNING;
va_end(ap);
if (r < 0)

View File

@ -499,10 +499,9 @@ static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char
const char *fmt;
fmt = strjoina("libxkbcommon: ", format);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
DISABLE_WARNING_FORMAT_NONLITERAL;
log_internalv(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, fmt, args);
#pragma GCC diagnostic pop
REENABLE_WARNING;
}
#define LOAD_SYMBOL(symbol, dl, name) \

View File

@ -449,11 +449,10 @@ static int names_platform(sd_device *dev, struct netnames *names, bool test) {
* The Vendor (3 or 4 char), followed by hexdecimal model number : instance id.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
DISABLE_WARNING_FORMAT_NONLITERAL;
if (sscanf(syspath, pattern, vendor, &model, &instance, &ethid) != 4)
return -EINVAL;
#pragma GCC diagnostic pop
REENABLE_WARNING;
if (!in_charset(vendor, validchars))
return -ENOENT;