At 19:00 -0800 19/11/07, Rich Morin wrote:
>#define S(x) self->arg/**/x = arg/**/x

Yikes!  I'm astonished that folks still uses this sort of pre-ANSI 
stuff.  You sure you can't switch your macro to use ##?  That seems 
like the most forward-looking solution.

At 22:03 -0800 19/11/07, Bryan Cantrill wrote:
>There is a page that has Leopard src:
>
>   http://www.opensource.apple.com/darwinsource/10.5/
>
>But the DTrace link is dead.  I've mailed the Apple folks directly,
>but I know they're here as well, so Apple folks:  please provide us
>the link to the 10.5 DTrace source so we can figure out what exactly
>the bug is here...

Alas, the lights are on but nobody is home (-:  Most of Apple is 
taking this week off.  We get an extra three days of vacation as a 
reward for earning a bazillion dollars last year.  US-based employees 
are combining these three extra days with the traditional US 
Thanksgiving holiday, the end result being that they have the whole 
week off.

I'm still working 'cause I'm not based on the US.  I'll take the days 
at Christmas thank you very much (-:

Sorry that the Mac OS X DTrace sources aren't up.  I presume that the 
folks that Bryan contacted will fix this when they get back from 
vacation.

Looking at the source that I have access to, it seems that there are 
quite a few Apple-specific changes in this space.  You can see how 
DTrace invokes the C pre-processor using the DYLD_PRINT_OPTS 
environment variable:

$ sudo env DYLD_PRINT_OPTS=1 dtrace -C -s test.d
[...]
opt[0] = "gcc"
opt[1] = "-E"
opt[2] = "-xc"
opt[3] = "-U__GNUC__"
opt[4] = "-include"
opt[5] = "/usr/lib/dtrace/dt_cpp.h"
opt[6] = "-D__APPLE__"
opt[7] = "-D__SUNW_D=1"
opt[8] = "-D__SUNW_D_32"
opt[9] = "-D__Darwin_9_0_0"
opt[10] = "-D__i386__"
opt[11] = "-D__SUNW_D_VERSION=0x01002002"
opt[12] = "-o"
opt[13] = "/dev/fd/6"
opt[14] = "/dev/fd/5"
[...]

These options cause GCC to run in ANSI mode rather than traditional 
mode.  In normal C code you can tell GCC to use traditional 
pre-processor semantics by passing in the "-traditional-cpp" option. 
However, I can't see any way to get DTrace to pass an arbitrary 
option through to the preprocessor.  As such, I don't think there's a 
solution for this other than to preprocessor the file (using either 
GCC or /usr/bin/cpp) yourself, applying "-traditional-cpp" when you 
invoke the tool.

Also, while it seems that -X is not supported by our DTrace, -x 
std=XXX is.  Alas, it does not actually have any effect on how we 
invoke the preprocessor.  Looks like Mac OS X DTrace has irreversibly 
moved into the ... late eighties (-:

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to