Hi,

clang complains about pointer sign changes The most simple fix
would be to disable the warning for clang.

Example from librthread:

/home/patrick/openbsd-src/lib/librthread/rthread_sem.c:316:13: error: passing 
'const char *' to parameter of type 'const u_int8_t *' (aka 'const unsigned 
char *') converts between pointers to integer
      types with different sign [-Werror,-Wpointer-sign]
        SHA256Data(origpath, strlen(origpath), buf);
                   ^~~~~~~~
/usr/cross/arm64/usr/include/sha2.h:100:34: note: passing argument to parameter 
here
char *SHA256Data(const u_int8_t *, size_t, char *)
                                 ^

Opinions?

Patrick

diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile
index 3fb904b470f..5e84ef39a9c 100644
--- a/lib/libcrypto/Makefile
+++ b/lib/libcrypto/Makefile
@@ -14,6 +14,9 @@ CLEANFILES=${PC_FILES} ${VERSION_SCRIPT}
 LCRYPTO_SRC=   ${.CURDIR}
 
 CFLAGS+= -Wall -Wundef -Werror
+.if ${COMPILER_VERSION:L} == "clang"
+CFLAGS+= -Wno-pointer-sign
+.endif
 
 .if !defined(NOPIC)
 CFLAGS+= -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_FUNOPEN
diff --git a/lib/librthread/Makefile b/lib/librthread/Makefile
index 7eed6fedfca..6016c90b1b8 100644
--- a/lib/librthread/Makefile
+++ b/lib/librthread/Makefile
@@ -1,11 +1,16 @@
 #      $OpenBSD: Makefile,v 1.43 2016/06/01 04:34:18 tedu Exp $
 
+.include <bsd.own.mk>
+
 LIB=pthread
 LIBCSRCDIR=    ${.CURDIR}/../libc
 
 CFLAGS+=-Wall -g -Werror -Wshadow
 CFLAGS+=-Werror-implicit-function-declaration
 CFLAGS+=-Wsign-compare
+.if ${COMPILER_VERSION:L} == "clang"
+CFLAGS+=-Wno-pointer-sign
+.endif
 CFLAGS+=-I${.CURDIR} -include namespace.h \
        -I${LIBCSRCDIR}/arch/${MACHINE_CPU} -I${LIBCSRCDIR}/include
 CDIAGFLAGS=
diff --git a/lib/libtls/Makefile b/lib/libtls/Makefile
index af860bb0670..1b07f1bed62 100644
--- a/lib/libtls/Makefile
+++ b/lib/libtls/Makefile
@@ -1,6 +1,11 @@
 #      $OpenBSD: Makefile,v 1.29 2016/11/05 08:12:22 jsing Exp $
 
+.include <bsd.own.mk>
+
 CFLAGS+= -Wall -Werror -Wimplicit
+.if ${COMPILER_VERSION:L} == "clang"
+CFLAGS+= -Wno-pointer-sign
+.endif
 CFLAGS+= -DLIBRESSL_INTERNAL
 
 CLEANFILES= ${VERSION_SCRIPT}

Reply via email to