diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-01-09 03:56:10 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-01-11 08:05:54 -0500 |
commit | 68ed2854284d415a71efd856a40343f550881ede (patch) | |
tree | f00f87cc7628c8e82de418bacc5d941db46c2481 /sim/ppc | |
parent | a8aa72b913e78407e5de4fefd22f9b98e4466f30 (diff) | |
download | fsf-binutils-gdb-68ed2854284d415a71efd856a40343f550881ede.zip fsf-binutils-gdb-68ed2854284d415a71efd856a40343f550881ede.tar.gz fsf-binutils-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/ppc')
35 files changed, 20 insertions, 254 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 625afec..6906cc2 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,21 @@ +2021-01-11 Mike Frysinger <vapier@gentoo.org> + + * configure.ac: Delete checks for stdlib.h, string.h, + strings.h, and time.h. + * config.in, configure: Regenerate. + * cpu.c, debug.c, device.c, device_table.c, device_table.h, + dgen.c, emul_bugapi.c, emul_chirp.c, emul_netbsd.c, emul_unix.c, + filter.c, hw_com.c, hw_eeprom.c, hw_nvram.c, hw_opic.c, hw_pal.c, + hw_phb.c, hw_sem.c, hw_shm.c, lf.c, main.c, misc.c, misc.h, + mon.c, pk_disklabel.c, psim.c, registers.c, sim_calls.c, table.c, + tree.c: Delete HAVE_ERRNO_H, HAVE_STDLIB_H, HAVE_STRING_H, + HAVE_STRINGS_H, HAVE_LIMITS_H, HAVE_TIME_H, and strings.h include. + * hw_nvram.c: Likewise. + (_hw_nvram_device): Always define host_time as time_t. + (hw_nvram_update_clock): Delete error fallback. + * gen-model.c (gen_model_c): Delete HAVE_STDLIB_H output. + + 2021-01-09 Mike Frysinger <vapier@gentoo.org> * configure: Regenerate. diff --git a/sim/ppc/config.in b/sim/ppc/config.in index e157e9f..1a256d9 100644 --- a/sim/ppc/config.in +++ b/sim/ppc/config.in @@ -261,9 +261,6 @@ /* Define to 1 if you have the `time' function. */ #undef HAVE_TIME -/* Define to 1 if you have the <time.h> header file. */ -#undef HAVE_TIME_H - /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #undef HAVE_TM_ZONE diff --git a/sim/ppc/configure b/sim/ppc/configure index 9934d2a..108c92a 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -7279,7 +7279,7 @@ fi done -for ac_header in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h +for ac_header in fcntl.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h unistd.h sys/vfs.h sys/statfs.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index ee52bba..9bc1057 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -655,7 +655,7 @@ AC_TYPE_UID_T AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink) -AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h) +AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h unistd.h sys/vfs.h sys/statfs.h) AC_HEADER_DIRENT dnl Figure out what type of termio/termios support there is diff --git a/sim/ppc/cpu.c b/sim/ppc/cpu.c index c7e8bdf..3169553 100644 --- a/sim/ppc/cpu.c +++ b/sim/ppc/cpu.c @@ -26,13 +26,7 @@ #include "cpu.h" #include "idecode.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif struct _cpu { diff --git a/sim/ppc/debug.c b/sim/ppc/debug.c index 1ec279b..dba1425 100644 --- a/sim/ppc/debug.c +++ b/sim/ppc/debug.c @@ -24,12 +24,8 @@ #include "config.h" #include "basics.h" -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif -#ifdef HAVE_STRING_H #include <string.h> -#endif int ppc_trace[nr_trace_options]; diff --git a/sim/ppc/device.c b/sim/ppc/device.c index d5093bb..6a0209e 100644 --- a/sim/ppc/device.c +++ b/sim/ppc/device.c @@ -29,18 +29,8 @@ #include "events.h" #include "psim.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> STATIC_INLINE_DEVICE (void) clean_device_properties(device *); diff --git a/sim/ppc/device_table.c b/sim/ppc/device_table.c index d2c6195..7d8fabd 100644 --- a/sim/ppc/device_table.c +++ b/sim/ppc/device_table.c @@ -23,10 +23,7 @@ #include "device_table.h" -#if HAVE_STDLIB_H #include <stdlib.h> -#endif - #include <ctype.h> diff --git a/sim/ppc/device_table.h b/sim/ppc/device_table.h index 654ecad..b61f4bd 100644 --- a/sim/ppc/device_table.h +++ b/sim/ppc/device_table.h @@ -25,13 +25,7 @@ #include "device.h" #include "tree.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif typedef struct _device_callbacks device_callbacks; diff --git a/sim/ppc/dgen.c b/sim/ppc/dgen.c index 8e8f5fb..9437944 100644 --- a/sim/ppc/dgen.c +++ b/sim/ppc/dgen.c @@ -34,18 +34,8 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#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 /****************************************************************/ diff --git a/sim/ppc/emul_bugapi.c b/sim/ppc/emul_bugapi.c index 8481b6f..c3c607b 100644 --- a/sim/ppc/emul_bugapi.c +++ b/sim/ppc/emul_bugapi.c @@ -30,18 +30,8 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#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 /* EMULATION diff --git a/sim/ppc/emul_chirp.c b/sim/ppc/emul_chirp.c index f326410..d4214f5 100644 --- a/sim/ppc/emul_chirp.c +++ b/sim/ppc/emul_chirp.c @@ -27,14 +27,7 @@ #include "emul_generic.h" #include "emul_chirp.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 diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index 0bda20e..0135a93 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -28,14 +28,7 @@ #include "emul_generic.h" #include "emul_netbsd.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> @@ -82,9 +75,7 @@ int getrusage(); #include <unistd.h> #endif -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif #define WITH_NetBSD_HOST (NetBSD >= 199306) #if WITH_NetBSD_HOST /* here NetBSD as that is what we're emulating */ diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c index 3a1c245..92c3c1e 100644 --- a/sim/ppc/emul_unix.c +++ b/sim/ppc/emul_unix.c @@ -28,14 +28,7 @@ #include "emul_generic.h" #include "emul_unix.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif @@ -130,9 +123,7 @@ int getrusage(); #include <unistd.h> #endif -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif #if defined(BSD) && !defined(errno) && (BSD < 199306) /* here BSD as just a bug */ extern int errno; diff --git a/sim/ppc/filter.c b/sim/ppc/filter.c index 7aa6a55..a202427 100644 --- a/sim/ppc/filter.c +++ b/sim/ppc/filter.c @@ -22,13 +22,7 @@ #include "build-config.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif #include "misc.h" #include "filter.h" diff --git a/sim/ppc/gen-model.c b/sim/ppc/gen-model.c index 00f2b02..a591d31 100644 --- a/sim/ppc/gen-model.c +++ b/sim/ppc/gen-model.c @@ -244,9 +244,7 @@ gen_model_c(insn_table *table, lf *file) lf_printf(file, "#include \"cpu.h\"\n"); lf_printf(file, "#include \"mon.h\"\n"); lf_printf(file, "\n"); - lf_printf(file, "#ifdef HAVE_STDLIB_H\n"); lf_printf(file, "#include <stdlib.h>\n"); - lf_printf(file, "#endif\n"); lf_printf(file, "\n"); for(insn_ptr = model_data; insn_ptr; insn_ptr = insn_ptr->next) { diff --git a/sim/ppc/hw_com.c b/sim/ppc/hw_com.c index 38d6d85..4ffd732 100644 --- a/sim/ppc/hw_com.c +++ b/sim/ppc/hw_com.c @@ -27,20 +27,11 @@ #include "device_table.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/ppc/hw_eeprom.c b/sim/ppc/hw_eeprom.c index 3406be9..b0a3ac6 100644 --- a/sim/ppc/hw_eeprom.c +++ b/sim/ppc/hw_eeprom.c @@ -23,13 +23,7 @@ #include "device_table.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif /* DEVICE diff --git a/sim/ppc/hw_nvram.c b/sim/ppc/hw_nvram.c index f8caaa8..0580dcc 100644 --- a/sim/ppc/hw_nvram.c +++ b/sim/ppc/hw_nvram.c @@ -27,17 +27,8 @@ #include "device_table.h" -#ifdef HAVE_TIME_H #include <time.h> -#endif - -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif /* DEVICE @@ -73,11 +64,7 @@ typedef struct _hw_nvram_device { unsigned8 *memory; unsigned sizeof_memory; -#ifdef HAVE_TIME_H time_t host_time; -#else - long host_time; -#endif unsigned timezone; /* useful */ unsigned addr_year; @@ -177,7 +164,6 @@ static void hw_nvram_update_clock(hw_nvram_device *nvram, cpu *processor) { -#ifdef HAVE_TIME_H if (!(nvram->memory[nvram->addr_control] & 0xc0)) { time_t host_time = time(NULL); if (nvram->host_time != host_time) { @@ -193,9 +179,6 @@ hw_nvram_update_clock(hw_nvram_device *nvram, nvram->memory[nvram->addr_seconds] = hw_nvram_bcd(clock->tm_sec); } } -#else - error("fixme - where do I find out GMT\n"); -#endif } static void diff --git a/sim/ppc/hw_opic.c b/sim/ppc/hw_opic.c index 69d956b..8afe312 100644 --- a/sim/ppc/hw_opic.c +++ b/sim/ppc/hw_opic.c @@ -23,13 +23,7 @@ #include "device_table.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif /* DEVICE diff --git a/sim/ppc/hw_pal.c b/sim/ppc/hw_pal.c index 0789929..8b07709 100644 --- a/sim/ppc/hw_pal.c +++ b/sim/ppc/hw_pal.c @@ -29,20 +29,11 @@ #include "cpu.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/ppc/hw_phb.c b/sim/ppc/hw_phb.c index 8e3fb17..08defc2 100644 --- a/sim/ppc/hw_phb.c +++ b/sim/ppc/hw_phb.c @@ -27,10 +27,7 @@ #include "corefile.h" -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif - #include <ctype.h> diff --git a/sim/ppc/hw_sem.c b/sim/ppc/hw_sem.c index f1c3295..5f35952 100644 --- a/sim/ppc/hw_sem.c +++ b/sim/ppc/hw_sem.c @@ -23,14 +23,7 @@ #include "device_table.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #include <sys/ipc.h> #include <sys/sem.h> diff --git a/sim/ppc/hw_shm.c b/sim/ppc/hw_shm.c index 3128871..f2fa144 100644 --- a/sim/ppc/hw_shm.c +++ b/sim/ppc/hw_shm.c @@ -23,14 +23,7 @@ #include "device_table.h" -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #include <sys/ipc.h> #include <sys/shm.h> diff --git a/sim/ppc/lf.c b/sim/ppc/lf.c index 1794a27..a3815a8 100644 --- a/sim/ppc/lf.c +++ b/sim/ppc/lf.c @@ -26,17 +26,8 @@ #include "misc.h" #include "lf.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 struct _lf { FILE *stream; diff --git a/sim/ppc/main.c b/sim/ppc/main.c index 667c02f..1e73444 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -33,22 +33,11 @@ #include "gdb/callback.h" #include "gdb/remote-sim.h" -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #include <errno.h> #if !defined(O_NDELAY) || !defined(F_GETFL) || !defined(F_SETFL) diff --git a/sim/ppc/misc.c b/sim/ppc/misc.c index 8c21bd3..6de3cf9 100644 --- a/sim/ppc/misc.c +++ b/sim/ppc/misc.c @@ -25,17 +25,8 @@ #include "build-config.h" #include "misc.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 void error (char *msg, ...) diff --git a/sim/ppc/misc.h b/sim/ppc/misc.h index 232f2ea..c080ae2 100644 --- a/sim/ppc/misc.h +++ b/sim/ppc/misc.h @@ -24,18 +24,8 @@ #include <stdio.h> #include <ctype.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 #if !defined (__attribute__) && (!defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) #define __attribute__(arg) diff --git a/sim/ppc/mon.c b/sim/ppc/mon.c index 8235b66..452cd19 100644 --- a/sim/ppc/mon.c +++ b/sim/ppc/mon.c @@ -26,30 +26,15 @@ #include "mon.h" #include <stdio.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 - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif - -#ifdef HAVE_TIME_H #include <time.h> -#endif - #ifdef HAVE_SYS_TIMES_H #include <sys/times.h> #endif diff --git a/sim/ppc/pk_disklabel.c b/sim/ppc/pk_disklabel.c index fb820fd..d424c04 100644 --- a/sim/ppc/pk_disklabel.c +++ b/sim/ppc/pk_disklabel.c @@ -29,11 +29,7 @@ #include "pk.h" -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif - - /* PACKAGE diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c index 3e322e3..ebb9cb4 100644 --- a/sim/ppc/psim.c +++ b/sim/ppc/psim.c @@ -31,21 +31,9 @@ #include <stdio.h> #include <ctype.h> - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif - #include <setjmp.h> - -#ifdef HAVE_STRING_H #include <string.h> -#else -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#endif - #include "bfd.h" #include "libiberty.h" diff --git a/sim/ppc/registers.c b/sim/ppc/registers.c index b672f99..2bab55a 100644 --- a/sim/ppc/registers.c +++ b/sim/ppc/registers.c @@ -26,18 +26,8 @@ #include "basics.h" #include "registers.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 - INLINE_REGISTERS\ (void) diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 0a209bf..c8364f0 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -27,17 +27,8 @@ #undef printf_filtered /* blow away the mapping */ -#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 "libiberty.h" #include "bfd.h" diff --git a/sim/ppc/table.c b/sim/ppc/table.c index 43c7462..3c7e446 100644 --- a/sim/ppc/table.c +++ b/sim/ppc/table.c @@ -32,10 +32,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif typedef struct _open_table open_table; struct _open_table { diff --git a/sim/ppc/tree.c b/sim/ppc/tree.c index 5d20bf4..a0e0820 100644 --- a/sim/ppc/tree.c +++ b/sim/ppc/tree.c @@ -29,19 +29,8 @@ #include "device.h" #include "tree.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> #include "libiberty.h" |