From 6df01ab8ab8509b04f86d7da069ec2d25eb31bf9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger 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/cr16/gencode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sim/cr16/gencode.c') diff --git a/sim/cr16/gencode.c b/sim/cr16/gencode.c index 335ab26..30fda93 100644 --- a/sim/cr16/gencode.c +++ b/sim/cr16/gencode.c @@ -17,8 +17,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* This must come before any other includes. */ +#include "defs.h" -#include "config.h" #include #include #include @@ -67,6 +68,7 @@ write_template (void) { int i = 0,j, k, flags; + printf ("#include \"defs.h\"\n"); printf ("#include \"sim-main.h\"\n"); printf ("#include \"simops.h\"\n\n"); @@ -131,6 +133,7 @@ write_opcodes (void) int i = 0, j = 0, k; /* write out opcode table. */ + printf ("#include \"defs.h\"\n"); printf ("#include \"sim-main.h\"\n"); printf ("#include \"simops.h\"\n\n"); printf ("struct simops Simops[] = {\n"); -- cgit v1.1