Discussion:
dtrace -h drops const qualifier from the probe spec..
Trond Norbye
2008-03-05 09:51:32 UTC
Permalink
Hi

Is there a valid reason for why dtrace -h removes the const qualifier?

provider foo {
probe bar(const void*);
};

The signature in the generated header-file generated by dtrace -hs
foo.d looks like:

extern void __dtrace_foo___bar(void *);

Why is the const qualifier removed? Is this a bug or a "feature"?

I am getting compiler warnings since I am passing const-variables to
my probes, and I don't want to add a cast just to get rid of the
warning...

Trond
Adam Leventhal
2008-03-05 19:27:12 UTC
Permalink
Post by Trond Norbye
Hi
Is there a valid reason for why dtrace -h removes the const qualifier?
provider foo {
probe bar(const void*);
};
The signature in the generated header-file generated by dtrace -hs
extern void __dtrace_foo___bar(void *);
Why is the const qualifier removed? Is this a bug or a "feature"?
This is a bug. You filed it in 2006:

6460581 dtrace -h drops const qualifier in the generated function prototypes

It's kind of a pain to fix, but I'll try to bump it up in the queue. It should
just be a matter of tinkering with dt_decl_type(), but dealing with all the
different ways you can apply const (e.g. const char const *) will be tricky.

Adam
--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Trond Norbye
2008-03-05 20:18:28 UTC
Permalink
Post by Adam Leventhal
Post by Trond Norbye
Hi
Is there a valid reason for why dtrace -h removes the const
qualifier?
provider foo {
probe bar(const void*);
};
The signature in the generated header-file generated by dtrace -hs
extern void __dtrace_foo___bar(void *);
Why is the const qualifier removed? Is this a bug or a "feature"?
6460581 dtrace -h drops const qualifier in the generated function prototypes
It's kind of a pain to fix, but I'll try to bump it up in the queue. It should
just be a matter of tinkering with dt_decl_type(), but dealing with all the
different ways you can apply const (e.g. const char const *) will be tricky.
Thank you :-)

I had totally forgot that I filed it, and I didn't see it when I did a
quick search today.. How could I miss that! I guess that I need to get
new glasses ;)

Trond

Loading...