This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch lto-plugin]: Don't use sys/wait.h for mingw targets
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
--
|? (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
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"