From owner-freebsd-current Wed Jan 29 1: 0:22 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9575F37B401 for ; Wed, 29 Jan 2003 01:00:20 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id C639F43F3F for ; Wed, 29 Jan 2003 01:00:19 -0800 (PST) (envelope-from phk@freebsd.org) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id h0T90IZE006475 for ; Wed, 29 Jan 2003 10:00:18 +0100 (CET) (envelope-from phk@freebsd.org) To: current@freebsd.org Subject: Please don't define away DEBUGPRINTF and similar... From: Poul-Henning Kamp Date: Wed, 29 Jan 2003 10:00:18 +0100 Message-ID: <6474.1043830818@critter.freebsd.dk> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I am currently letting FlexeLint loose on the kernel again, and I have turned my attention to a new warning from it: _ return (err); ../../../dev/usb/usb_subr.c 604 Warning 548: else expected Initally I ignored these warnings because the couple of them which I looked at were actually ok, but now that I looked through all of them I uncovered a couple of bugs which all follow the same pattern, which I think I can best illustrate by quoting a randomly chosen case: #ifdef USB_DEBUG #define DPRINTF(x) if (usbdebug) logprintf x #define DPRINTFN(n,x) if (usbdebug>(n)) logprintf x extern int usbdebug; #else #define DPRINTF(x) #define DPRINTFN(n,x) #endif [...] if (index == USB_UNCONFIG_INDEX) { /* We are unconfiguring the device, so leave unallocated. */ DPRINTF(("usbd_set_config_index: set config 0\n")); err = usbd_set_config(dev, USB_UNCONFIG_NO); if (err) DPRINTF(("usbd_set_config_index: setting config=0 " "failed, error=%s\n", usbd_errstr(err))); return (err); } Please be more careful. Here are the places this warning occurs in GENERIC: ../../../dev/amr/amr_cam.c 566 Warning 548: else expected ../../../dev/amr/amr_cam.c 629 Warning 548: else expected ../../../dev/amr/amr.c 515 Warning 548: else expected ../../../dev/em/if_em_hw.c 2166 Warning 548: else expected ../../../dev/em/if_em_hw.c 2237 Warning 548: else expected ../../../dev/usb/ums.c 594 Warning 548: else expected ../../../dev/usb/usb_subr.c 604 Warning 548: else expected ../../../dev/usb/usbdi.c 974 Warning 548: else expected ../../../dev/usb/usbdi.c 1034 Warning 548: else expected ../../../kern/kern_switch.c 448 Warning 548: else expected -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message