]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: erc32: fix build w/out F_{G,S}ETFL
authorMike Frysinger <vapier@gentoo.org>
Tue, 15 Jun 2021 03:25:01 +0000 (23:25 -0400)
committerMike Frysinger <vapier@gentoo.org>
Tue, 15 Jun 2021 03:30:17 +0000 (23:30 -0400)
Add conditional logic around fcntl.h F_{G,S}ETFL usage to fix builds
on systems that don't have it (e.g. Windows).  The code is only used
to save & restore limited terminal stdin state.

sim/erc32/ChangeLog
sim/erc32/interf.c
sim/erc32/sis.c

index a5035d058f15024fff58d247070cb65109970b29..0a82427cb5f4accb528243c37e56df9354b9556c 100644 (file)
@@ -1,3 +1,9 @@
+2021-06-14  Mike Frysinger  <vapier@gentoo.org>
+
+       * interf.c (sim_open) [F_GETFL]: Only set termsave.
+       (sim_close) [F_SETFL]: Only call fcntl.
+       * sis.c (main) [F_GETFL]: Only set termsave.
+
 2021-06-14  Mike Frysinger  <vapier@gentoo.org>
 
        * erc32.c [HAVE_TERMIOS_H]: Include termios.h and declare ioc1,
index 28c981bbb924b3919d1ea2fa9b623e8ef3b445e0..0cd655517630a8b2e5a8ae39aa461d971fd3a409 100644 (file)
@@ -241,7 +241,9 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback,
     }
 
     sregs.freq = freq ? freq : 15;
+#ifdef F_GETFL
     termsave = fcntl(0, F_GETFL, 0);
+#endif
     INIT_DISASSEMBLE_INFO(dinfo, stdout,(fprintf_ftype)fprintf);
 #ifdef HOST_LITTLE_ENDIAN
     dinfo.endian = BFD_ENDIAN_LITTLE;
@@ -263,9 +265,10 @@ sim_close(SIM_DESC sd, int quitting)
 {
 
     exit_sim();
+#ifdef F_SETFL
     fcntl(0, F_SETFL, termsave);
-
-};
+#endif
+}
 
 SIM_RC
 sim_load(SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
index 749d25620b441828829a6d454ae83a675bf3843b..b49e5a606098bbf54596ee4c74e9187801e7fe6b 100644 (file)
@@ -219,7 +219,9 @@ main(int argc, char **argv)
     dinfo.endian = BFD_ENDIAN_BIG;
 #endif
 
+#ifdef F_GETFL
     termsave = fcntl(0, F_GETFL, 0);
+#endif
     using_history();
     init_signals();
     ebase.simtime = 0;