Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Dimitar Dimitrov <dimitar@dinux.eu>
To: gdb-patches@sourceware.org
Cc: Dimitar Dimitrov <dimitar@dinux.eu>
Subject: [PATCH] sim: Fix compile errors
Date: Fri, 12 Jan 2024 19:40:01 +0200	[thread overview]
Message-ID: <20240112174001.403010-1-dimitar@dinux.eu> (raw)

The following change broke simulator testsuite with host GCC 13:
  commit 435ad222b3de93fa647fba7221eece36b1b395eb
  sim: warnings: compile build tools with -Werror too

Host GCC13 complains about missing function prototypes:

binutils/sim/testsuite/common/bits-gen.c:26:1: error: no previous prototype for ‘gen_struct’ [-Werror=missing-prototypes]
   26 | gen_struct (void)
      | ^~~~~~~~~~

Fix by making the functions static, which instructs the compiler that
there is no need for a prototype.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
 sim/testsuite/common/alu-n-tst.h |  4 ++--
 sim/testsuite/common/bits-gen.c  | 10 +++++-----
 sim/testsuite/common/bits-tst.c  | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sim/testsuite/common/alu-n-tst.h b/sim/testsuite/common/alu-n-tst.h
index 14abe86e8a7..ffd962cb0c2 100644
--- a/sim/testsuite/common/alu-n-tst.h
+++ b/sim/testsuite/common/alu-n-tst.h
@@ -27,7 +27,7 @@
 #define do_op_N      XCONCAT2(do_op_,N)
 
 
-void
+static void
 do_op_N (const alu_test *tst)
 {
   const alu_op *op;
@@ -120,7 +120,7 @@ do_op_N (const alu_test *tst)
 }
 
 
-const alu_test alu_N_tests[] = {
+static const alu_test alu_N_tests[] = {
 
   /* 0 + 0; 0 + 1; 1 + 0; 1 + 1 */
   { 0, { { "ADDC", 0 }, }, 0, 0, 0, },
diff --git a/sim/testsuite/common/bits-gen.c b/sim/testsuite/common/bits-gen.c
index d8818754d46..fc1333be945 100644
--- a/sim/testsuite/common/bits-gen.c
+++ b/sim/testsuite/common/bits-gen.c
@@ -22,7 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 #include <unistd.h>
 
-void
+static void
 gen_struct (void)
 {
   printf ("\n");
@@ -44,7 +44,7 @@ gen_struct (void)
 }
 
 
-void
+static void
 gen_bit (int bitsize,
 	 int msb,
 	 const char *macro,
@@ -79,7 +79,7 @@ gen_bit (int bitsize,
 }
 
 
-void
+static void
 gen_enum (const char *macro,
 	  int nr_bits)
 {
@@ -96,7 +96,7 @@ gen_enum (const char *macro,
 }
 
 
-void
+static void
 gen_mask (int bitsize,
 	  const char *msb,
 	  const char *macro,
@@ -160,7 +160,7 @@ gen_mask (int bitsize,
 }
 
 
-void
+static void
 usage (int reason)
 {
   fprintf (stderr, "Usage:\n");
diff --git a/sim/testsuite/common/bits-tst.c b/sim/testsuite/common/bits-tst.c
index bcdee1070b9..a30753e4b16 100644
--- a/sim/testsuite/common/bits-tst.c
+++ b/sim/testsuite/common/bits-tst.c
@@ -3,7 +3,7 @@
 /* Drive the bit test routines */
 
 
-long long
+static long long
 calc (const char *call,
       long long val,
       int row,
@@ -161,7 +161,7 @@ calc (const char *call,
 }
 
 
-int
+static int
 check_sext (int nr_bits,
 	    int msb_nr,
 	    const char *sexted,
@@ -214,7 +214,7 @@ check_sext (int nr_bits,
 }
 
 
-int
+static int
 check_rot (int nr_bits,
 	   const char *roted,
 	   const char *masked)
@@ -248,7 +248,7 @@ check_rot (int nr_bits,
 }
 
 
-int
+static int
 check_extract (int nr_bits,
 	       const char *extracted,
 	       const char *inserted,
@@ -277,7 +277,7 @@ check_extract (int nr_bits,
 }
 
 
-int
+static int
 check_bits (int call,
 	    test_spec **tests)
 {
-- 
2.43.0


             reply	other threads:[~2024-01-12 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 17:40 Dimitar Dimitrov [this message]
2024-01-12 18:48 ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240112174001.403010-1-dimitar@dinux.eu \
    --to=dimitar@dinux.eu \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox