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.