This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: cpp command overwrites input files
- To: Richard Earnshaw <rearnsha at arm dot com>, egcs-bugs at egcs dot cygnus dot com
- Subject: Re: cpp command overwrites input files
- From: Zack Weinberg <zack at rabi dot columbia dot edu>
- Date: Sat, 26 Jun 1999 13:08:25 -0400
>I've been trying to test gcc-2.95 by trying to build the NetBSD world for
>the ARM with it, and I've found a nasty gotcha in the new cpp front-end.
>One of the build utils in the NetBSD tree uses the cpp to pre-process
>certain include files with the command
>
> cpp -nostdinc -idirafter /usr/include -dM /usr/include/sys/ioctl.h
>/usr/include/sys/ioctl_compat.h
[... and this now will overwrite ioctl_compat.h ...]
I find it difficult to believe that this command ever worked.
/usr/lib/gcc-lib/TARGET/VERSION/cpp has treated its second non-option
argument as the output file, not another input file, for as far back as the
ChangeLog goes. Until gcc-2.95, /bin/cpp was identical with
/u/l/g-l/T/V/cpp. I suppose this might have been some magic property of
-dM, but it was never documented and shouldn't have been relied on.
The NetBSD utility should do
cpp -nostdinc -idirafter /usr/include -dM -include /usr/include/sys/ioctl.h \
-include /usr/include/sys/ioctl_compat.h </dev/null
which will work with gcc-2.95 and with previous versions. (If your target
specs are correct, you shouldn't need the -nostdinc -idirafter ... bit.)
>BTW "cpp -o -" doesn't write to stdout, nor does cpp -E.
My copy does. Are you sure?
zw