root@srv0:~ # cat test.d #include <sys/socket.h> tcp:::accept-established { } root@srv0:~ # dtrace -C -s test.d dtrace: failed to compile script test.d: line 1: typedef redeclared: __uint8_t root@srv0:~ # dtrace -H -C -s test.d . /usr/include/sys/socket.h .. /usr/include/sys/cdefs.h .. /usr/include/sys/_types.h ... /usr/include/machine/_types.h .... /usr/include/x86/_types.h ..... /usr/include/machine/_limits.h ...... /usr/include/x86/_limits.h .. /usr/include/sys/_iovec.h .. /usr/include/machine/_align.h ... /usr/include/x86/_align.h .. /usr/include/sys/_sockaddr_storage.h dtrace: failed to compile script test.d: line 1: typedef redeclared: __uint8_t root@srv0:~ #
Has this example ever worked on FreeBSD? The problem isn't with duplicate typedefs; those are errors in C as well. In dt_parser.c we have: 1451 /* 1452 * If we are nested inside of a C include file, add the declaration to 1453 * the C definition module; otherwise use the D definition module. 1454 */ 1455 if (yypcb->pcb_idepth != 0) 1456 dmp = dtp->dt_cdefs; 1457 else 1458 dmp = dtp->dt_ddefs; When we hit the error, we're actually using ddefs instead of cdefs, which is incorrect according to the comment. How is pcb_idepth set? It's adjusted when we see line control directives emitted by the processor, but it looks like our version of the D lexer isn't handling this properly somehow.