aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-01 18:05:23 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-16 22:38:41 -0400
commit6df01ab8ab8509b04f86d7da069ec2d25eb31bf9 (patch)
tree21a00924bc74b7d5ec239a133d223f9d52f1dd67 /sim/ppc
parent681eb80f1217f66c83dec4a3db83577a2a09f74a (diff)
downloadgdb-6df01ab8ab8509b04f86d7da069ec2d25eb31bf9.zip
gdb-6df01ab8ab8509b04f86d7da069ec2d25eb31bf9.tar.gz
gdb-6df01ab8ab8509b04f86d7da069ec2d25eb31bf9.tar.bz2
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.
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/ChangeLog7
-rw-r--r--sim/ppc/Makefile.in2
-rw-r--r--sim/ppc/basics.h3
-rw-r--r--sim/ppc/debug.c4
-rw-r--r--sim/ppc/defs.h26
-rw-r--r--sim/ppc/filter_filename.c4
-rw-r--r--sim/ppc/inline.c4
-rw-r--r--sim/ppc/sim-endian.c4
-rw-r--r--sim/ppc/words.h5
9 files changed, 50 insertions, 9 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 42db5f2..0755fe2 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (gentmap): Pass -DUSE_CONFIG_H.
+ * basics.h, debug.c, filter_filename.c, inline.c, sim-endian.c,
+ words.h: Replace config.h include with defs.h.
+ * defs.h: New file.
+
2021-05-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (WERROR_CFLAGS): Define.
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 9fc864e..5ce511e 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -629,7 +629,7 @@ mon.o: mon.c $(BASICS_H) $(CPU_H) $(MON_H)
# As a kludge, build the common stuff here for now.
gentmap: $(srcdir)/../common/gentmap.c Makefile targ-vals.def
$(LINK_FOR_BUILD) -I. -I../common -I$(srcdir)/../common \
- $(srcdir)/../common/gentmap.c
+ $(srcdir)/../common/gentmap.c -DUSE_CONFIG_H
targ-vals.def: $(srcdir)/../common/nltvals.def
rm -f targ-vals.def tmp-def
diff --git a/sim/ppc/basics.h b/sim/ppc/basics.h
index 2b923ea..057cf1a 100644
--- a/sim/ppc/basics.h
+++ b/sim/ppc/basics.h
@@ -21,6 +21,8 @@
#ifndef _BASICS_H_
#define _BASICS_H_
+/* This must come before any other includes. */
+#include "defs.h"
/* from Michael Meissner, macro's to handle concating symbols better */
@@ -85,7 +87,6 @@ typedef enum {
/* Basic configuration */
-#include "config.h"
#include "ppc-config.h"
#include "inline.h"
diff --git a/sim/ppc/debug.c b/sim/ppc/debug.c
index dba1425..53a392a 100644
--- a/sim/ppc/debug.c
+++ b/sim/ppc/debug.c
@@ -21,7 +21,9 @@
#ifndef _DEBUG_C_
#define _DEBUG_C_
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "basics.h"
#include <stdlib.h>
diff --git a/sim/ppc/defs.h b/sim/ppc/defs.h
new file mode 100644
index 0000000..66e76d2
--- /dev/null
+++ b/sim/ppc/defs.h
@@ -0,0 +1,26 @@
+/* The configure generated header settings.
+
+ Copyright 2002-2021 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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 file should be included by every .c file before any other header. */
+
+#ifndef DEFS_H
+#define DEFS_H
+
+/* Include sim's various configure tests. */
+#include "config.h"
+
+#endif
diff --git a/sim/ppc/filter_filename.c b/sim/ppc/filter_filename.c
index 2457b68..b59ca21 100644
--- a/sim/ppc/filter_filename.c
+++ b/sim/ppc/filter_filename.c
@@ -17,7 +17,9 @@
*/
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "ppc-config.h"
#include "filter_filename.h"
diff --git a/sim/ppc/inline.c b/sim/ppc/inline.c
index 8813169..1db2dec 100644
--- a/sim/ppc/inline.c
+++ b/sim/ppc/inline.c
@@ -21,7 +21,9 @@
#ifndef _INLINE_C_
#define _INLINE_C_
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "ppc-config.h"
#include "inline.h"
diff --git a/sim/ppc/sim-endian.c b/sim/ppc/sim-endian.c
index 1ffa2d7..2625d80 100644
--- a/sim/ppc/sim-endian.c
+++ b/sim/ppc/sim-endian.c
@@ -21,7 +21,9 @@
#ifndef _SIM_ENDIAN_C_
#define _SIM_ENDIAN_C_
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "basics.h"
diff --git a/sim/ppc/words.h b/sim/ppc/words.h
index 7645349..641f2251 100644
--- a/sim/ppc/words.h
+++ b/sim/ppc/words.h
@@ -43,9 +43,8 @@
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes. */
+#include "defs.h"
/* bit based */
typedef char natural8;