On Sat, Dec 24 2022, Patrick Wildt <patr...@blueri.se> wrote: > On Thu, Dec 22, 2022 at 01:14:57AM +0100, Patrick Wildt wrote: >> On Tue, Dec 20, 2022 at 05:48:41PM -0700, Todd C. Miller wrote: >> > On Tue, 20 Dec 2022 23:44:08 +0100, Patrick Wildt wrote: >> > >> > > clang complains when the function is declared with a fixed array size in >> > > a parameter while the prototype is unbounded, like this: >> > > >> > > /usr/src/sys/net/pf.c:4353:54: error: argument 'sns' of type 'struct >> > > pf_src_n >> > > ode *[4]' with mismatched bound [-Werror,-Warray-parameter] >> > > struct pf_rule_actions *act, struct pf_src_node *sns[PF_SN_MAX]) >> > > ^ >> > > /usr/src/sys/net/pf.c:203:28: note: previously declared as 'struct >> > > pf_src_nod >> > > e *[]' here >> > > struct pf_src_node *[]); >> > > ^ >> > > 1 error generated. >> > > >> > > We have a few of that, and was wondering what the better solution is. >> > > clang apparently accepts using * instead of []. The alternative would >> > > be to hardcode the size in the prototype as well. Here's a diff for >> > > a three files for the first version, as example. >> > >> > Using * instead of [] is the saner approach. Hard-coding the sizes >> > into the prototype seems like a bad idea, even if clang is now smart >> > enough to complain about a mismatch. >> > >> > - todd >> >> So, here's the full diff that allows me to compile arm64 GENERIC.MP, >> with radeondrm and amdgpu disabled. > > Right, sorry for derailing the thread with a different discussion. > Here's a diff only for the array/ptr changes.
That's for the kernel part. libsa diff below, ok? Index: hmac_sha1.h =================================================================== RCS file: /home/cvs/src/sys/lib/libsa/hmac_sha1.h,v retrieving revision 1.1 diff -u -p -p -u -r1.1 hmac_sha1.h --- hmac_sha1.h 9 Oct 2012 12:36:50 -0000 1.1 +++ hmac_sha1.h 27 Dec 2022 00:45:39 -0000 @@ -22,4 +22,4 @@ * HMAC-SHA-1 (from RFC 2202). */ void hmac_sha1(const u_int8_t *, size_t, const u_int8_t *, - size_t, u_int8_t []); + size_t, u_int8_t *); -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE