From owner-freebsd-current Wed Jan 29 9:28:28 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 3213537B401; Wed, 29 Jan 2003 09:28:26 -0800 (PST) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id C593A43F43; Wed, 29 Jan 2003 09:28:24 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.12.3/8.12.3) with ESMTP id h0THSNu5084206 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Wed, 29 Jan 2003 09:28:23 -0800 (PST) (envelope-from jdp@vashon.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.12.5/8.12.5/Submit) id h0THSNIB070615; Wed, 29 Jan 2003 09:28:23 -0800 (PST) (envelope-from jdp) Date: Wed, 29 Jan 2003 09:28:23 -0800 (PST) Message-Id: <200301291728.h0THSNIB070615@vashon.polstra.com> To: current@freebsd.org From: John Polstra Cc: phk@freebsd.org Subject: Re: Please don't define away DEBUGPRINTF and similar... In-Reply-To: <6474.1043830818@critter.freebsd.dk> References: <6474.1043830818@critter.freebsd.dk> Organization: Polstra & Co., Seattle, WA 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 In article <6474.1043830818@critter.freebsd.dk>, Poul-Henning Kamp wrote: > > 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); > } It's complaining because of the empty statement (";") in the if clause, I suppose. Does it shut up if you define the macros like this in the disabled case? #define DPRINTF(x) ((void)0) #define DPRINTFN(n,x) ((void)0) John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message