diff mbox

[lto-plugin] : Don't use sys/wait.h for mingw targets

Message ID AANLkTik1kzbfLFXxJuaBbRbVY9-_cbCFf9T+yLtNw-z2@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Dec. 4, 2010, 11:22 a.m. UTC
2010/12/3 Richard Henderson <rth@redhat.com>:
> On 12/02/2010 05:11 AM, Kai Tietz wrote:
>> +#ifdef HAVE_SYS_WAIT_H
>>    check (WIFEXITED (status) && WEXITSTATUS (status) == 0, LDPL_FATAL,
>>           "lto-wrapper failed");
>> -
>> +#else
>> +  check (!status, LDPL_FATAL, "lto-wrapper failed");
>> +#endif
>
> You should be using AC_HEADER_SYS_WAIT instead of a direct check
> against the header.  That will define WIFEXITED for you if needed.
> C.f. libiberty/configure.ac.

Well, I can use AC_HEADER_SYS_WAIT here instead, as it checks for
POSIX compatibility, too. But the WIFEXITED and WEXITSTATUS aren't
defined by that. See here the part in gcc/system.h for this.

        * config.h.in: Regenerated.
        * configure: Regenerated.
        * configure.ac (AC_CHECK_HEADERS): Replaced by AC_HEADER_SYS_WAIT.
        * lto-plugin.c (WIFEXITED): Define default.
        (WEXITSTATUS): Likeiwse.


Ok for apply?

Kai

Comments

Richard Henderson Dec. 5, 2010, 12:40 a.m. UTC | #1
On 12/04/2010 03:22 AM, Kai Tietz wrote:
>         * config.h.in: Regenerated.
>         * configure: Regenerated.
>         * configure.ac (AC_CHECK_HEADERS): Replaced by AC_HEADER_SYS_WAIT.
>         * lto-plugin.c (WIFEXITED): Define default.
>         (WEXITSTATUS): Likeiwse.

Ok.


r~
Kai Tietz Dec. 5, 2010, 8:07 a.m. UTC | #2
2010/12/5 Richard Henderson <rth@redhat.com>:
> On 12/04/2010 03:22 AM, Kai Tietz wrote:
>>         * config.h.in: Regenerated.
>>         * configure: Regenerated.
>>         * configure.ac (AC_CHECK_HEADERS): Replaced by AC_HEADER_SYS_WAIT.
>>         * lto-plugin.c (WIFEXITED): Define default.
>>         (WEXITSTATUS): Likeiwse.
>
> Ok.
>
>
> r~
>

Committed at revision 167468.

Thanks,
Kai
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 167453)
+++ configure.ac	(working copy)
@@ -22,7 +22,7 @@ 
 esac
 AC_TYPE_INT64_T
 AC_TYPE_UINT64_T
-AC_CHECK_HEADERS(sys/wait.h)
+AC_HEADER_SYS_WAIT
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_HEADERS(config.h)
 AC_OUTPUT
Index: lto-plugin.c
===================================================================
--- lto-plugin.c	(revision 167453)
+++ lto-plugin.c	(working copy)
@@ -50,6 +50,12 @@ 
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
+#ifndef WIFEXITED
+#define WIFEXITED(S) (((S) & 0xff) == 0)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
+#endif
 #include <libiberty.h>
 #include <hashtab.h>
 #include "../gcc/lto/common.h"