aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-01-07 01:18:08 -0500
committerMike Frysinger <vapier@gentoo.org>2021-01-07 01:19:49 -0500
commit1861f7cfbf7d3a2bf1c7746dc2c95b09fa351891 (patch)
tree7c08075755cb46d35a4607a51444b9fdc3fbc8ef
parent2652cfad8d9d6ab05fe6296802ec499682a00749 (diff)
downloadbinutils-1861f7cfbf7d3a2bf1c7746dc2c95b09fa351891.zip
binutils-1861f7cfbf7d3a2bf1c7746dc2c95b09fa351891.tar.gz
binutils-1861f7cfbf7d3a2bf1c7746dc2c95b09fa351891.tar.bz2
sim: cris: fix C tests with newer toolchains
Make sure we include unistd.h for getpid prototypes to fix build warnings/errors with newer compilers & C libraries. Doing that for close in openpf highlights these were using the wrong function -- need to use fclose on FILE*, not close. These tests pass again with a cris-elf toolchain.
-rw-r--r--sim/testsuite/sim/cris/ChangeLog8
-rw-r--r--sim/testsuite/sim/cris/c/kill2.c2
-rw-r--r--sim/testsuite/sim/cris/c/openpf1.c2
-rw-r--r--sim/testsuite/sim/cris/c/openpf2.c2
-rw-r--r--sim/testsuite/sim/cris/c/pipe1.c1
-rw-r--r--sim/testsuite/sim/cris/c/sched1.c1
-rw-r--r--sim/testsuite/sim/cris/c/sched2.c1
-rw-r--r--sim/testsuite/sim/cris/c/sched3.c1
-rw-r--r--sim/testsuite/sim/cris/c/sched4.c1
-rw-r--r--sim/testsuite/sim/cris/c/sig5.c2
-rw-r--r--sim/testsuite/sim/cris/c/sig8.c2
11 files changed, 21 insertions, 2 deletions
diff --git a/sim/testsuite/sim/cris/ChangeLog b/sim/testsuite/sim/cris/ChangeLog
index 76dcec5..641ad7e 100644
--- a/sim/testsuite/sim/cris/ChangeLog
+++ b/sim/testsuite/sim/cris/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-07 Mike Frysinger <vapier@gentoo.org>
+
+ * kill2.c: Include unistd.h.
+ * pipe1.c, sched1.c, sched2.c, sched3.c, sched4.c, sig5.c,
+ sig8.c: Likewise.
+ * openpf1.c (main): Change close to fclose.
+ * openpf2.c: Likewise.
+
2016-01-04 Mike Frysinger <vapier@gentoo.org>
* asm/opterr1.ms: Update expected output.
diff --git a/sim/testsuite/sim/cris/c/kill2.c b/sim/testsuite/sim/cris/c/kill2.c
index 6b064e7..0a79db0 100644
--- a/sim/testsuite/sim/cris/c/kill2.c
+++ b/sim/testsuite/sim/cris/c/kill2.c
@@ -7,6 +7,8 @@
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
+#include <unistd.h>
+
int
main (void)
{
diff --git a/sim/testsuite/sim/cris/c/openpf1.c b/sim/testsuite/sim/cris/c/openpf1.c
index 1d71e0b..e0d8e5c 100644
--- a/sim/testsuite/sim/cris/c/openpf1.c
+++ b/sim/testsuite/sim/cris/c/openpf1.c
@@ -27,7 +27,7 @@ int main (int argc, char *argv[])
f = fopen (fnam, "rb");
if (f == NULL)
abort ();
- close (f);
+ fclose (f);
/* Cover another execution path. */
if (fopen ("/nonexistent", "rb") != NULL
diff --git a/sim/testsuite/sim/cris/c/openpf2.c b/sim/testsuite/sim/cris/c/openpf2.c
index fe7c265..50337b1 100644
--- a/sim/testsuite/sim/cris/c/openpf2.c
+++ b/sim/testsuite/sim/cris/c/openpf2.c
@@ -10,7 +10,7 @@ int main (int argc, char *argv[])
FILE *f = fopen ("openpf2.c", "rb");
if (f == NULL)
abort ();
- close (f);
+ fclose (f);
printf ("pass\n");
return 0;
}
diff --git a/sim/testsuite/sim/cris/c/pipe1.c b/sim/testsuite/sim/cris/c/pipe1.c
index ddc4285..735974b 100644
--- a/sim/testsuite/sim/cris/c/pipe1.c
+++ b/sim/testsuite/sim/cris/c/pipe1.c
@@ -11,6 +11,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <limits.h>
+#include <unistd.h>
int main (void)
{
diff --git a/sim/testsuite/sim/cris/c/sched1.c b/sim/testsuite/sim/cris/c/sched1.c
index 04dae4b..1b778f4 100644
--- a/sim/testsuite/sim/cris/c/sched1.c
+++ b/sim/testsuite/sim/cris/c/sched1.c
@@ -5,6 +5,7 @@
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
int main (void)
{
diff --git a/sim/testsuite/sim/cris/c/sched2.c b/sim/testsuite/sim/cris/c/sched2.c
index 5371c78..f40a19a 100644
--- a/sim/testsuite/sim/cris/c/sched2.c
+++ b/sim/testsuite/sim/cris/c/sched2.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
int main (void)
{
diff --git a/sim/testsuite/sim/cris/c/sched3.c b/sim/testsuite/sim/cris/c/sched3.c
index 601e7e0..2909a4b 100644
--- a/sim/testsuite/sim/cris/c/sched3.c
+++ b/sim/testsuite/sim/cris/c/sched3.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <unistd.h>
int main (void)
{
diff --git a/sim/testsuite/sim/cris/c/sched4.c b/sim/testsuite/sim/cris/c/sched4.c
index 57f761f..df372f2 100644
--- a/sim/testsuite/sim/cris/c/sched4.c
+++ b/sim/testsuite/sim/cris/c/sched4.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <unistd.h>
int main (void)
{
diff --git a/sim/testsuite/sim/cris/c/sig5.c b/sim/testsuite/sim/cris/c/sig5.c
index 2748aa5..f80da2b 100644
--- a/sim/testsuite/sim/cris/c/sig5.c
+++ b/sim/testsuite/sim/cris/c/sig5.c
@@ -8,6 +8,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
+#include <unistd.h>
+
int main (void)
{
kill (getpid (), SIGBUS);
diff --git a/sim/testsuite/sim/cris/c/sig8.c b/sim/testsuite/sim/cris/c/sig8.c
index 889892f..ea2d7f5 100644
--- a/sim/testsuite/sim/cris/c/sig8.c
+++ b/sim/testsuite/sim/cris/c/sig8.c
@@ -10,6 +10,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
+#include <unistd.h>
+
int main (void)
{
signal (SIGALRM, SIG_IGN);