mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Élie Brami" <elie.brami@epita.fr>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [musl] [PATCH] Update __procfdname and seed48 proto to conform to header
Date: Mon, 29 May 2023 00:18:47 +0000	[thread overview]
Message-ID: <PR0P264MB3191EA10EDBC732AE1D6D5E6F74A9@PR0P264MB3191.FRAP264.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <PR0P264MB3191B34478FCB9233FCA5209F74A9@PR0P264MB3191.FRAP264.PROD.OUTLOOK.COM>

In new GCC11 when -Werror=array-parameter=1 is added we get some mismatch

src/internal/procfdname.c:3:25: error: argument 1 of type 'char *' declared as a pointer [-Werror=array-parameter=]
    3 | void __procfdname(char *buf, unsigned fd)
      |                   ~~~~~~^~~
In file included from src/internal/procfdname.c:1:
src/internal/syscall.h:394:31: note: previously declared as an array 'char[static 27]'
  394 | hidden void __procfdname(char __buf[static 15+3*sizeof(int)], unsigned);
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:150: obj/src/internal/procfdname.o] Error 1
src/prng/seed48.c:5:40: error: argument 1 of type 'short unsigned int *' declared as a pointer [-Werror=array-parameter=]
    5 | unsigned short *seed48(unsigned short *s)
      |                        ~~~~~~~~~~~~~~~~^
In file included from ./src/include/stdlib.h:4,
                 from src/prng/seed48.c:1:
./src/include/../../include/stdlib.h:135:25: note: previously declared as an array 'short unsigned int[3]'
  135 | unsigned short *seed48 (unsigned short [3]);
      |                         ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:150: obj/src/prng/seed48.o] Error 1
---
 src/internal/procfdname.c | 2 +-
 src/prng/seed48.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/internal/procfdname.c b/src/internal/procfdname.c
index fd7306ab..bfa3e7e5 100644
--- a/src/internal/procfdname.c
+++ b/src/internal/procfdname.c
@@ -1,6 +1,6 @@
 #include "syscall.h"
 
-void __procfdname(char *buf, unsigned fd)
+void __procfdname(char buf[static 15+3*sizeof(int)], unsigned fd)
 {
         unsigned i, j;
         for (i=0; (buf[i] = "/proc/self/fd/"[i]); i++);
diff --git a/src/prng/seed48.c b/src/prng/seed48.c
index bce7b339..6219ebcf 100644
--- a/src/prng/seed48.c
+++ b/src/prng/seed48.c
@@ -2,7 +2,7 @@
 #include <string.h>
 #include "rand48.h"
 
-unsigned short *seed48(unsigned short *s)
+unsigned short *seed48(unsigned short s[static 3])
 {
         static unsigned short p[3];
         memcpy(p, __seed48, sizeof p);
-- 
2.40.1

       reply	other threads:[~2023-05-29  0:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <PR0P264MB3191B34478FCB9233FCA5209F74A9@PR0P264MB3191.FRAP264.PROD.OUTLOOK.COM>
2023-05-29  0:18 ` Élie Brami [this message]
2023-05-29 15:49   ` Rich Felker

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=PR0P264MB3191EA10EDBC732AE1D6D5E6F74A9@PR0P264MB3191.FRAP264.PROD.OUTLOOK.COM \
    --to=elie.brami@epita.fr \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).