From f82f8faf9942f51e9c3c773b56574652695bef5a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 9 May 2018 21:45:38 -0700
Subject: [PATCH] Disable new gcc8 warnings

GCC seems to be not able to detect the checks for size are
already in place

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
Upstream-Status: Pending

 src/libcollectdclient/network_parse.c | 7 +++++++
 src/write_sensu.c                     | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c
index aa753ce..fef43a9 100644
--- a/src/libcollectdclient/network_parse.c
+++ b/src/libcollectdclient/network_parse.c
@@ -148,6 +148,11 @@ static int parse_int(void *payload, size_t payload_size, uint64_t *out) {
   return 0;
 }
 
+#pragma GCC diagnostic push
+#if __GNUC__ == 8
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
+
 static int parse_string(void *payload, size_t payload_size, char *out,
                         size_t out_size) {
   char *in = payload;
@@ -160,6 +165,8 @@ static int parse_string(void *payload, size_t payload_size, char *out,
   return 0;
 }
 
+#pragma GCC diagnostic pop
+
 static int parse_identifier(uint16_t type, void *payload, size_t payload_size,
                             lcc_value_list_t *state) {
   char buf[LCC_NAME_LEN];
diff --git a/src/write_sensu.c b/src/write_sensu.c
index bd7a56d..6cb59d5 100644
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
@@ -570,6 +570,11 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
   return ret_str;
 } /* }}} char *sensu_value_to_json */
 
+#pragma GCC diagnostic push
+#if __GNUC__ > 7
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
 /*
  * Uses replace_str2() implementation from
  * http://creativeandcritical.net/str-replace-c/
@@ -632,6 +637,8 @@ static char *replace_str(const char *str, const char *old, /* {{{ */
   return ret;
 } /* }}} char *replace_str */
 
+#pragma GCC diagnostic pop
+
 static char *replace_json_reserved(const char *message) /* {{{ */
 {
   char *msg = replace_str(message, "\\", "\\\\");
