From 6df01ab8ab8509b04f86d7da069ec2d25eb31bf9 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 1 May 2021 18:05:23 -0400
Subject: sim: switch config.h usage to defs.h

The defs.h header will take care of including the various config.h
headers.  For now, it's just config.h, but we'll add more when we
integrate gnulib in.

This header should be used instead of config.h, and should be the
first include in every .c file.  We won't rely on the old behavior
where we expected files to include the port's sim-main.h which then
includes the common sim-basics.h which then includes config.h.  We
have a ton of code that includes things before sim-main.h, and it
sometimes needs to be that way.  Creating a dedicated header avoids
the ordering mess and implicit inclusion that shows up otherwise.
---
 sim/m32c/ChangeLog  | 6 ++++++
 sim/m32c/gdb-if.c   | 4 +++-
 sim/m32c/int.c      | 2 ++
 sim/m32c/load.c     | 4 +++-
 sim/m32c/main.c     | 3 ++-
 sim/m32c/mem.c      | 3 ++-
 sim/m32c/misc.c     | 2 ++
 sim/m32c/opc2c.c    | 2 ++
 sim/m32c/reg.c      | 2 ++
 sim/m32c/srcdest.c  | 2 ++
 sim/m32c/syscalls.c | 4 +++-
 sim/m32c/trace.c    | 4 +++-
 12 files changed, 32 insertions(+), 6 deletions(-)

(limited to 'sim/m32c')

diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog
index af71d21..591d8b9 100644
--- a/sim/m32c/ChangeLog
+++ b/sim/m32c/ChangeLog
@@ -1,5 +1,11 @@
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
+	* int.c, misc.c, opc2c.c, reg.c, srcdest.c: Include defs.h.
+	* gdb-if.c, load.c, main.c, mem.c, syscalls.c, trace.c: Replace
+	config.h include with defs.h.
+
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
 	* config.in, configure: Regenerate.
 
 2021-05-14  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c
index 3698648..b00d878 100644
--- a/sim/m32c/gdb-if.c
+++ b/sim/m32c/gdb-if.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
diff --git a/sim/m32c/int.c b/sim/m32c/int.c
index ffc96ae..4275399 100644
--- a/sim/m32c/int.c
+++ b/sim/m32c/int.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "int.h"
 #include "cpu.h"
diff --git a/sim/m32c/load.c b/sim/m32c/load.c
index 86e774e..277fc14 100644
--- a/sim/m32c/load.c
+++ b/sim/m32c/load.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/m32c/main.c b/sim/m32c/main.c
index ac36bc5..4c2c255 100644
--- a/sim/m32c/main.c
+++ b/sim/m32c/main.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c
index 4baf71f..243b7c4 100644
--- a/sim/m32c/mem.c
+++ b/sim/m32c/mem.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/misc.c b/sim/m32c/misc.c
index 50692e5..5e09885 100644
--- a/sim/m32c/misc.c
+++ b/sim/m32c/misc.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 
diff --git a/sim/m32c/opc2c.c b/sim/m32c/opc2c.c
index 4c97644..3d1713d 100644
--- a/sim/m32c/opc2c.c
+++ b/sim/m32c/opc2c.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/m32c/reg.c b/sim/m32c/reg.c
index 1b3c774..a57b6a1 100644
--- a/sim/m32c/reg.c
+++ b/sim/m32c/reg.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/srcdest.c b/sim/m32c/srcdest.c
index d5feb17..f3040c5 100644
--- a/sim/m32c/srcdest.c
+++ b/sim/m32c/srcdest.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/syscalls.c b/sim/m32c/syscalls.c
index e940084..e8d9d2e 100644
--- a/sim/m32c/syscalls.c
+++ b/sim/m32c/syscalls.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/sim/m32c/trace.c b/sim/m32c/trace.c
index f871c01..d16be4c 100644
--- a/sim/m32c/trace.c
+++ b/sim/m32c/trace.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-- 
cgit v1.1