[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#754799: kfreebsd-10: Please update the clang dependency from 3.3 to 3.4



On 14/07/14 15:08, Steven Chamberlain wrote:
> [...] 10.0 is very likely to work with clang-3.4, and 10-STABLE
> already been heavily tested with it, perhaps only needing some small
> changes backported to 10.0, if anything.

Well, I tried and it was much more work than I expected.  FreeBSD likes
to compile with -Werror but clang-3.4 introduced new warnings that
trigger in dozens of places - dead code that's been there for years.

I eventually gave up on trying to backport all the cleanup commits from
10-STABLE, and decided it was easier and probably safe to just ignore
the new warnings with -Wno-error flags instead.

I saw nothing to suggest the new optimisations in clang-3.4 at -O2 level
were a problem.

Attached patches allow a 10.0 kernel to build with clang-3.4 (after
installing it, and adjusting debian/control).  Maybe we should put
something like this in experimental for now - in that case perhaps with
DEBUG options turned back on - it would be a good baseline for when we
have 10.1 BETA builds.

Depending how soon the clang-3.3 removal ought to happen, after some
testing in experimental, we could upload a 10.0 built with clang-3.4 and
these patches (but no DEBUG options) to sid.

Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
Description:
 Pick SVN r259991 from 10-STABLE to fix a -Wnon-literal-null-conversion

--- kfreebsd-10-10.0.orig/sys/vm/vm_pageout.c
+++ kfreebsd-10-10.0/sys/vm/vm_pageout.c
@@ -1693,7 +1693,7 @@
 		}
 	}
 #endif
-	vm_pageout_worker((uintptr_t)0);
+	vm_pageout_worker((void *)(uintptr_t)0);
 }
 
 /*
Description:
 Use -Wno-error-unused-const-variable because Clang 3.4 revealed many of
 these, too many to be worth backporting, and some code compiled only by
 Debian (e.g. IPFILTER) has not been cleaned up yet.
 .
 Use -Wno-error-unused-function because Clang 3.4 revealed many of these
 and not all have been cleaned up yet upstream.

--- kfreebsd-10-10.0.orig/sys/conf/kern.mk
+++ kfreebsd-10-10.0/sys/conf/kern.mk
@@ -29,7 +29,8 @@
 # enough to error out the whole kernel build.  Display them anyway, so there is
 # some incentive to fix them eventually.
 CWARNEXTRA?=	-Wno-error-tautological-compare -Wno-error-empty-body \
-		-Wno-error-parentheses-equality ${NO_WFORMAT}
+		-Wno-error-parentheses-equality -Wno-error-unused-function \
+		-Wno-error-unused-const-variable ${NO_WFORMAT}
 .endif
 
 # External compilers may not support our format extensions.  Allow them
Description:
 Pick SVN r260495 from 10-STABLE to avoid __wchar_t typedef conflict
 if -fms-extensions is used together with Clang 3.4
Author: <dim@freebsd.org>

--- kfreebsd-10-10.0.orig/sys/conf/kern.pre.mk
+++ kfreebsd-10-10.0/sys/conf/kern.pre.mk
@@ -99,6 +99,8 @@
 
 .if ${COMPILER_TYPE} == "clang"
 CLANG_NO_IAS= -no-integrated-as
+.else
+GCC_MS_EXTENSIONS= -fms-extensions
 .endif
 
 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
@@ -157,7 +159,7 @@
 # Infiniband C flags.  Correct include paths and omit errors that linux
 # does not honor.
 OFEDINCLUDES=	-I$S/ofed/include/
-OFEDNOERR=	-Wno-cast-qual -Wno-pointer-arith -fms-extensions
+OFEDNOERR=	-Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
 OFEDCFLAGS=	${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
 OFED_C_NOIMP=	${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
 OFED_C=		${OFED_C_NOIMP} ${.IMPSRC}
--- kfreebsd-10-10.0.orig/sys/modules/drm2/radeonkms/Makefile
+++ kfreebsd-10-10.0/sys/modules/drm2/radeonkms/Makefile
@@ -103,7 +103,6 @@
 	iicbus_if.h							\
 	pci_if.h
 
-CFLAGS  += -I${.CURDIR}/../../../dev/drm2/radeon			\
-	   -fms-extensions
+CFLAGS  += -I${.CURDIR}/../../../dev/drm2/radeon ${GCC_MS_EXTENSIONS}
 
 .include <bsd.kmod.mk>
--- kfreebsd-10-10.0.orig/sys/modules/ibcore/Makefile
+++ kfreebsd-10-10.0/sys/modules/ibcore/Makefile
@@ -20,4 +20,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/modules/ipoib/Makefile
+++ kfreebsd-10-10.0/sys/modules/ipoib/Makefile
@@ -28,4 +28,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/modules/mlx4/Makefile
+++ kfreebsd-10-10.0/sys/modules/mlx4/Makefile
@@ -26,4 +26,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/modules/mlx4ib/Makefile
+++ kfreebsd-10-10.0/sys/modules/mlx4ib/Makefile
@@ -31,4 +31,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/modules/mlxen/Makefile
+++ kfreebsd-10-10.0/sys/modules/mlxen/Makefile
@@ -25,4 +25,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/modules/mthca/Makefile
+++ kfreebsd-10-10.0/sys/modules/mthca/Makefile
@@ -28,4 +28,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/ofed/drivers/infiniband/hw/mlx4/Makefile
+++ kfreebsd-10-10.0/sys/ofed/drivers/infiniband/hw/mlx4/Makefile
@@ -28,4 +28,4 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
--- kfreebsd-10-10.0.orig/sys/ofed/drivers/net/mlx4/Makefile
+++ kfreebsd-10-10.0/sys/ofed/drivers/net/mlx4/Makefile
@@ -30,5 +30,5 @@
 
 .include <bsd.kmod.mk>
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
 

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: