Bill Sommerfeld
2010-May-07 20:41 UTC
[dtrace-discuss] 6494528 D compiler has problems parsing typedef arrays in function declarations
I tripped over this bug recently. Has anyone ever attempted to fix this? - Bill
Katsunori FUJIWARA
2010-May-10 09:56 UTC
[dtrace-discuss] 6494528 D compiler has problems parsing typedef arrays in function declarations
Hi, Bill.> I tripped over this bug recently. > > Has anyone ever attempted to fix this?Temporary name for parameter in declaration seems to prevent dtrace from recognizing valid source as invalid. ===================typedef struct foo { int f1; } foo_t; /* int bar(struct foo[]); => causes compile error */ int bar(foo_t a[]); BEGIN { exit(0); } =================== Grammer definition in dt_grammer.y seems to have problem around "parameter declaration" syntax, but I do not yet find it out. -- This message posted from opensolaris.org
Katsunori FUJIWARA
2010-May-10 10:04 UTC
[dtrace-discuss] 6494528 D compiler has problems parsing typedef arrays in function declarations
Hi, Bill. Sorry for my redundant post, if you mean "attempted to fix" as a kind of source patch or fundamental workaround other than giving temporary name to declaration.> Temporary name for parameter in declaration seems to > prevent dtrace > from recognizing valid source as invalid. > > ===================> typedef struct foo { > int f1; > o_t; > > /* int bar(struct foo[]); => causes compile error */ > int bar(foo_t a[]); > > BEGIN { > exit(0); > ==================> > Grammer definition in dt_grammer.y seems to have > problem around > "parameter declaration" syntax, but I do not yet find > it out.-- This message posted from opensolaris.org
Katsunori FUJIWARA
2010-May-10 16:46 UTC
[dtrace-discuss] 6494528 D compiler has problems parsing typedef arrays in function declarations
Hi, Bill. I found the cause of this problem in the train to home :-) Tokenizer generated from dt_lex.l source recognizes token before "[]" as IDENTIFIER, even though it is placed at type name position. So, "bar(foo_t[])" means that parameter named as "foot_t" has no type information, and causes compilation failure. I confirmed that attached patch can fix this problem on onnv_111(OpenSolaris 2009.06) environment. # but may cause another problem :-P If you have source tree to build libdtrace.so, please apply the patch, build libdtrace.so, and replace libdtrace.so by new one. # LD_PRELOAD_32/64 are usefull for safe temporary replacement -- This message posted from opensolaris.org -------------- next part -------------- A non-text attachment was scrubbed... Name: 6494528.patch Type: application/octet-stream Size: 360 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20100510/4bf4e94b/attachment.obj>