mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] g++ fpermissive compilation error for strdupa
@ 2022-06-22  8:05 He X
  2022-06-22 13:19 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: He X @ 2022-06-22  8:05 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1071 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-24  5:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  8:05 [musl] g++ fpermissive compilation error for strdupa He X
2022-06-22 13:19 ` Rich Felker
2022-06-23  2:59   ` He X
2022-06-23  3:07     ` Rich Felker
2022-06-23 19:25     ` Wolf
2022-06-24  5:24       ` He X
2022-06-23  7:40   ` Bartosz Brachaczek

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).