From: Orgad Shaneh via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Orgad Shaneh <orgads@gmail.com>
Subject: [PATCH] sim: fix compilation on mingw64
Date: Thu, 28 Oct 2021 09:07:46 +0000 [thread overview]
Message-ID: <20211028090746.241734-1-orgads@gmail.com> (raw)
...by reordering includes.
1. sim-utils.c
sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
which has UserMode as a member. So if sim-main.h is included before winnt.h,
compilation fails.
2. ppc
registers.h defines CR, which is used as a member in winnt.h.
winsock2.h is included by sys/time.h, so sys/time.h has to be included
before registers.h.
---
sim/common/sim-utils.c | 5 ++---
sim/ppc/emul_netbsd.c | 6 ++++--
sim/ppc/emul_unix.c | 6 ++++--
sim/ppc/mon.c | 9 ++++++---
4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 380afd0493f..88fd20e8876 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -20,9 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This must come before any other includes. */
#include "defs.h"
-#include "sim-main.h"
-#include "sim-assert.h"
-
#include <stdlib.h>
#include <time.h>
#include <sys/time.h> /* needed by sys/resource.h */
@@ -34,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "libiberty.h"
#include "bfd.h"
+#include "sim-main.h"
+#include "sim-assert.h"
#include "sim-utils.h"
/* Allocate zero filled memory with xcalloc - xcalloc aborts if the
diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index a97fc3b6460..d1595c5985f 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -25,8 +25,7 @@
/* Note: this module is called via a table. There is no benefit in
making it inline */
-#include "emul_generic.h"
-#include "emul_netbsd.h"
+#include "defs.h"
#include <string.h>
#include <sys/types.h>
@@ -38,6 +37,9 @@
#include <sys/param.h>
#include <sys/time.h>
+#include "emul_generic.h"
+#include "emul_netbsd.h"
+
#ifdef HAVE_GETRUSAGE
#ifndef HAVE_SYS_RESOURCE_H
#undef HAVE_GETRUSAGE
diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c
index cfcb4691247..191e26abd8e 100644
--- a/sim/ppc/emul_unix.c
+++ b/sim/ppc/emul_unix.c
@@ -25,8 +25,7 @@
/* Note: this module is called via a table. There is no benefit in
making it inline */
-#include "emul_generic.h"
-#include "emul_unix.h"
+#include "defs.h"
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
@@ -124,6 +123,9 @@ int getrusage();
#include <stdlib.h>
#include <time.h>
+#include "emul_generic.h"
+#include "emul_unix.h"
+
#ifndef STATIC_INLINE_EMUL_UNIX
#define STATIC_INLINE_EMUL_UNIX STATIC_INLINE
#endif
diff --git a/sim/ppc/mon.c b/sim/ppc/mon.c
index 966f86c040e..4e29ec99879 100644
--- a/sim/ppc/mon.c
+++ b/sim/ppc/mon.c
@@ -21,9 +21,8 @@
#ifndef _MON_C_
#define _MON_C_
-#include "basics.h"
-#include "cpu.h"
-#include "mon.h"
+#include "defs.h"
+
#include <stdio.h>
#include <string.h>
@@ -42,6 +41,10 @@
int getrusage();
#endif
+#include "basics.h"
+#include "cpu.h"
+#include "mon.h"
+
#define MAX_BYTE_READWRITE 9
#define MAX_SHIFT_READWRITE 3
--
2.33.1.windows.1
next prev reply other threads:[~2021-10-28 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 6:27 Orgad Shaneh via Gdb-patches
2021-10-27 9:33 ` Mike Frysinger via Gdb-patches
2021-10-28 9:07 ` Orgad Shaneh via Gdb-patches [this message]
2021-10-29 5:23 ` Mike Frysinger via Gdb-patches
2021-10-29 5:37 ` Orgad Shaneh via Gdb-patches
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=20211028090746.241734-1-orgads@gmail.com \
--to=gdb-patches@sourceware.org \
--cc=orgads@gmail.com \
/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