Date: Wed, 29 Jan 2003 09:28:23 -0800 (PST) From: John Polstra <jdp@polstra.com> To: current@freebsd.org Cc: phk@freebsd.org Subject: Re: Please don't define away DEBUGPRINTF and similar... Message-ID: <200301291728.h0THSNIB070615@vashon.polstra.com> In-Reply-To: <6474.1043830818@critter.freebsd.dk> References: <6474.1043830818@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <6474.1043830818@critter.freebsd.dk>, Poul-Henning Kamp <phk@FreeBSD.ORG> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301291728.h0THSNIB070615>