]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim/lm32: fix some missing function declaration warnings
authorAndrew Burgess <aburgess@redhat.com>
Wed, 19 Oct 2022 14:31:28 +0000 (15:31 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 24 Oct 2022 16:24:29 +0000 (17:24 +0100)
In the lm32 simulator, I was seeing some warnings about missing
function declarations.

The lm32 simulator has a weird header structure, in order to pull in
the full cpu.h header we need to define WANT_CPU_LM32BF.  This is done
in some files, but not in others.  Critically, it's not done in some
files that then use functions declared in cpu.h

In this commit I added the missing #define so that the full cpu.h can
be included.

After doing this there are still a few functions that are used
undeclared, these functions appear to be missing any declarations at
all, so I've added some to cpu.h.

With this done all the warnings when compiling lm32 are resolved for
both gcc and clang, so I've removed the SIM_WERROR_CFLAGS line from
Makefile.in, this allows lm32 to build with -Werror.

sim/lm32/Makefile.in
sim/lm32/cpu.h
sim/lm32/dv-lm32cpu.c
sim/lm32/user.c

index d827b711d45ece50e1d005953f99ac3a2f2c0b59..db15bef47a7634ffea878ed7675b9d0098174883 100644 (file)
@@ -24,9 +24,6 @@ SIM_EXTRA_DEPS = $(CGEN_INCLUDE_DEPS) $(srcdir)/../../opcodes/lm32-desc.h \
 
 SIM_EXTRA_CLEAN = lm32-clean
 
-# Some modules don't build cleanly yet.
-dv-lm32cpu.o mloop.o sem.o traps.o user.o: SIM_WERROR_CFLAGS =
-
 ## COMMON_POST_CONFIG_FRAG
 
 arch = lm32 
index 05b98be8cf1412ef4fffc953f2fbe605b16dca2d..d025065f2ba96518f65fd58cf4c62fdc3eea80bb 100644 (file)
@@ -163,6 +163,17 @@ struct scache {
   struct argbuf argbuf;
 };
 
+/* From traps.c.  */
+extern USI lm32bf_b_insn (SIM_CPU * current_cpu, USI r0, USI f_r0);
+extern USI lm32bf_divu_insn (SIM_CPU * current_cpu, IADDR pc, USI r0, USI r1, USI r2);
+extern USI lm32bf_modu_insn (SIM_CPU * current_cpu, IADDR pc, USI r0, USI r1, USI r2);
+extern void lm32bf_wcsr_insn (SIM_CPU * current_cpu, USI f_csr, USI r1);
+extern USI lm32bf_break_insn (SIM_CPU * current_cpu, IADDR pc);
+extern USI lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc);
+
+/* From user.c.  */
+extern UINT lm32bf_user_insn (SIM_CPU * current_cpu, INT r0, INT r1, UINT imm);
+
 /* Macros to simplify extraction, reading and semantic code.
    These define and assign the local vars that contain the insn's fields.  */
 
index b97580e80a3248b2aece969d76d6293c5393e333..15a08eee8155024ad66236826d6a7c740306c54f 100644 (file)
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#define WANT_CPU lm32bf
+#define WANT_CPU_LM32BF
+
 /* This must come before any other includes.  */
 #include "defs.h"
 
index 3cc21a208eefbc3f8dc3f2600cefee21d8c82de8..d301d482c1b8442bd42a7c5e41f36c84233f098a 100644 (file)
@@ -21,6 +21,9 @@
 /* This must come before any other includes.  */
 #include "defs.h"
 
+#define WANT_CPU lm32bf
+#define WANT_CPU_LM32BF
+
 #include "sim-main.h"
 
 /* Handle user defined instructions.  */