From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id CB890385828C; Mon, 24 Oct 2022 16:24:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB890385828C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666628681; bh=7upKCz2I+de/lGQpeTLQTx1OfOOAZySjirlU6uErDaw=; h=From:To:Subject:Date:From; b=JCfz2MzJp/SIH8okWPDFHd3BCatpXCQJAliL6pxORysi8oVg07XML6fgCKxYKepj0 uYPWQbseVPLO248iBmXOzoQ+Ou038ntui4aT/V3sce6Wm4v1PhNjNDfAtRkiCzmuJ9 JTFieyJhcNJYAys8YE7jBpVLqFLYji5d+Io27NnU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim/lm32: fix some missing function declaration warnings X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: da8b81754bcd9eb2e45cec4997770a591cc61a8f X-Git-Newrev: 1be79b1ebfad75626bf86eee35839e0afd081fdd Message-Id: <20221024162441.CB890385828C@sourceware.org> Date: Mon, 24 Oct 2022 16:24:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1be79b1ebfad= 75626bf86eee35839e0afd081fdd commit 1be79b1ebfad75626bf86eee35839e0afd081fdd Author: Andrew Burgess Date: Wed Oct 19 15:31:28 2022 +0100 sim/lm32: fix some missing function declaration warnings =20 In the lm32 simulator, I was seeing some warnings about missing function declarations. =20 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 =20 In this commit I added the missing #define so that the full cpu.h can be included. =20 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. =20 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. Diff: --- sim/lm32/Makefile.in | 3 --- sim/lm32/cpu.h | 11 +++++++++++ sim/lm32/dv-lm32cpu.c | 3 +++ sim/lm32/user.c | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sim/lm32/Makefile.in b/sim/lm32/Makefile.in index d827b711d45..db15bef47a7 100644 --- a/sim/lm32/Makefile.in +++ b/sim/lm32/Makefile.in @@ -24,9 +24,6 @@ SIM_EXTRA_DEPS =3D $(CGEN_INCLUDE_DEPS) $(srcdir)/../../o= pcodes/lm32-desc.h \ =20 SIM_EXTRA_CLEAN =3D lm32-clean =20 -# Some modules don't build cleanly yet. -dv-lm32cpu.o mloop.o sem.o traps.o user.o: SIM_WERROR_CFLAGS =3D - ## COMMON_POST_CONFIG_FRAG =20 arch =3D lm32=20 diff --git a/sim/lm32/cpu.h b/sim/lm32/cpu.h index 05b98be8cf1..d025065f2ba 100644 --- a/sim/lm32/cpu.h +++ b/sim/lm32/cpu.h @@ -163,6 +163,17 @@ struct scache { struct argbuf argbuf; }; =20 +/* 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. = */ =20 diff --git a/sim/lm32/dv-lm32cpu.c b/sim/lm32/dv-lm32cpu.c index b97580e80a3..15a08eee815 100644 --- a/sim/lm32/dv-lm32cpu.c +++ b/sim/lm32/dv-lm32cpu.c @@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . = */ =20 +#define WANT_CPU lm32bf +#define WANT_CPU_LM32BF + /* This must come before any other includes. */ #include "defs.h" =20 diff --git a/sim/lm32/user.c b/sim/lm32/user.c index 3cc21a208ee..d301d482c1b 100644 --- a/sim/lm32/user.c +++ b/sim/lm32/user.c @@ -21,6 +21,9 @@ /* This must come before any other includes. */ #include "defs.h" =20 +#define WANT_CPU lm32bf +#define WANT_CPU_LM32BF + #include "sim-main.h" =20 /* Handle user defined instructions. */