aboutsummaryrefslogtreecommitdiff
path: root/gcc/protoize.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1994-10-04 20:53:02 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1994-10-04 20:53:02 +0000
commit0b90f9c2dcde31078698a862dfcaaf5cc563ea94 (patch)
tree8a014280d417c4ddd255ddba5eab01de2180301a /gcc/protoize.c
parent713225d41db4603c3b42a96b7017190088f05623 (diff)
downloadgcc-0b90f9c2dcde31078698a862dfcaaf5cc563ea94.zip
gcc-0b90f9c2dcde31078698a862dfcaaf5cc563ea94.tar.gz
gcc-0b90f9c2dcde31078698a862dfcaaf5cc563ea94.tar.bz2
If the POSIX.1 wait macros are defined, use them.
From-SVN: r8213
Diffstat (limited to 'gcc/protoize.c')
-rw-r--r--gcc/protoize.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 00b7638..f79871e 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -132,6 +132,19 @@ typedef char * const_pointer_type;
#define O_RDONLY 0
#define O_WRONLY 1
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
+#endif
+#ifndef WTERMSIG
+#define WTERMSIG(S) ((S) & 0x7f)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(S) (((S) & 0xff) == 0)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
+#endif
+
/* Declaring stat or __flsbuf with a prototype
causes conflicts with system headers on some systems. */
@@ -2090,16 +2103,16 @@ gen_aux_info_file (base_filename)
pname, sys_errlist[errno]);
return 0;
}
- if ((wait_status & 0x7F) != 0)
+ if (WIFSIGNALED (wait_status))
{
fprintf (stderr, "%s: subprocess got fatal signal %d",
- pname, (wait_status & 0x7F));
+ pname, WTERMSIG (wait_status));
return 0;
}
- if (((wait_status & 0xFF00) >> 8) != 0)
+ if (WIFEXITED (wait_status) && WEXITSTATUS (wait_status) != 0)
{
fprintf (stderr, "%s: %s exited with status %d\n",
- pname, base_filename, ((wait_status & 0xFF00) >> 8));
+ pname, base_filename, WEXITSTATUS (wait_status));
return 0;
}
return 1;