sim: formally assume unistd.h always exists (via gnulib)
authorMike Frysinger <vapier@gentoo.org>
Mon, 16 Jan 2023 09:35:48 +0000 (04:35 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 16 Jan 2023 09:35:48 +0000 (04:35 -0500)
We have many uses of unistd.h that are unprotected by HAVE_UNISTD_H,
so this is more formalizing the reality that we require this header.
Since we switched to gnulib, it guarantees that a unistd.h exists
for us to include, so we're doubly OK.

31 files changed:
sim/arm/armos.c
sim/common/callback.c
sim/common/dv-pal.c
sim/common/dv-sockser.c
sim/common/nrun.c
sim/common/sim-io.c
sim/common/sim-memopt.c
sim/common/syscall.c
sim/configure
sim/cr16/simops.c
sim/cris/dv-rv.c
sim/cris/rvdummy.c
sim/cris/traps.c
sim/d10v/simops.c
sim/m4/sim_ac_platform.m4
sim/m68hc11/emulos.c
sim/mn10300/op_utils.c
sim/ppc/emul_bugapi.c
sim/ppc/emul_chirp.c
sim/ppc/emul_netbsd.c
sim/ppc/emul_unix.c
sim/ppc/hw_com.c
sim/ppc/hw_disk.c
sim/ppc/hw_pal.c
sim/ppc/main.c
sim/ppc/mon.c
sim/ppc/table.c
sim/rl78/main.c
sim/rx/main.c
sim/sh/interp.c
sim/v850/simops.c

index a8ef7e4a82d9c8fb0cec7334506f0f3811e98d85..9cf238ac8e25a110a23cef3dbb2514bdd3cadd32 100644 (file)
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>            /* For SEEK_SET etc.  */
-#endif
 
 #include "armdefs.h"
 #include "armos.h"
index ff14a111b659e6560fc2bfcde0126eb89e44c39d..306e95e866da69d1f643e7a8d32ca1d83b157907 100644 (file)
@@ -34,9 +34,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 
index 56692c1dcb84d16c163791898a9c2a437c4db7b6..25f8c683e29ada2035b2796692044c7caa2f17dc 100644 (file)
@@ -24,9 +24,7 @@
 
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include "sim-main.h"
 #include "hw-main.h"
index fba2775f2e87c3b47f89a1aab967f72e0b9f8afe..698cab839209db5d7977a8963f084d20a7d8d1f4 100644 (file)
@@ -29,9 +29,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <sys/select.h>
index 4c011627bb8535fe83725708ca1f7bc1f202ee80..2ebf8a1271663399e231ebd157ae13ca22903a0c 100644 (file)
@@ -21,10 +21,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdlib.h>
 /* For strsignal.  */
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 /* For chdir.  */
 #include <unistd.h>
-#endif
 
 #include "bfd.h"
 #include "environ.h"
index f126c9622aea30fcad66e533f751e7b9d2f6967c..fc0d42faf117cce485634fe3a792b2de2b59f1e2 100644 (file)
@@ -29,9 +29,7 @@
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdlib.h>
-#if HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #undef open
 
index 2d1b96b7889cda6218e388ee9b7bfd3cb2d7e2df..2e5016c52ab12cff03f9e01986fdd77b53964a0f 100644 (file)
@@ -26,9 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
index f65f616a23160bca954e4f4a3fe79142e3d5e31c..96033db84c3b3bee1d74039382982a40f381985c 100644 (file)
@@ -33,9 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 
index c1333fc98802bd3d8c9dbda3a807765fa091f914..104751477c74addadd785892ee1d6f27bbef99ce 100755 (executable)
@@ -2797,7 +2797,6 @@ as_fn_append ac_header_list " dlfcn.h"
 as_fn_append ac_header_list " fcntl.h"
 as_fn_append ac_header_list " fpu_control.h"
 as_fn_append ac_header_list " termios.h"
-as_fn_append ac_header_list " unistd.h"
 as_fn_append ac_header_list " utime.h"
 as_fn_append ac_header_list " linux/if_tun.h"
 as_fn_append ac_header_list " linux/mii.h"
@@ -5265,8 +5264,6 @@ done
 
 
 
-
-
 
 
 
@@ -12289,7 +12286,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12292 "configure"
+#line 12289 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12395,7 +12392,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12398 "configure"
+#line 12395 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index e652b8153f809b364993afd70c898aeb69f2e284..73420a7e0c6c6d4aae25e05f6d2f8e8316fd4855 100644 (file)
@@ -24,9 +24,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <string.h>
 #include <time.h>
 #include <sys/time.h>
index 6caa4dd3443888bf956a0c021b548bf1f80b10ee..9142b88f7d7f2580bff1dffc1c23349066d613d1 100644 (file)
@@ -29,9 +29,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
index a263ee3c0ffd3478c45a228db7a6b0ea5da2b2a9..91a7ddc8a8d5a8e66e0ff96e4606f7d88ad92d59 100644 (file)
@@ -36,10 +36,7 @@ main (int argc, char *argv[])
 #include "libiberty.h"
 
 #include <stdio.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 #include <string.h>
 #ifdef HAVE_SYS_TYPES_H
index afcb3480840cc06dbb1607957709988b37337259..f5f169f1c81f4cfade94094820d50520ba615fa4 100644 (file)
@@ -32,9 +32,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdlib.h>
 #include <stdarg.h>
 #include <errno.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
index 96ed29f6abe1281e0041be25a2932dfb3c16375c..bc7806cc278a03fd90c6763a8293f471cc889649 100644 (file)
@@ -5,9 +5,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <string.h>
 
 #include "bfd.h"
index 6356a80e16ff9e5b9fb353260167d608b366c48b..665c1bd7866c63aee3f85a4d7f3453492532ae45 100644 (file)
@@ -18,12 +18,12 @@ AC_DEFUN([SIM_AC_PLATFORM],
 [dnl
 dnl Check for common headers.
 dnl NB: You can assume C11 headers exist.
+dnl NB: We use gnulib from ../gnulib/, so we don't probe headers it provides.
 AC_CHECK_HEADERS_ONCE(m4_flatten([
   dlfcn.h
   fcntl.h
   fpu_control.h
   termios.h
-  unistd.h
   utime.h
   linux/if_tun.h
   linux/mii.h
@@ -46,6 +46,7 @@ AC_CHECK_HEADERS_ONCE(m4_flatten([
 ]))
 AC_HEADER_DIRENT
 
+dnl NB: We use gnulib from ../gnulib/, so we don't probe functions it provides.
 AC_CHECK_FUNCS_ONCE(m4_flatten([
   __setfpucw
   access
index 50d275346347762ff5bce174402e884f5cecf591..fcf9cc1b5e57daa9942d98f023e1a7637f96e5ac 100644 (file)
@@ -21,9 +21,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "defs.h"
 
 #include "sim-main.h"
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include "m68hc11-sim.h"
 
index b29b803d8e7f7b648536e9e755e98d9ce2c301af..7e035f432590d2faa9558e89d463d2cd72f9ddfa 100644 (file)
@@ -3,9 +3,7 @@
 
 #include <errno.h>
 #include <time.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/time.h>
index f4eed443d8bdf995d616a9e7adca836568ffeaaa..067e40691e2f57f74adaa8f907e16735e3753da0 100644 (file)
@@ -27,9 +27,7 @@
 #include "emul_generic.h"
 #include "emul_bugapi.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 #include <string.h>
 
index 116f3732ac74abe31942004caa06c6eed0c42a8e..c064a28a7c621256d4f173c7983c619d04f7bce0 100644 (file)
@@ -28,9 +28,7 @@
 #include "emul_chirp.h"
 
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifndef STATIC_INLINE_EMUL_CHIRP
 #define STATIC_INLINE_EMUL_CHIRP STATIC_INLINE
index a8bfd27610e2329e8b77b9e29bcef439815c033d..51f8e98ae32b14a637aea9d07799f75e52c4b6f0 100644 (file)
@@ -72,10 +72,8 @@ int getrusage();
 # endif
 #endif
 
-#ifdef HAVE_UNISTD_H
 #undef MAXPATHLEN              /* sys/param.h might define this also */
 #include <unistd.h>
-#endif
 
 #include <stdlib.h>
 
index 1d8b7814ffc62d0cdada4e316cacb57872fd4282..2872d236bf3692a91d95e68d8c581b61752802ce 100644 (file)
@@ -115,10 +115,8 @@ int getrusage();
 # endif
 #endif
 
-#ifdef HAVE_UNISTD_H
 #undef MAXPATHLEN              /* sys/param.h might define this also */
 #include <unistd.h>
-#endif
 
 #include <stdlib.h>
 #include <time.h>
index 4ffd73203f49fa2fb9ab73d1d29119dd7f92b86e..768d1ca6a3c55c0d06b2ce913e47b0f2594b3ee2 100644 (file)
@@ -28,9 +28,7 @@
 #include "device_table.h"
 
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 
 /* DEVICE
index 3a825202784da07f0993398a81c7d9e536783c4f..54a11f62827380a0b4ca524ec89dc903de035a0a 100644 (file)
 #include "pk.h"
 
 #include <stdio.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifndef        SEEK_SET
 #define        SEEK_SET 0
index 8b07709936997a0684fd7fbf49fac65c16e79f5b..f8585084b37131e6bcb35e1d1ba31266e3fb67c9 100644 (file)
@@ -30,9 +30,7 @@
 #include "cpu.h"
 
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 
 
index 83b629ec14aad7b2a6498759f48a13a6ace1bd7c..aa1c85e0af913b90d66e94c5fbd432c1bd1ebfef 100644 (file)
@@ -36,9 +36,7 @@
 #include "sim/sim.h"
 
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <string.h>
 #include <errno.h>
 
index 4e29ec998798c04b633b1e4fbd3f8bb6a86478bd..8ab42af8458903210768a53a559428044119a6bf 100644 (file)
@@ -26,9 +26,7 @@
 #include <stdio.h>
 
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
index 6399bdaddcb1c54ca0af0c28754911250e3873ac..da169675958703194b64e4e4883d01dfd14c4901 100644 (file)
@@ -29,9 +29,7 @@
 #include "lf.h"
 #include "table.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 
 typedef struct _open_table open_table;
index 7c250f7172c172906fa93e75a9df49e90ced981f..1eafa3392eaf098fcc0de6e1d6ca0739e769ab98 100644 (file)
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <assert.h>
 #include <setjmp.h>
 #include <signal.h>
index e404446dd7001421d84a88f7d2688c56c52ce98d..13d0c473e7434dbfc78687758323e938b2ff42e5 100644 (file)
@@ -24,9 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <assert.h>
 #include <setjmp.h>
 #include <signal.h>
index 5a90cd2cf74c4a92bf98de2e29d48fb177adcb7b..5e0e8c47569fda61afb036a39cc728a48612a0d5 100644 (file)
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <signal.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 # ifndef MAP_FAILED
index 69db8aaaa53d8bb99577cfad1302f567c07c3351..326745efcb268d647cc583948ad239be8fb72f56 100644 (file)
@@ -12,9 +12,7 @@
 #include <utime.h>
 #endif
 #include <time.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdlib.h>
 #include <string.h>