summaryrefslogtreecommitdiff
path: root/src/basic/macro.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-07 15:10:58 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-07 21:05:26 +0200
commit6695c200bd5f0cbe65647fcdafa2f1dbed4b6a64 (patch)
tree361c86f4e25c2041772afad10df10b260176ce74 /src/basic/macro.h
parent881a62debbac022046f350be5c3c7e909189a7e7 (diff)
downloadsystemd-6695c200bd5f0cbe65647fcdafa2f1dbed4b6a64.tar.gz
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.
Diffstat (limited to 'src/basic/macro.h')
-rw-r--r--src/basic/macro.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 1971e912db..ae8907db04 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -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")