shared/utmp-wtmp: silence gcc warning about strncpy truncation

Unfortunately the warning must be known, or otherwise the pragma generates a
warning or an error. So let's do a meson check for it.

Is it worth doing this to silence the warning? I think so, because apparently
the warning was already emitted by gcc-8.1, and with the recent push in gcc to
catch more such cases, we'll most likely only get more of those.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-05-07 21:05:26 +02:00
parent 881a62debb
commit 6695c200bd
4 changed files with 19 additions and 1 deletions
+9
View File
@@ -105,6 +105,15 @@
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types\"")
#if HAVE_WSTRINGOP_TRUNCATION
# define DISABLE_WARNING_STRINGOP_TRUNCATION \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wstringop-truncation\"")
#else
# define DISABLE_WARNING_STRINGOP_TRUNCATION \
_Pragma("GCC diagnostic push")
#endif
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")