In case the standard library does not provide the memrchr() function (a
GNU extension), we define our own implementation of the function.  To
maintain compatibility with glibc, the function must receive a const
pointer A and return a non-const pointer B derived from A.  (Why not
make B const?  Idfk ask the glibc devs.)

The derivation of B from A thus requires casting away the const, which
produces a compilation warning in environments using our memrchr()
implementation.  For all intents and purposes this warning is
unavoidable, so locally supress it for the relevant cast.
---
 src/util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util.c b/src/util.c
index c110188d4fac..fc7f49899634 100644
--- a/src/util.c
+++ b/src/util.c
@@ -454,7 +454,10 @@ vasprintf( char **strp, const char *fmt, va_list ap )
 void *
 memrchr( const void *s, int c, size_t n )
 {
+DIAG_PUSH
+DIAG_DISABLE("-Wcast-qual")
        u_char *b = (u_char *)s, *e = b + n;
+DIAG_POP
 
        while (--e >= b)
                if (*e == c)

base-commit: 9aaac66286910f547ec3068d3fd72afb4fe716bf
-- 
2.50.1 (Apple Git-155)



_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to