From d077b32201340017e53126b5588936f98e1839e6 Mon Sep 17 00:00:00 2001 From: Kp Date: Wed, 7 Jun 2017 02:44:54 +0000 Subject: [PATCH] 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 --- similar/main/newdemo.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/similar/main/newdemo.cpp b/similar/main/newdemo.cpp index f87d2b5dc..3a8efa426 100644 --- a/similar/main/newdemo.cpp +++ b/similar/main/newdemo.cpp @@ -3905,7 +3905,14 @@ static bool guess_demo_name(ntstring &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;