qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] tracetool: cast const types to avoid compile time warni


From: Lee Essen
Subject: Re: [Qemu-devel] tracetool: cast const types to avoid compile time warnings
Date: Thu, 22 Mar 2012 09:10:29 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]