Jonathan Gray wrote:
> Base gcc4 changes the defaults to set -Wno-pointer-sign.
> Base clang does not, I'm not sure where in the llvm code to do so.
> Base gcc3 does not handle -Wno-pointer-sign.
 
I think this should turn off -Wpointer-sign off by default.
Passing -Wpointer-sign on the command line enables it.
Not suitable for upstreaming though.

Index: gnu/llvm/tools/clang//include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
RCS file: 
/cvs/src/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 DiagnosticSemaKinds.td
--- gnu/llvm/tools/clang//include/clang/Basic/DiagnosticSemaKinds.td    14 Jan 
2017 19:55:48 -0000      1.1.1.2
+++ gnu/llvm/tools/clang//include/clang/Basic/DiagnosticSemaKinds.td    30 Jan 
2017 18:22:22 -0000
@@ -6332,7 +6332,7 @@ def ext_typecheck_convert_incompatible_p
   "sending to parameter of different type}0,1"
   "|%diff{casting $ to type $|casting between types}0,1}2"
   " converts between pointers to integer types with different sign">,
-  InGroup<DiagGroup<"pointer-sign">>;
+  InGroup<DiagGroup<"pointer-sign">>, DefaultIgnore;
 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
   "incompatible pointer types "
   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
 
> Below is a patch to add -Wno-pointer-sign to places that use use
> -Werror and trigger -Wpointer-sign warnings which breaks the build
> when building with clang.  Based on an earlier patch from patrick@
> 
> Though really the default gcc4 and clang behaviour should be the
> same one way or the other.
>
> Index: lib/libcrypto/Makefile
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/Makefile,v
> retrieving revision 1.14
> diff -u -p -r1.14 Makefile
> --- lib/libcrypto/Makefile    21 Jan 2017 09:38:58 -0000      1.14
> +++ lib/libcrypto/Makefile    29 Jan 2017 05:10:50 -0000
> @@ -14,6 +14,9 @@ CLEANFILES=${PC_FILES} ${VERSION_SCRIPT}
>  LCRYPTO_SRC= ${.CURDIR}
>  
>  CFLAGS+= -Wall -Wundef -Werror
> +.if ${COMPILER_VERSION:L} != "gcc3"
> +CFLAGS+= -Wno-pointer-sign
> +.endif
>  
>  .if !defined(NOPIC)
>  CFLAGS+= -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_FUNOPEN
> Index: lib/librthread/Makefile
> ===================================================================
> RCS file: /cvs/src/lib/librthread/Makefile,v
> retrieving revision 1.43
> diff -u -p -r1.43 Makefile
> --- lib/librthread/Makefile   1 Jun 2016 04:34:18 -0000       1.43
> +++ lib/librthread/Makefile   29 Jan 2017 05:27:29 -0000
> @@ -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} != "gcc3"
> +CFLAGS+= -Wno-pointer-sign
> +.endif
>  CFLAGS+=-I${.CURDIR} -include namespace.h \
>       -I${LIBCSRCDIR}/arch/${MACHINE_CPU} -I${LIBCSRCDIR}/include
>  CDIAGFLAGS=
> Index: lib/libtls/Makefile
> ===================================================================
> RCS file: /cvs/src/lib/libtls/Makefile,v
> retrieving revision 1.30
> diff -u -p -r1.30 Makefile
> --- lib/libtls/Makefile       25 Jan 2017 23:53:18 -0000      1.30
> +++ lib/libtls/Makefile       29 Jan 2017 05:32:43 -0000
> @@ -6,6 +6,9 @@ SUBDIR=       man
>  .endif
>  
>  CFLAGS+= -Wall -Werror -Wimplicit
> +.if ${COMPILER_VERSION:L} != "gcc3"
> +CFLAGS+= -Wno-pointer-sign
> +.endif
>  CFLAGS+= -DLIBRESSL_INTERNAL
>  
>  CLEANFILES= ${VERSION_SCRIPT}
> Index: usr.sbin/ocspcheck/Makefile
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ocspcheck/Makefile,v
> retrieving revision 1.2
> diff -u -p -r1.2 Makefile
> --- usr.sbin/ocspcheck/Makefile       24 Jan 2017 09:25:27 -0000      1.2
> +++ usr.sbin/ocspcheck/Makefile       29 Jan 2017 05:27:10 -0000
> @@ -1,5 +1,7 @@
>  #    $OpenBSD: Makefile,v 1.2 2017/01/24 09:25:27 deraadt Exp $
>  
> +.include <bsd.own.mk>
> +
>  PROG=        ocspcheck
>  MAN= ocspcheck.8
>  
> @@ -15,6 +17,9 @@ CFLAGS+= -Wshadow
>  CFLAGS+= -Wtrigraphs
>  CFLAGS+= -Wuninitialized
>  CFLAGS+= -Wunused
> +.if ${COMPILER_VERSION:L} != "gcc3"
> +CFLAGS+= -Wno-pointer-sign
> +.endif
>  
>  CFLAGS+= -DLIBRESSL_INTERNAL
>  
> 

Reply via email to