sim: add checks to core headers to prevent incorrect common building
authorMike Frysinger <vapier@gentoo.org>
Sun, 28 Nov 2021 19:25:36 +0000 (14:25 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 28 Nov 2021 19:28:35 +0000 (14:28 -0500)
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.

sim/common/sim-config.h
sim/common/sim-load.c
sim/common/sim-types.h

index aae08e71c5855ad4cb891aa87527b8f8010c43f6..88bdedf687dce4c3b2ab4446e866b307ce0d5782 100644 (file)
@@ -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:
 
index 3ea50e7fbcdecdb512198803ed102c97d100f3a0..ec5df418d9de6c4b203fdfc7666926445519e732 100644 (file)
@@ -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 *, ...);
index 8e1c9ada920d6fc5a149f5a5c9b601ff2add186d..5fd0a1dcff224694b74e0bd07d5100f93a1372a6 100644 (file)
 #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: