This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix file descriptor existence of MinGW.
On 8/6/19 9:55 AM, Martin Liška wrote:
On 8/6/19 5:35 PM, Martin Sebor wrote:
On 8/6/19 6:04 AM, Martin Liška wrote:
The patch is about proper checking of file descriptors on Windows.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Is there a way to share the definition of the new function so
it doesn't have to be duplicated?
I would like to, but I'm wondering which header and source file
should I use for it?
I'm not sure. It's a general purpose function that could go
in some utility library like libiberty but I don't know what
the process for enhancing it is to tell if that's appropriate.
Other than that, I'm wondering if the guard for F_GETFD is
necessary and when (the original code didn't guard its use).
Because the value is not defined on MinGW targets where _get_osfhandle
call must be used ;)
I was unclear -- sorry. What I meant was: since there is
a check for MinGW, is the check for F_GETFD necessary, or
would this be sufficient and preferable?
return _get_osfhandle (fd) != -1;
return fcntl (fd, F_GETFD) >= 0;
That way it's clear that only two possibilities are expected.
@Pekka: Can you please test it on Windows?
Ready to be installed?
2019-08-06 Martin Liska <firstname.lastname@example.org>
* gcc.c (fd_exists): New.
(driver::detect_jobserver): Use fd_exists.
* lto-wrapper.c (fd_exists): New.
(jobserver_active_p): Use fd_exists.
gcc/gcc.c | 19 +++++++++++++++++--
gcc/lto-wrapper.c | 19 +++++++++++++++++--
2 files changed, 34 insertions(+), 4 deletions(-)