From owner-freebsd-current Sat Feb 20 22:10:48 1999 Delivered-To: freebsd-current@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 73E4810E60 for ; Sat, 20 Feb 1999 22:10:46 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id UAA03656; Sat, 20 Feb 1999 20:56:14 -0800 (PST) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.2/8.9.1) id UAA18273; Sat, 20 Feb 1999 20:56:14 -0800 (PST) (envelope-from jdp@polstra.com) Date: Sat, 20 Feb 1999 20:56:14 -0800 (PST) Message-Id: <199902210456.UAA18273@vashon.polstra.com> To: hibma@skylink.it Subject: Re: const char * In-Reply-To: Organization: Polstra & Co., Seattle, WA Cc: current@freebsd.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article , Nick Hibma wrote: > > With the new efforts in getting rid of all the warnings in the kernel > compiles I have a problem with the following warning: > > ../../dev/usb/ukbd.c: In function `ukbd_detach': > ../../dev/usb/ukbd.c:373: warning: cast discards `const' from pointer > target type > > produced by the following two lines in the USB code: > > (dev/usb/ukbd.c) > ukbd_detach(device_t self) > { > ... > const char *devinfo = device_get_desc(self); > ... > free((void *)devinfo, M_USB); ... > Anyone savvy enough to tell me what I need to change in the USB code to > get rid of the warning? The warning comes because "-Wcast-qual" is on the command line. I don't think there's any way to get rid of the warning without changing the declarations. In my opinion, the use of "-Wcast-qual" is bogus. Often the whole point of a cast is to remove a qualifier such as const. It's one thing to warn when that's done implicitly, and quite another thing to warn when the programmer has clearly expressed his intent through the use of a cast. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message