Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Apr 2012 21:55:45 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        "O. Hartmann" <ohartman@zedat.fu-berlin.de>
Cc:        Current FreeBSD <freebsd-current@freebsd.org>
Subject:   Re: usr/src/sys/modules/nxge/../../dev/nxge/if_nxge.c:1289:11: error: case value not in enumerated type 'xge_hal_event_e' (aka 'enum xge_hal_event_e') [-Werror,-Wswitch],            case XGE_LL_EVENT_DEVICE_RESETTING:
Message-ID:  <4F8DCAC1.5040507@FreeBSD.org>
In-Reply-To: <4F8DC447.3080105@zedat.fu-berlin.de>
References:  <4F8DC447.3080105@zedat.fu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090206040805000401090105
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 2012-04-17 21:28, O. Hartmann wrote:
> Compiling the most recent kernel sources results in the following error.
> OS is:
>
> FreeBSD 10.0-CURRENT #3 r234326: Mon Apr 16 00:47:35 CEST 2012
>
> ===>  nxge (all)
> clang -O2 -fno-strict-aliasing -pipe -pipe -O3 -fno-strict-aliasing
> -march=native -DXGE_DEBUG_MODULE_MASK=XGE_COMPONENT_LL
> -DXGE_DEBUG_ERR_MASK=XGE_COMPONENT_LL -Werror -D_KERNEL -DKLD_MODULE
> -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include
> /usr/obj/usr/src/sys/THOR/opt_global.h -I. -I@ -I@/contrib/altq
> -fno-common  -fno-omit-frame-pointer -I/usr/obj/usr/src/sys/THOR
> -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse
> -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
> -fstack-protector -std=iso9899:1999 -Qunused-arguments -fstack-protector
> -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
> -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
> -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
> -fdiagnostics-show-option  -Wno-error-tautological-compare
> -Wno-error-empty-body  -Wno-error-parentheses-equality -Wno-self-assign
> -c /usr/src/sys/modules/nxge/../../dev/nxge/if_nxge.c
> /usr/src/sys/modules/nxge/../../dev/nxge/if_nxge.c:1276:11: error: case
> value not in enumerated type 'xge_hal_event_e' (aka 'enum
> xge_hal_event_e') [-Werror,-Wswitch]
>              case XGE_LL_EVENT_TRY_XMIT_AGAIN:
>                   ^
> /usr/src/sys/modules/nxge/../../dev/nxge/if_nxge.c:1289:11: error: case
> value not in enumerated type 'xge_hal_event_e' (aka 'enum
> xge_hal_event_e') [-Werror,-Wswitch]
>              case XGE_LL_EVENT_DEVICE_RESETTING:
>                   ^

Yes, this is expected.  I imported a new clang snapshot, which has more
elaborate checks on switches in combinations with enums.

There are several other problems like this, the fixes are in the
pipeline.  But for the fix for this particular error in nxge, I didn't
yet receive enough feedback.

For now, please set WERROR= in your src.conf, or apply the attached
patch to your source tree.

--------------090206040805000401090105
Content-Type: text/x-diff;
 name="clang-3.1-werror-fix-1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="clang-3.1-werror-fix-1.diff"

Index: sys/contrib/rdma/rdma_cma.c
===================================================================
--- sys/contrib/rdma/rdma_cma.c	(revision 234390)
+++ sys/contrib/rdma/rdma_cma.c	(working copy)
@@ -1252,7 +1252,7 @@ static int cma_iw_handler(struct iw_cm_id *iw_id,
 		*sin = iw_event->local_addr;
 		sin = (struct sockaddr_in *) &id_priv->id.route.addr.dst_addr;
 		*sin = iw_event->remote_addr;
-		switch (iw_event->status) {
+		switch ((int)iw_event->status) {
 		case 0:
 			event.event = RDMA_CM_EVENT_ESTABLISHED;
 			break;
Index: sys/dev/dpt/dpt.h
===================================================================
--- sys/dev/dpt/dpt.h	(revision 234390)
+++ sys/dev/dpt/dpt.h	(working copy)
@@ -142,7 +142,7 @@ typedef void *physaddr;
  */
 #define DPT_NO_CACHE		       	0
 #define DPT_CACHE_WRITETHROUGH		1
-#define DPT_CACHE_WRITEBACK			-2
+#define DPT_CACHE_WRITEBACK		2
 
 #define min(a,b) ((a<b)?(a):(b))
 
Index: sys/dev/nxge/if_nxge.c
===================================================================
--- sys/dev/nxge/if_nxge.c	(revision 234390)
+++ sys/dev/nxge/if_nxge.c	(working copy)
@@ -1272,7 +1272,7 @@ xge_callback_event(xge_queue_item_t *item)
 	lldev  = xge_hal_device_private(hldev);
 	ifnetp = lldev->ifnetp;
 
-	switch(item->event_type) {
+	switch((int)item->event_type) {
 	    case XGE_LL_EVENT_TRY_XMIT_AGAIN:
 	        if(lldev->initialized) {
 	            if(xge_hal_channel_dtr_count(lldev->fifo_channel[0]) > 0) {
Index: sys/dev/asr/asr.c
===================================================================
--- sys/dev/asr/asr.c	(revision 234390)
+++ sys/dev/asr/asr.c	(working copy)
@@ -2417,8 +2417,9 @@ asr_attach(device_t dev)
 	 */
 	LIST_INIT(&(sc->ha_ccb));
 	/* Link us into the HA list */
-	for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next));
-		*(ha) = sc;
+	for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next))
+		;
+	*(ha) = sc;
 
 	/*
 	 *	This is the real McCoy!
@@ -2700,7 +2701,7 @@ asr_action(struct cam_sim *sim, union ccb  *ccb)
 
 	ccb->ccb_h.spriv_ptr0 = sc = (struct Asr_softc *)cam_sim_softc(sim);
 
-	switch (ccb->ccb_h.func_code) {
+	switch ((int)ccb->ccb_h.func_code) {
 
 	/* Common cases first */
 	case XPT_SCSI_IO:	/* Execute the requested I/O operation */

--------------090206040805000401090105--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F8DCAC1.5040507>