Received: from eggs.gnu.org ([208.118.235.92]:53068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAe2V-0001XV-Ar for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:10:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAe2Q-0001Mb-LS for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:10:34 -0400 Received: from 204.146.238.178.in-addr.arpa ([178.238.146.204]:37947 helo=mail.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAe2Q-0001MH-Dy for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:10:30 -0400 Message-ID: <4F6AEC85.2010401@nowonline.co.uk> Date: Thu, 22 Mar 2012 09:10:29 +0000 From: Lee Essen MIME-Version: 1.0 References: <4F6A0AFF.10805@nowonline.co.uk> <20120322082849.GB10257@stefanha-thinkpad.localdomain> In-Reply-To: <20120322082849.GB10257@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] tracetool: cast const types to avoid compile time warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: =?ISO-8859-1?Q?Andreas_F=E4rber?= , qemu-devel@nongnu.org, Stefan Hajnoczi On 22/03/2012 08:28, Stefan Hajnoczi wrote: > On Wed, Mar 21, 2012 at 05:08:15PM +0000, Lee Essen wrote: >> On Solaris/Illumos dtrace will remove the "const" qualifier from any >> arguments when producing the header file, this results in hundreds >> of compile-time warnings. > > I wonder why DTrace does this, it seems wrong. If anything it should be > the other way around with all DTrace arguments becoming const :). Will > you submit a patch to preserve const in upstream DTrace? I have asked the Illumos dev-list what the reasoning is. If it turns out to be a bug then I'll see what I can do about a fix, although it will be an illumos fix rather than a Solaris fix - so we'll still need a solution for generic Solaris. > >> I have put together a patch to tracetool to cast any const argument >> appropriately to remove the warnings, but I don't know how it >> behaves on any other dtrace platform. If the "const" isn't removed >> then this patch will actually create warnings. > > Why would it introduce warnings, maybe I'm misunderstanding? > > The following generated .h code should work without warnings whether > the DTRACE_FOO() is const char* or char*: > > void trace_foo(const char *s) > { > DTRACE_FOO((char *)s); > } Hmmm ... yes, you're right, I wasn't thinking straight. This is good since it means we can use the same approach without breaking anything. I'll let you know what the illumos-dev response is. Cheers, Lee.