Hi,
I'm using GCC 8.2.0 here and it breaks with the return type of memcpy.

Attached patch fixes it.

Another option would be to change the return type of lwc_memcpy.

François.
>From 1cac76658a8b02892cfd59f9dd0a9efaf4ac774f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <[email protected]>
Date: Sat, 22 Dec 2018 21:00:52 +0100
Subject: [PATCH] Use a wrapper for memcpy to work around
 -Werror=type-function-cast

---
 src/libwapcaplet.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/libwapcaplet.c b/src/libwapcaplet.c
index 3ef0003..cd51559 100644
--- a/src/libwapcaplet.c
+++ b/src/libwapcaplet.c
@@ -49,6 +49,12 @@ typedef lwc_hash (*lwc_hasher)(const char *, size_t);
 typedef int (*lwc_strncmp)(const char *, const char *, size_t);
 typedef void (*lwc_memcpy)(char * restrict, const char * restrict, size_t);
 
+static void
+lwc__memcpy(char *restrict target, const char *restrict source, size_t n)
+{
+	memcpy(target, source, n);
+}
+
 static lwc_error
 lwc__initialise(void)
 {
@@ -145,7 +151,7 @@ lwc_intern_string(const char *s, size_t slen,
 {
 	return lwc__intern(s, slen, ret,
 			   lwc__calculate_hash,
-			   strncmp, (lwc_memcpy)memcpy);
+			   strncmp, (lwc_memcpy)lwc__memcpy);
 }
 
 lwc_error
-- 
2.20.1

Reply via email to