Disable newdemo strftime -Wformat-nonliteral warning

Disable gcc's -Wformat-nonliteral for this one call since unchecked
format strings are (1) under the user's control, (2) unable to cause
problems, and (3) very difficult to fully support with the warning
enabled.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
This commit is contained in:
Kp 2017-06-07 02:44:54 +00:00
parent b0cb681ae7
commit d077b32201

View file

@ -3905,7 +3905,14 @@ static bool guess_demo_name(ntstring<PATH_MAX - 1> &filename)
sbuf[2] = 0;
}
filename[i] = 0;
auto a = strftime(&filename[i], sizeof(filename) - i, sbuf, ptm);
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
const auto a = strftime(&filename[i], sizeof(filename) - i, sbuf, ptm);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if (a >= sizeof(filename) - i)
return false;
i += a;