From: "Chris Sosnin" <k.sosnin@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH] build: suppress the warning for GCC >= 8
Date: Mon, 25 Nov 2019 00:12:19 +0300 [thread overview]
Message-ID: <1574629939.202877645@f184.i.mail.ru> (raw)
[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]
As it is mentioned in #4515, strncpy() warning needs
to be suppressed so it does not fail the build with
-DENABLE_WERROR=ON.
Closes: #4515
---
src/systemd.c | 2 ++
src/systemd.h | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/systemd.c b/src/systemd.c
index 6686c3ce0..8e81b274c 100644
--- a/src/systemd.c
+++ b/src/systemd.c
@@ -117,7 +117,9 @@ int systemd_notify(const char *message) {
.sun_family = AF_UNIX,
};
+ WSTRINGOP_TRUNC_OFF
strncpy(sa.sun_path, sd_unix_path, sizeof(sa.sun_path));
+ WSTRINGOP_TRUNC_ON
if (sa.sun_path[0] == '@')
sa.sun_path[0] = '\0';
diff --git a/src/systemd.h b/src/systemd.h
index 861a9af35..854405847 100644
--- a/src/systemd.h
+++ b/src/systemd.h
@@ -107,4 +107,17 @@ systemd_snotify(const char *format, ...);
} /* extern "C" */
#endif /* defined(__cplusplus) */
+#ifdef __GNUC__
+#if __GNUC__ >= 8
+#define WSTRINGOP_TRUNC_OFF \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wstringop-truncation\"")
+#define WSTRINGOP_TRUNC_ON \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#else
+#define WSTRINGOP_TRUNC_OFF
+#define WSTRINGOP_TRUNC_ON
+#endif
+
#endif /* TARANTOOL_SYSTEMD_H_INCLUDED */
--
2.24.0
[-- Attachment #2: Type: text/html, Size: 1378 bytes --]
next reply other threads:[~2019-11-24 21:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-24 21:12 Chris Sosnin [this message]
2019-11-25 23:23 ` Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1574629939.202877645@f184.i.mail.ru \
--to=k.sosnin@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH] build: suppress the warning for GCC >= 8' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox