Re: bin/60642: dtrace(1): doesn't call preprocessor correctly

"RVP via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
The following reply was made to PR bin/60642; it has been noted by GNATS.

From: RVP <[email protected]>
To: [email protected]
Cc: 
Subject: Re: bin/60642: dtrace(1): doesn't call preprocessor correctly
Date: Tue, 25 Aug 2026 13:25:09 +0000 (UTC)

 On Tue, 25 Aug 2026, [email protected] via gnats wrote:
 
 >> Description:
 > When compiling wip/modular-xorg-server with the (disabled-on-NetBSD)
 > dtrace option, you'll see
 >
 > [1/647] Generating 'dix/liblibxserver_dix.a.p/Xserver-dtrace.h'
 > FAILED: [code=1] dix/liblibxserver_dix.a.p/Xserver-dtrace.h
 > /usr/sbin/dtrace -h -s ../include/Xserver.d -o dix/liblibxserver_dix.a.p/Xserver-dtrace.h
 > dtrace: failed to compile script ../include/Xserver.d: "/usr/lib/dtrace/psinfo.d", line 46: syntax error near "u_int"
 >
 
 This is PR bin/58630 (and also toolchain/58682).
 
 > I've fixed this problem by removing psinfo.d from the NetBSD base system,
 > since it uses `u_int` and `struct proc` but nothing defines it.
 >
 
 Please put that back :)
 
 > dtrace: failed to compile script ../include/Xserver.d: line 26: invalid control directive: #ifdef
 >
 > The code is (after some comments):
 >
 > #ifdef __APPLE__
 > #define string char *
 > #define pid_t uint32_t
 > #define zoneid_t uint32_t
 > #elif defined(__FreeBSD__)
 > #define zoneid_t id_t
 > #else
 > #include <sys/types.h>
 > #endif
 >
 > Changing '#ifdef' to #if' doesn't fix this.
 >
 
 NetBSD defines an `id_t', like FreeBSD, so you can change that conditional to:
 
 ```
 #elif defined(__FreeBSD__) || defined(__NetBSD__)
 ```
 
 > I assume dtrace should call a c preprocessor to handle this, which
 > is why I chose the subject.
 >
 
 Add a `-C' to the dtrace command-line.
 
 -RVP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.