From: Zack Weinberg Date: Mon, 1 May 2000 00:09:28 -0700 To: Laurynas Biveinis Cc: gcc-patches AT gcc DOT gnu DOT org, DJGPP Workers Subject: Re: Minor DJGPP fixes Message-ID: <20000501000928.J11780@wolery.cumb.org> References: <390C769C DOT 812EAB7D AT softhome DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.1.12i In-Reply-To: <390C769C.812EAB7D@softhome.net>; from lauras@softhome.net on Sun, Apr 30, 2000 at 09:08:28PM +0300 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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 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