I''m having a problem with -C flag. Any help or suggestions is very
welcome.
Here is a simple D-script.
typedef unsigned long nfds_t;
BEGIN
{
trace("success\n");
}
# dtrace -Cs test.d
dtrace: failed to compile script test.d: line 1: invalid type
declaration: signed and unsigned may only be used with integer type
Now if I change the typedef variable to xx_t then the problem goes
away (ie)
typedef unsigned long xx_t;
BEGIN
{
trace("success\n");
}
# dtrace -Cs test.d
No error!
Also if I put the same line in a header file and do an #include in the
d-script the problem goes away.
So is this a bug,
Thanks,
Angelo
Angelo Rajadurai wrote:> typedef unsigned long nfds_t; > > # dtrace -Cs test.d > dtrace: failed to compile script test.d: line 1: invalid type > declaration: signed and unsigned may only be used with integer type > > Now if I change the typedef variable to xx_t then the problem goes > away (ie) > > typedef unsigned long xx_t;Out of curiosity, if you try to declare a variable of type nfds_t (no typedef) what happens? I wonder if dtrace thinks it already knows what an nfds_t is? Ryan
Hi Ryan:
Thanks for the reply.
I get the exact same error (dtrace: failed to compile script test.d:
line 1: invalid type declaration: signed and unsigned may only be used
with integer type) when I remove the typedef.
Also if I put the typedef declaration in a separate .h file and
#include it from within my .d file the problem goes away.
test.h
typedef unsigned long nfds_t;
test.d
#include test.h
BEGIN
{
trace("success\n");
}
# dtrace -Cs test.d -I.
does not have a problem
Also this problem only happens on Solaris/Opensolaris and not on OS X.
-Angelo
On May 1, 2009, at 3:52 AM, Ryan Johnson wrote:
> Angelo Rajadurai wrote:
>> typedef unsigned long nfds_t;
>>
>> # dtrace -Cs test.d
>> dtrace: failed to compile script test.d: line 1: invalid type
>> declaration: signed and unsigned may only be used with integer type
>>
>> Now if I change the typedef variable to xx_t then the problem goes
>> away (ie)
>>
>> typedef unsigned long xx_t;
> Out of curiosity, if you try to declare a variable of type nfds_t
> (no typedef) what happens? I wonder if dtrace thinks it already
> knows what an nfds_t is?
>
> Ryan
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
After a bit of playing around it appears that dtrace doesn''t implicitly expand ''long'' to its real type (which is ''long int'') and the missing ''int'' triggers the error. For example: typedef unsigned u; // error typedef unsigned int ui; // works typedef unsigned long; // error typedef unsigned long int uli; // works I have no clue why the problem wouldn''t affect header files, though. Ryan
Thanks Ryan, This also does not explain why changing nfds_t to xx_t also has no problem. typedef unsigned long nfds_t; // error typedef unsigned long xx_t; // works -Angelo On May 1, 2009, at 4:26 AM, Ryan Johnson wrote:> After a bit of playing around it appears that dtrace doesn''t > implicitly expand ''long'' to its real type (which is ''long int'') and > the missing ''int'' triggers the error. For example: > > typedef unsigned u; // error > typedef unsigned int ui; // works > > typedef unsigned long; // error > typedef unsigned long int uli; // works > > I have no clue why the problem wouldn''t affect header files, though. > > Ryan > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org