aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-28 14:25:36 -0500
committerMike Frysinger <vapier@gentoo.org>2021-11-28 14:28:35 -0500
commite9307449c314ac40a660e5774dd5175571cb2382 (patch)
tree4aa831cd894eedcfc058b890a4f4859ae200bb43
parent6688220490d7d315b6489fb0de12062f7ecd3e33 (diff)
downloadgdb-e9307449c314ac40a660e5774dd5175571cb2382.zip
gdb-e9307449c314ac40a660e5774dd5175571cb2382.tar.gz
gdb-e9307449c314ac40a660e5774dd5175571cb2382.tar.bz2
sim: add checks to core headers to prevent incorrect common building
Some of the core sim headers rely on the SIM_AC_OPTION_BITSIZE macro which can change the size of core types. Since these haven't been unified across ports, add checks to make sure they aren't accidentally included when building for all ports. This caught the sim-load file using poisoned headers that it didn't actually need.
-rw-r--r--sim/common/sim-config.h3
-rw-r--r--sim/common/sim-load.c3
-rw-r--r--sim/common/sim-types.h4
3 files changed, 8 insertions, 2 deletions
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index aae08e7..88bdedf 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -23,6 +23,9 @@
#ifndef SIM_CONFIG_H
#define SIM_CONFIG_H
+#ifdef SIM_COMMON_BUILD
+#error "This header is unusable in common builds due to reliance on SIM_AC_OPTION_BITSIZE"
+#endif
/* Host dependant:
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index 3ea50e7..ec5df41 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -27,12 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <time.h>
-#include "sim-basics.h"
#include "bfd.h"
-#include "sim-utils.h"
#include "sim/callback.h"
#include "sim/sim.h"
+#include "sim-utils.h"
static void eprintf (host_callback *, const char *, ...);
static void xprintf (host_callback *, const char *, ...);
diff --git a/sim/common/sim-types.h b/sim/common/sim-types.h
index 8e1c9ad..5fd0a1d 100644
--- a/sim/common/sim-types.h
+++ b/sim/common/sim-types.h
@@ -23,6 +23,10 @@
#ifndef SIM_TYPES_H
#define SIM_TYPES_H
+#ifdef SIM_COMMON_BUILD
+#error "This header is unusable in common builds due to reliance on SIM_AC_OPTION_BITSIZE"
+#endif
+
#include <stdint.h>
/* INTEGER QUANTITIES: