[3/3] Add missing stdlib.h includes to sim

Message ID 20210504145818.4088770-4-tromey@adacore.com
State New
Headers show
Series
  • Some minor sim fixes
Related show

Commit Message

Tom Tromey May 4, 2021, 2:58 p.m.
This updates the various "mloop.in" files to emit an include of
stdlib.h, to avoid warnings about 'abort' being undeclared.

One such warning now remains, in mn10300.igen.  I don't know offhand
the best way to fix this one.

sim/cris/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/iq2000/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/lm32/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/m32r/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/or1k/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.
---
 sim/cris/ChangeLog   | 4 ++++
 sim/cris/mloop.in    | 2 ++
 sim/iq2000/ChangeLog | 4 ++++
 sim/iq2000/mloop.in  | 1 +
 sim/lm32/ChangeLog   | 4 ++++
 sim/lm32/mloop.in    | 1 +
 sim/m32r/ChangeLog   | 4 ++++
 sim/m32r/mloop.in    | 1 +
 sim/or1k/ChangeLog   | 4 ++++
 sim/or1k/mloop.in    | 1 +
 10 files changed, 26 insertions(+)

-- 
2.26.3

Comments

Mike Frysinger via Gdb-patches May 4, 2021, 5:44 p.m. | #1
On 04 May 2021 08:58, Tom Tromey wrote:
> This updates the various "mloop.in" files to emit an include of

> stdlib.h, to avoid warnings about 'abort' being undeclared.


i was debating how to approach this.  the mloop code that gets inserted here
is in the middle of the file, so there's a couple of funcs defined before this
include is hit.  things are generally namespaced, so maybe it's not a big deal,
but still felt a bit off which is why i was sitting on it.  the alternative is
to add a new callback point just for early headers and then the script would
emit stdlib.h and such then.

but maybe i'm being too ornery and your fix is fine.  feel free to merge.
-mike
Tom Tromey May 4, 2021, 7:17 p.m. | #2
>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:


Mike> On 04 May 2021 08:58, Tom Tromey wrote:
>> This updates the various "mloop.in" files to emit an include of

>> stdlib.h, to avoid warnings about 'abort' being undeclared.


Mike> i was debating how to approach this.  the mloop code that gets inserted here
Mike> is in the middle of the file, so there's a couple of funcs defined before this
Mike> include is hit.  things are generally namespaced, so maybe it's not a big deal,
Mike> but still felt a bit off which is why i was sitting on it.  the alternative is
Mike> to add a new callback point just for early headers and then the script would
Mike> emit stdlib.h and such then.

Or it could just unconditionally emit <stdlib.h>.

Mike> but maybe i'm being too ornery and your fix is fine.  feel free to merge.

I guess I'll just do it.  It can always be changed again, easy enough to
do.

Tom

Patch

diff --git a/sim/cris/mloop.in b/sim/cris/mloop.in
index 32f5fef95f3..645d8211606 100644
--- a/sim/cris/mloop.in
+++ b/sim/cris/mloop.in
@@ -42,6 +42,8 @@  case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
+
 /* It seems we don't have a templated header file corresponding to
    cris-tmpl.c, so we have to get out declarations the hackish way.  */
 extern void @cpu@_specific_init (SIM_CPU *current_cpu);
diff --git a/sim/iq2000/mloop.in b/sim/iq2000/mloop.in
index b973fa106ab..7d3a9b5e9a1 100644
--- a/sim/iq2000/mloop.in
+++ b/sim/iq2000/mloop.in
@@ -40,6 +40,7 @@  case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn, ARGBUF *abuf,
diff --git a/sim/lm32/mloop.in b/sim/lm32/mloop.in
index a8db7f51768..574f00a5119 100644
--- a/sim/lm32/mloop.in
+++ b/sim/lm32/mloop.in
@@ -32,6 +32,7 @@  case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,
diff --git a/sim/m32r/mloop.in b/sim/m32r/mloop.in
index 405a7e92736..6b0d0dec616 100644
--- a/sim/m32r/mloop.in
+++ b/sim/m32r/mloop.in
@@ -42,6 +42,7 @@  case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract16 (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,
diff --git a/sim/or1k/mloop.in b/sim/or1k/mloop.in
index 49c42276209..a94b534a9ae 100644
--- a/sim/or1k/mloop.in
+++ b/sim/or1k/mloop.in
@@ -42,6 +42,7 @@  case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,