aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-01-09 03:56:10 -0500
committerMike Frysinger <vapier@gentoo.org>2021-01-11 08:05:54 -0500
commit68ed2854284d415a71efd856a40343f550881ede (patch)
treef00f87cc7628c8e82de418bacc5d941db46c2481 /sim/common
parenta8aa72b913e78407e5de4fefd22f9b98e4466f30 (diff)
downloadgdb-68ed2854284d415a71efd856a40343f550881ede.zip
gdb-68ed2854284d415a71efd856a40343f550881ede.tar.gz
gdb-68ed2854284d415a71efd856a40343f550881ede.tar.bz2
sim: clean up C11 header includes
Since we require C11 now, we can assume many headers exist, and clean up all of the conditional includes. It's not like any of this code actually accounted for the headers not existing, just whether we could include them. The strings.h cleanup is a little nuanced: it isn't in C11, but every use of it in the codebase will include strings.h only if string.h doesn't exist. Since we now assume the C11 string.h exists, we'll never include strings.h, so we can delete it.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog13
-rw-r--r--sim/common/acinclude.m47
-rw-r--r--sim/common/callback.c10
-rw-r--r--sim/common/cgen-scache.c2
-rw-r--r--sim/common/dv-glue.c6
-rw-r--r--sim/common/dv-pal.c9
-rw-r--r--sim/common/dv-sockser.c8
-rw-r--r--sim/common/hw-alloc.c3
-rw-r--r--sim/common/hw-base.c11
-rw-r--r--sim/common/hw-device.c5
-rw-r--r--sim/common/hw-events.c2
-rw-r--r--sim/common/hw-handles.c2
-rw-r--r--sim/common/hw-ports.c10
-rw-r--r--sim/common/hw-properties.c6
-rw-r--r--sim/common/hw-tree.c10
-rw-r--r--sim/common/nrun.c7
-rw-r--r--sim/common/sim-arange.c5
-rw-r--r--sim/common/sim-events.c10
-rw-r--r--sim/common/sim-fpu.c2
-rw-r--r--sim/common/sim-hw.c9
-rw-r--r--sim/common/sim-load.c2
-rw-r--r--sim/common/sim-memopt.c10
-rw-r--r--sim/common/sim-options.c8
-rw-r--r--sim/common/sim-profile.c9
-rw-r--r--sim/common/sim-trace.c8
-rw-r--r--sim/common/sim-utils.c13
-rw-r--r--sim/common/sim-watch.c10
-rw-r--r--sim/common/syscall.c6
28 files changed, 16 insertions, 187 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index e525110..6ffee16 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,16 @@
+2021-01-11 Mike Frysinger <vapier@gentoo.org>
+
+ * acinclude.m4 (SIM_AC_COMMON): Delete checks for stdlib.h, string.h,
+ strings.h, time.h, and errno.h.
+ * callback.c, cgen-scache.c, dv-glue.c, dv-pal.c, dv-sockser.c,
+ hw-alloc.c, hw-base.c, hw-device.c, hw-events.c, hw-handles.c,
+ hw-ports.c, hw-properties.c, hw-tree.c, nrun.c, sim-arange.c,
+ sim-events.c, sim-fpu.c, sim-hw.c, sim-load.c, sim-memopt.c,
+ sim-options.c, sim-profile.c, sim-trace.c, sim-utils.c,
+ sim-watch.c, syscall.c: Delete HAVE_ERRNO_H, HAVE_STDLIB_H,
+ HAVE_STRING_H, HAVE_STRINGS_H, HAVE_LIMITS_H, HAVE_TIME_H,
+ and strings.h include.
+
2021-01-09 Mike Frysinger <vapier@gentoo.org>
* sim-basics.h [__CYGWIN32__] (vasprintf, asprintf): Delete.
diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index b2297df..45ec134 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -98,12 +98,11 @@ ALL_LINGUAS=
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
# Check for common headers.
-# FIXME: Seems to me this can cause problems for i386-windows hosts.
-# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
-AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
+# NB: You can assume C11 headers exist.
+AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/resource.h sys/mman.h)
AC_CHECK_HEADERS(fcntl.h fpu_control.h)
-AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
+AC_CHECK_HEADERS(dlfcn.h sys/stat.h)
AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
AC_CHECK_FUNCS(mmap munmap lstat truncate ftruncate posix_fallocate)
AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 5172d97..f9e848f 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -26,20 +26,10 @@
#include "ansidecl.h"
#include <stdarg.h>
#include <stdio.h>
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_LIMITS_H
/* For PIPE_BUF. */
#include <limits.h>
-#endif
#include <errno.h>
#include <fcntl.h>
#include <time.h>
diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c
index 42068a3..56df075f 100644
--- a/sim/common/cgen-scache.c
+++ b/sim/common/cgen-scache.c
@@ -20,9 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define SCACHE_DEFINE_INLINE
#include "sim-main.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#include "libiberty.h"
#include "sim-options.h"
#include "sim-io.h"
diff --git a/sim/common/dv-glue.c b/sim/common/dv-glue.c
index 9319b19..8bda326 100644
--- a/sim/common/dv-glue.c
+++ b/sim/common/dv-glue.c
@@ -22,13 +22,7 @@
#include "hw-main.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
/* DEVICE
diff --git a/sim/common/dv-pal.c b/sim/common/dv-pal.c
index 66a916c..dd4ab4f 100644
--- a/sim/common/dv-pal.c
+++ b/sim/common/dv-pal.c
@@ -28,20 +28,11 @@
its immediate domain */
#include "hw-tree.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
/* DEVICE
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index 1b01870..fc552fa 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -21,17 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "config.h"
#include "sim-main.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include <signal.h>
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c
index e504236..141dc21 100644
--- a/sim/common/hw-alloc.c
+++ b/sim/common/hw-alloc.c
@@ -21,10 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "hw-main.h"
#include "hw-base.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
struct hw_alloc_data
{
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c
index 87ca729..af8b181 100644
--- a/sim/common/hw-base.c
+++ b/sim/common/hw-base.c
@@ -23,19 +23,8 @@
#include "hw-main.h"
#include "hw-base.h"
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
#include <ctype.h>
#include "hw-config.h"
diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c
index 76e41b4..bc91264 100644
--- a/sim/common/hw-device.c
+++ b/sim/common/hw-device.c
@@ -23,13 +23,8 @@
#include "hw-main.h"
#include "hw-base.h"
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#if HAVE_STRING_H
#include <string.h>
-#endif
/* Address methods */
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index 917d7bd..1c749dd 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -23,9 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-events.h"
-#if HAVE_STRING_H
#include <string.h>
-#endif
/* The hw-events object is implemented using sim-events */
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index 539be39..bbd08f6 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -23,9 +23,7 @@
#include "hw-main.h"
#include "hw-base.h"
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
struct hw_handle_mapping
{
diff --git a/sim/common/hw-ports.c b/sim/common/hw-ports.c
index 7aefb97..50e2cbc 100644
--- a/sim/common/hw-ports.c
+++ b/sim/common/hw-ports.c
@@ -21,18 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "hw-main.h"
#include "hw-base.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
#include <ctype.h>
diff --git a/sim/common/hw-properties.c b/sim/common/hw-properties.c
index fe29ff4..11a371c 100644
--- a/sim/common/hw-properties.c
+++ b/sim/common/hw-properties.c
@@ -25,13 +25,7 @@
#include "sim-io.h"
#include "sim-assert.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
/* property entries */
diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c
index 9182233..4d50ec6 100644
--- a/sim/common/hw-tree.c
+++ b/sim/common/hw-tree.c
@@ -27,18 +27,8 @@
#include "sim-io.h"
#include "sim-assert.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
#include <ctype.h>
/* manipulate/lookup device names */
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 134dec8..0caa820 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -21,15 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <signal.h>
#include <stdlib.h>
-
/* For strsignal. */
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include "sim-main.h"
diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c
index 90203a9..a40dabb 100644
--- a/sim/common/sim-arange.c
+++ b/sim/common/sim-arange.c
@@ -24,13 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-basics.h"
#include "sim-arange.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
/* Insert a range. */
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index e175576..db05caf 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -27,18 +27,8 @@
#include "sim-assert.h"
#include "libiberty.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
#include <signal.h> /* For SIGPROCMASK et al. */
typedef enum {
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index 30147a8..bff5b08 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -41,9 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-io.h"
#include "sim-assert.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
/* Debugging support.
If digits is -1, then print all digits. */
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 979a467..81b4f64 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -28,17 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "hw-main.h"
#include "hw-base.h"
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#include <ctype.h>
#include <errno.h>
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index d998be8..e0aab1e 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -24,9 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ansidecl.h"
#include <stdio.h> /* for NULL */
#include <stdarg.h>
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#include <time.h>
#include "sim-basics.h"
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index 77a48df..a102d74 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -23,19 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-assert.h"
#include "sim-options.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-#ifdef HAVE_ERRNO_H
#include <errno.h>
-#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index e0de39a..d4434cf 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -19,16 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "config.h"
#include "sim-main.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#include <ctype.h>
#include <stdio.h>
#include "libiberty.h"
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index a886013..f4ce89f 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -22,17 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-options.h"
#include "sim-assert.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include <ctype.h>
#if !WITH_PROFILE_PC_P
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index 29b793c..5f161da 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -29,16 +29,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-assert.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifndef SIZE_PHASE
#define SIZE_PHASE 8
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 122e7f2..69949aa 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -20,14 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-main.h"
#include "sim-assert.h"
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* needed by sys/resource.h */
#endif
@@ -35,14 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include "libiberty.h"
#include "bfd.h"
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 9c929a1..bbd5be4 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -26,18 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <stdio.h>
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
enum {
OPTION_WATCH_DELETE = OPTION_START,
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 8a8c81f..fbe8021 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -30,14 +30,8 @@
#include "libiberty.h"
#include <stdarg.h>
#include <stdio.h>
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
#include <string.h>
-#elif defined (HAVE_STRINGS_H)
-#include <strings.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif