From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11359 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] fix a invalid conversion from 'void*' to 'char*' Date: Sat, 27 May 2017 21:46:13 -0400 Message-ID: <20170528014613.GB1627@brightrain.aerifal.cx> References: <1494668521-30187-1-git-send-email-liu.ming50@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1495935989 21185 195.159.176.226 (28 May 2017 01:46:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 May 2017 01:46:29 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11374-gllmg-musl=m.gmane.org@lists.openwall.com Sun May 28 03:46:26 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dEnHj-0005Ms-6R for gllmg-musl@m.gmane.org; Sun, 28 May 2017 03:46:23 +0200 Original-Received: (qmail 11405 invoked by uid 550); 28 May 2017 01:46:26 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 11387 invoked from network); 28 May 2017 01:46:26 -0000 Content-Disposition: inline In-Reply-To: <1494668521-30187-1-git-send-email-liu.ming50@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11359 Archived-At: On Sat, May 13, 2017 at 11:42:01AM +0200, liu.ming50@gmail.com wrote: > From: Ming Liu > > A compiling warning is observed with gcc -Wconversion option, fixed > by casting 'void*' to 'char*'. > > Signed-off-by: Ming Liu > --- > include/string.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/string.h b/include/string.h > index ff9badb..b6b2d82 100644 > --- a/include/string.h > +++ b/include/string.h > @@ -85,7 +85,7 @@ size_t strlcpy (char *, const char *, size_t); > #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 *); > int strcasecmp_l (const char *, const char *, locale_t); > int strncasecmp_l (const char *, const char *, size_t, locale_t); > -- > 2.7.4 Apologies for not replying sooner; I've been behind on everything. Generally it's the intent of GCC not to produce warnings for code in or expanded from system headers. If you're getting warnings like this, check that you don't have an installation problem (or maybe explicit -I of system header path) that confuses GCC and makes it think these are not system headers. Casting the return value of allocation functions is generally Considered Harmful in C, and not something you want to be doing, but perhaps the problems is arising when this macro is used in C++ code? Can you be more specific about how you encountered it? If it really is invalid as C++ perhaps something should be changed since the header is intended to be usable as C++. Rich