From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] sim: assume sys/stat.h always exists (via gnulib)
Date: Mon, 16 Jan 2023 04:46:56 -0500 [thread overview]
Message-ID: <20230116094656.22818-3-vapier@gentoo.org> (raw)
In-Reply-To: <20230116094656.22818-1-vapier@gentoo.org>
We have many uses of sys/stat.h that are unprotected by HAVE_SYS_STAT_H,
so this is more formalizing the reality that we require this header.
Since we switched to gnulib, it guarantees that a sys/stat.h exists
for us to include, so we're doubly OK.
---
sim/common/sim-memopt.c | 2 --
sim/configure | 33 ++-------------------------------
sim/cris/traps.c | 2 --
sim/h8300/compile.c | 2 +-
sim/m4/sim_ac_platform.m4 | 5 +----
sim/ppc/emul_unix.c | 4 ----
sim/sh/interp.c | 2 --
7 files changed, 4 insertions(+), 46 deletions(-)
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index 2e5016c52ab1..7d46a864afc5 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -30,9 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
#include "sim-main.h"
#include "sim-assert.h"
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index f5f169f1c81f..29b1b7cfdb38 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -39,9 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
/* For PATH_MAX, originally. */
#ifdef HAVE_LIMITS_H
#include <limits.h>
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 467eeafde610..1e303a92eca1 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -26,11 +26,11 @@
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
+#include <sys/stat.h>
#include "bfd.h"
#include "sim-main.h"
#include "sim/sim-h8300.h"
-#include "sys/stat.h"
#include "sys/types.h"
#include "sim-options.h"
#include "sim-signal.h"
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index 665c1bd7866c..7331ef3a38c5 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -37,7 +37,6 @@ AC_CHECK_HEADERS_ONCE(m4_flatten([
sys/param.h
sys/resource.h
sys/socket.h
- sys/stat.h
sys/statfs.h
sys/termio.h
sys/termios.h
@@ -126,9 +125,7 @@ AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
[[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif]])
+#include <sys/stat.h>]])
AC_CHECK_TYPES([__int128])
AC_CHECK_TYPES(socklen_t, [], [],
diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c
index 2872d236bf36..be9e8385f526 100644
--- a/sim/ppc/emul_unix.c
+++ b/sim/ppc/emul_unix.c
@@ -1055,7 +1055,6 @@ typedef uint32_t solaris_ino_t;
typedef uint32_t solaris_mode_t;
typedef uint32_t solaris_nlink_t;
-#ifdef HAVE_SYS_STAT_H
#define SOLARIS_ST_FSTYPSZ 16 /* array size for file system type name */
/* AIX 7.1 defines st_pad[123] to st_[amc]tim.tv_pad, respectively */
@@ -1145,7 +1144,6 @@ convert_to_solaris_stat(unsigned_word addr,
emul_write_buffer(&target, addr, sizeof(target), processor, cia);
}
-#endif /* HAVE_SYS_STAT_H */
#ifndef HAVE_STAT
#define do_solaris_stat 0
@@ -2011,7 +2009,6 @@ typedef int32_t linux_time_t;
typedef int32_t linux_clock_t;
typedef int32_t linux_daddr_t;
-#ifdef HAVE_SYS_STAT_H
/* For the PowerPC, don't both with the 'old' stat structure, since there
should be no extant binaries with that structure. */
@@ -2082,7 +2079,6 @@ convert_to_linux_stat(unsigned_word addr,
emul_write_buffer(&target, addr, sizeof(target), processor, cia);
}
-#endif /* HAVE_SYS_STAT_H */
#ifndef HAVE_STAT
#define do_linux_stat 0
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 5e0e8c47569f..c067f0f2bea6 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -38,9 +38,7 @@
#include <string.h>
#include <stdlib.h>
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
#include <time.h>
#include <sys/time.h>
#ifdef HAVE_UTIME_H
--
2.39.0
prev parent reply other threads:[~2023-01-16 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 9:46 [PATCH 1/3] sim: build: stop probing system extensions (ourselves) Mike Frysinger
2023-01-16 9:46 ` [PATCH 2/3] sim: formally assume unistd.h always exists (via gnulib) Mike Frysinger
2023-01-16 9:46 ` Mike Frysinger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230116094656.22818-3-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).