Mail Archives: djgpp-workers/2000/05/01/02:17:55
On Sun, Apr 30, 2000 at 09:08:28PM +0300, Laurynas Biveinis wrote:
> 2) C preprocessor (read_include_file() in cppfiles.c) fails to do
> anything under DJGPP because DJGPP does not support
> fcntl(..., F_SETFL, ...).
> I made a fix similar to code present in libgcc2.c, __bb_exit_func(),
> with new target macro.
...
> * cppfiles.c (read_include_file): call fcntl(fd, F_SETFL, 0) only if
> macro TARGET_HAS_F_SETFL defined.
This is the wrong approach, because:
- fcntl() working is a characteristic of the _host_, not the target.
- You should determine if it works using an autoconf test.
- If it doesn't work, you need to open the file in blocking mode, not
just elide the fcntl(); otherwise the code reading the file will
break.
This fcntl() is there to avoid a problem that never happens in real
life: someone does #include </dev/rmt0> and the preprocessor gets
wedged because there's no tape. Further, I think if someone actually
does include /dev/rmt0, we'll get stuck anyway, because the check
later on for a sensible file permits all character devices.
Therefore, I'd be willing to dump the fcntl() call entirely and open
the file in blocking mode on all hosts. Does anyone else have an
opinion?
zw
- Raw text -