From d8a422575bcb4bedd533e068aed6876a7291d8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Wed, 3 Mar 2021 11:37:36 +0100 Subject: [PATCH] Fix false positive -Wstringop-truncation Fix false positive stringop-truncation warning/error with GCC 10 on s390x by indicating GCC to explicitly ignore this case, as it is clearly a false positive (NUL is set in the following line). This allow the compilation to succeed with -Werror on. Fixes: https://github.com/swaywm/wlroots/issues/2018 --- xcursor/xcursor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c index 51ce8323..d33dee28 100644 --- a/xcursor/xcursor.c +++ b/xcursor/xcursor.c @@ -655,8 +655,11 @@ _XcursorAddPathElt (char *path, const char *elt, int len) elt++; len--; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy (path + pathlen, elt, len); path[pathlen + len] = '\0'; +#pragma GCC diagnostic pop } static char *