[PATCH/committed] sim: simplify hardware m4 macro

Message ID 20210424015912.8829-1-vapier@gentoo.org
State New
Headers show
Series
  • [PATCH/committed] sim: simplify hardware m4 macro
Related show

Commit Message

Lancelot SIX via Gdb-patches April 24, 2021, 1:59 a.m.
Every port using this sets the 1st arg to yes and the 2nd arg to "".
These are the defaults we probably want anyways in order to unify the
codebase, so move them to the macro and only allow ports to declare
extra hardware models.
---
 sim/ChangeLog                    |  6 ++++++
 sim/README-HACKING               |  2 +-
 sim/bfin/ChangeLog               |  5 +++++
 sim/bfin/configure               |  8 +-------
 sim/bfin/configure.ac            |  2 +-
 sim/cris/ChangeLog               |  5 +++++
 sim/cris/configure               |  8 +-------
 sim/cris/configure.ac            |  2 +-
 sim/frv/ChangeLog                |  5 +++++
 sim/frv/configure                |  8 +-------
 sim/frv/configure.ac             |  2 +-
 sim/iq2000/ChangeLog             |  5 +++++
 sim/iq2000/configure             |  8 +-------
 sim/iq2000/configure.ac          |  2 +-
 sim/lm32/ChangeLog               |  5 +++++
 sim/lm32/configure               |  8 +-------
 sim/lm32/configure.ac            |  2 +-
 sim/m32r/ChangeLog               |  5 +++++
 sim/m32r/configure               |  8 +-------
 sim/m32r/configure.ac            |  2 +-
 sim/m4/sim_ac_option_hardware.m4 | 14 +++-----------
 sim/m68hc11/ChangeLog            |  5 +++++
 sim/m68hc11/configure            |  9 ++-------
 sim/m68hc11/configure.ac         |  2 +-
 sim/mips/ChangeLog               |  6 ++++++
 sim/mips/configure               | 13 +++----------
 sim/mips/configure.ac            |  5 ++---
 sim/mn10300/ChangeLog            |  5 +++++
 sim/mn10300/configure            |  8 +-------
 sim/mn10300/configure.ac         |  2 +-
 30 files changed, 78 insertions(+), 89 deletions(-)

-- 
2.30.2

Patch

diff --git a/sim/ChangeLog b/sim/ChangeLog
index 47032e0bd537..fdeed7d8f53b 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,9 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* README-HACKING (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* m4/sim_ac_option_hardware.m4 (SIM_AC_OPTION_HARDWARE): Replace [$1]
+	with yes.  Delete test [$2].  Change [$3] to [$1].  Update comments.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* m4/sim_ac_common.m4 (SIM_AC_COMMON): Don't check for sys/time.h
diff --git a/sim/README-HACKING b/sim/README-HACKING
index 0a1a3b55c1ef..78580588bf2b 100644
--- a/sim/README-HACKING
+++ b/sim/README-HACKING
@@ -396,7 +396,7 @@  Hardware Devices
 
 The simplest simulator doesn't include hardware device support.  Once you're
 ready to move on to the next level, call the common macro in your configure.ac:
-SIM_AC_OPTION_HARDWARE(yes,,devone devtwo devthree)
+SIM_AC_OPTION_HARDWARE(devone devtwo devthree)
 
 The basic hardware API is documented in common/hw-device.h.
 
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 4473b720ffb9..65c96b2f7b92 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index cedd9677f569..8fef4d47d00c 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -8,7 +8,7 @@  SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_DEFAULT_MODEL(bf537)
 SIM_AC_OPTION_WARNINGS
-SIM_AC_OPTION_HARDWARE(yes,,\
+SIM_AC_OPTION_HARDWARE(\
 	bfin_cec \
 	bfin_ctimer \
 	bfin_dma \
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 07d3086f758a..d123611e5f38 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* rvdummy.c: Update includes.
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index 56afe58331a0..f8aa533a063c 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -15,7 +15,7 @@  SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_WARNINGS(no)
-SIM_AC_OPTION_HARDWARE(yes,,rv cris cris_900000xx)
+SIM_AC_OPTION_HARDWARE(rv cris cris_900000xx)
 
 # The default model shouldn't matter as long as there's a BFD.
 SIM_AC_OPTION_DEFAULT_MODEL(crisv32)
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 339a5f0e6fb0..bc981ac1d1e4 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index b4f5953051f0..6588fe5e87e7 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -27,6 +27,6 @@  if test x"$silent" != x"yes" && test x"$sim_trapdump" != x""; then
 fi],[sim_trapdump=""])dnl
 AC_SUBST(sim_trapdump)
 
-SIM_AC_OPTION_HARDWARE(yes,"","")
+SIM_AC_OPTION_HARDWARE
 
 SIM_AC_OUTPUT
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 9857bda1ad06..addf3c6387cf 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index 1a5dcfb276a5..f21bc804bdd8 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -11,6 +11,6 @@  SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
-SIM_AC_OPTION_HARDWARE(yes,"","")
+SIM_AC_OPTION_HARDWARE
 
 SIM_AC_OUTPUT
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index f42124274c35..6a3287a05406 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index 83ed5034580b..63548874a114 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -10,6 +10,6 @@  SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(lm32)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
-SIM_AC_OPTION_HARDWARE(yes,,lm32cpu lm32timer lm32uart)
+SIM_AC_OPTION_HARDWARE(lm32cpu lm32timer lm32uart)
 
 SIM_AC_OUTPUT
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 6ba7bb44858b..7fb4761a1a5f 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index 2fd7f7265b0f..8ab55bc155a8 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -24,6 +24,6 @@  SIM_AC_OPTION_CGEN_MAINT
 AC_SUBST(traps_obj)
 AC_SUBST(sim_extra_cflags)
 
-SIM_AC_OPTION_HARDWARE(yes,,m32r_cache m32r_uart)
+SIM_AC_OPTION_HARDWARE(m32r_cache m32r_uart)
 
 SIM_AC_OUTPUT
diff --git a/sim/m4/sim_ac_option_hardware.m4 b/sim/m4/sim_ac_option_hardware.m4
index cc84fadcc518..75e331eb0b33 100644
--- a/sim/m4/sim_ac_option_hardware.m4
+++ b/sim/m4/sim_ac_option_hardware.m4
@@ -14,18 +14,10 @@  dnl You should have received a copy of the GNU General Public License
 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
 dnl --enable-sim-hardware is for users of the simulator
-dnl arg[1] Enable sim-hw by default? ("yes" or "no")
-dnl arg[2] is a space separated list of devices that override the defaults
-dnl arg[3] is a space separated list of extra target specific devices.
+dnl arg[1] is a space separated list of extra target specific devices.
 AC_DEFUN([SIM_AC_OPTION_HARDWARE],
 [
-if test "[$2]"; then
-  hardware="[$2]"
-else
-  hardware="cfi core pal glue"
-fi
-hardware="$hardware [$3]"
-
+hardware="cfi core pal glue [$1]"
 sim_hw_cflags="-DWITH_HW=1"
 sim_hw="$hardware"
 sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
@@ -33,7 +25,7 @@  sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/
 AC_ARG_ENABLE(sim-hardware,
   [AS_HELP_STRING([--enable-sim-hardware=LIST],
                   [Specify the hardware to be included in the build.])],
-  ,[enable_sim_hardware="[$1]"])
+  ,[enable_sim_hardware="yes"])
 case ${enable_sim_hardware} in
   yes|no) ;;
   ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 3da7580f6935..788ecfe44347 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/m68hc11/configure.ac b/sim/m68hc11/configure.ac
index 6148d1dae4ef..be52b63c2092 100644
--- a/sim/m68hc11/configure.ac
+++ b/sim/m68hc11/configure.ac
@@ -8,7 +8,7 @@  dnl Options available in this module
 SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
-SIM_AC_OPTION_HARDWARE(yes,,
+SIM_AC_OPTION_HARDWARE(\
   m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram)
 
 SIM_AC_OUTPUT
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 2e055ec8e9e5..40c9ad5a6cb3 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,9 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (hw_enabled): Delete.
+	(SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index ec45245dc1f5..593ee2bb4b0e 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -426,16 +426,15 @@  AC_SUBST(sim_multi_obj)
 #
 # Add simulated hardware devices
 #
-hw_enabled=no
+hw_extra_devices=""
 case "${target}" in
   mips*tx39*)
-	hw_enabled=yes
 	hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio" 
 	;;
   *)
 	;;
 esac
-SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
+SIM_AC_OPTION_HARDWARE($hw_extra_devices)
 
 
 # Choose simulator engine
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 0ad3257aa39a..aa09b2cca141 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,8 @@ 
+2021-04-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
+	* configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac
index f8b8ef8d2b35..55aec73be500 100644
--- a/sim/mn10300/configure.ac
+++ b/sim/mn10300/configure.ac
@@ -9,6 +9,6 @@  SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
-SIM_AC_OPTION_HARDWARE(yes,,mn103cpu mn103int mn103tim mn103ser mn103iop)
+SIM_AC_OPTION_HARDWARE(mn103cpu mn103int mn103tim mn103ser mn103iop)
 
 SIM_AC_OUTPUT