From patchwork Wed Oct 19 15:24:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 59074 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FB1E3857017 for ; Wed, 19 Oct 2022 15:29:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FB1E3857017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666193376; bh=6Q0OefYiPZ4ptKU+YgDrwjna7IrKDIU8cNHqwlBizMA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=AoccFFWiCT/+lFUjV8AX73N/QI3r4bVKaUPo0/Lzux2fBCY+1odqbTm/HnlVGPTnt zniACh/0bE5aqM0hBQhZ83oNtc1occ7I1wAeJVJuWIFLSlTEtU5jwPh22x9mEvmNTe RPUwg/ke14bZj1IyTjcIWjYYTFl89h/P4IoiEaEI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 96B23386075F for ; Wed, 19 Oct 2022 15:25:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 96B23386075F Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-558-aPH4T_zUN9-AVtTgFtYCgA-1; Wed, 19 Oct 2022 11:25:13 -0400 X-MC-Unique: aPH4T_zUN9-AVtTgFtYCgA-1 Received: by mail-qk1-f198.google.com with SMTP id f12-20020a05620a408c00b006ced53b80e5so15120168qko.17 for ; Wed, 19 Oct 2022 08:25:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Q0OefYiPZ4ptKU+YgDrwjna7IrKDIU8cNHqwlBizMA=; b=VFTgeAkpf+8Fxbxdjg5vWH/RwxbLldqXQhl9dkFoHbgIWcapfuHJAevKp/UtgMh9Sw AQ7U4shdLkTpzTb3rxAqy4TJkVxZp0S2l8Nwe0XNs2aa4exdCo1fgbjsgR0oAiW7IAKz 7pdehwuvDaCRqlR17M3HSYe9yVR5Hxa6neozzYG7z4aPEkdzCyh0M1x3ST5mhTodLCJz m2WRrNr22kaJcumJJaEde1+h+rkrXs1ofevUZyd3IV4SsIMEruFK93KBDHOLyjKQfmTv DZW/m0bXALy9CrUybZapmj5KufI5G82USr7qp57yiqwpdWpchiEw70fr6f73frtOr5nO 9mHw== X-Gm-Message-State: ACrzQf2bMCImbCILDrCA2kc1Z9NYfetc1pH6fdU1WhPz0IJ4Z9cVA8JC aYBS2mTQHcAQFHf4kYMyvzmAcnHvX1L+m2JIkMYGcdIlHsO7Rvb0gW2IF5WXRb0wV0ZTLBNzIAE LOLasMpdivi+T45TkRtG0NEKPPE1Jwb5506JcaMfJGJYpOT9S5hYyF+GO9Y6TEY/QZ1XBy1Hrgw == X-Received: by 2002:a05:620a:158f:b0:6ee:93d5:e249 with SMTP id d15-20020a05620a158f00b006ee93d5e249mr5912572qkk.505.1666193112590; Wed, 19 Oct 2022 08:25:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dE3BMDLyN5lRLK/O0twxxf/IK1slS43ddw0eLsyUD29+t+D/qnjjcm33UqDn4huzBJ9bQXQ== X-Received: by 2002:a05:620a:158f:b0:6ee:93d5:e249 with SMTP id d15-20020a05620a158f00b006ee93d5e249mr5912542qkk.505.1666193112253; Wed, 19 Oct 2022 08:25:12 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id q26-20020a37f71a000000b006ed519554cfsm4823347qkj.61.2022.10.19.08.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 08:25:12 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 09/10] sim/lm32: fix some missing function declaration warnings Date: Wed, 19 Oct 2022 16:24:48 +0100 Message-Id: <4eed8f0ebf777a6c88317041690e53fcf1cfb975.1666192979.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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 | 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 = $(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 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; }; +/* 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. */ 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 . */ +#define WANT_CPU lm32bf +#define WANT_CPU_LM32BF + /* This must come before any other includes. */ #include "defs.h" 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" +#define WANT_CPU lm32bf +#define WANT_CPU_LM32BF + #include "sim-main.h" /* Handle user defined instructions. */