From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26126 invoked from network); 22 Jun 2022 08:05:48 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 22 Jun 2022 08:05:48 -0000 Received: (qmail 1492 invoked by uid 550); 22 Jun 2022 08:05:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1459 invoked from network); 22 Jun 2022 08:05:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=d+n35A/iV55PbOM6BLpM2jTUOXw6OgjRd84yOm+rVGs=; b=Bz8M/JQfr2HgWzMht93zU0OP6EbDqGY/KE8gNaj7SIoP6I6V9jT7E60itzy7VzaCnR Lo41agPg+z7uv3PU72VtaHkgLFkAf2OSPRC2uWOS/FYOGWEUCJlfw3xpqG+S0b3A3goU UX/NgKfxEPlBf9nIdwgbDFQUSlXLn6FZq7JAizmGqpcMMMk/+mYXv258dU9ECWxk63sl q7UMEKYbsvWmRj5xdznnVAhtBL+JPVmy4XLJrUJ54aWKvf2mCKuJtAAeZOeR5PyuWXMc bKA+KKGx6ue+KWrWVemuCPc66hk8fGucCLUSNohnvWu7txLrkcx86KYnceuzsthxzi+T V/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=d+n35A/iV55PbOM6BLpM2jTUOXw6OgjRd84yOm+rVGs=; b=m5sVQGJYoGstnj1alPEi8sQtxfumuT1sjXCGs2vgsVBFQxMr60TDooFPAjiBD1bk4D NwruSeBzTcGaNSBJ1Gioaw/HicnF0onrlfSeRGHxjX0E/vVqTw9oSzmWHL0TKmyK3fw5 w/Yk4YPkUFwfbyDNmhNrbezJVN/Edcheld9UN8+NA6pctnq9EErc+76SUU9DIOegmIcH sTFUnKwJDcrOnNMJP1IGTPq3vdPdBLM+vWPqEYogK1G3rSoY/TszWluYitnaVpkHvFSg kx9YxpvU9eMcSzUbFce/btmwjfD3ve7naXn/hznZPyNMBUh6s6fjCkc8eZOHG5dMvvYB TIEg== X-Gm-Message-State: AJIora9XvJGyb8XIQT46aehktdY3ZhZzgkPvzw9K352sxMgl3P48aSAB 9uLIvaC3+dWlVzx3AomHNJEP8ZPkdvr1wFIvhbuReXb8akd6IA== X-Google-Smtp-Source: AGRyM1vh7T1tc8VeC4e5LglskuiHx964OduN4mv8HbHMYRFdnFNX3IbJ/gVr+sQwS80yHc7buotKwvhwueaExl8xlrw= X-Received: by 2002:a05:6638:2105:b0:332:24e6:b98e with SMTP id n5-20020a056638210500b0033224e6b98emr1364049jaj.281.1655885131041; Wed, 22 Jun 2022 01:05:31 -0700 (PDT) MIME-Version: 1.0 From: He X Date: Wed, 22 Jun 2022 16:05:20 +0800 Message-ID: To: musl@lists.openwall.com Content-Type: multipart/alternative; boundary="00000000000006518705e204cd6b" Subject: [musl] g++ fpermissive compilation error for strdupa --00000000000006518705e204cd6b Content-Type: text/plain; charset="UTF-8" Hi! Since *alloca* will return *void**, g++ will report error(*-fpermissive, invalid conversion from void* to char**), if you do *strcpy(alloca(32), str)*, which is the definition of *strdupa* on musl. I've patched it by type casting to fix the build of bazel. Could this be merged upstream? --- a/include/string.h 2022-04-08 01:12:40.000000000 +0800 +++ b/include/string.h 2022-04-08 01:12:40.000000000 +0800 @@ -88,7 +88,7 @@ #endif #ifdef _GNU_SOURCE -#define strdupa(x) strcpy(alloca(strlen(x)+1),x) +#define strdupa(x) strcpy((char*)(alloca(strlen(x)+1)),x) int strverscmp (const char *, const char *); char *strchrnul(const char *, int); char *strcasestr(const char *, const char *); -- Best regards, xhe --00000000000006518705e204cd6b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

Since alloca will= return void*, g++ will report error(-fpermissive, invalid conver= sion from void* to char*), if you do strcpy(alloca(32), str), wh= ich is the definition of strdupa on musl. I've patched it by typ= e casting to fix the build of bazel. Could this be merged upstream?

--- a/include/string.h =C2=A02022-04-08 01:12:40.0000= 00000 +0800
+++ b/include/string.h =C2=A02022-04-08 01:12:40.000000000 += 0800
@@ -88,7 +88,7 @@
=C2=A0#endif
=C2=A0
=C2=A0#ifdef _GNU_SO= URCE
-#define =C2=A0 =C2=A0 =C2=A0 =C2=A0strdupa(x) =C2=A0 =C2=A0 =C2=A0= strcpy(alloca(strlen(x)+1),x)
+#define =C2=A0 =C2=A0 =C2=A0 =C2=A0strdup= a(x) =C2=A0 =C2=A0 =C2=A0strcpy((char*)(alloca(strlen(x)+1)),x)
=C2=A0in= t strverscmp (const char *, const char *);
=C2=A0char *strchrnul(const c= har *, int);
=C2=A0char *strcasestr(const char *, const char *);

--
Best regards,
xhe
--00000000000006518705e204cd6b--