From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11824 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] syslog.h: fix warning "initialization discards 'const' qualifier from pointer target type" Date: Wed, 16 Aug 2017 09:24:25 -0400 Message-ID: <20170816132425.GV1627@brightrain.aerifal.cx> References: <20170816091837.10436-1-vda.linux@googlemail.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 1502889881 29707 195.159.176.226 (16 Aug 2017 13:24:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Aug 2017 13:24:41 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11837-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 16 15:24:38 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 1dhyJH-0007Kl-3X for gllmg-musl@m.gmane.org; Wed, 16 Aug 2017 15:24:35 +0200 Original-Received: (qmail 17759 invoked by uid 550); 16 Aug 2017 13:24:39 -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 17738 invoked from network); 16 Aug 2017 13:24:38 -0000 Content-Disposition: inline In-Reply-To: <20170816091837.10436-1-vda.linux@googlemail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11824 Archived-At: On Wed, Aug 16, 2017 at 11:18:37AM +0200, Denys Vlasenko wrote: > This happens when syslog.h is included with "#define SYSLOG_NAMES 1" > > Signed-off-by: Denys Vlasenko > CC: musl@lists.openwall.com > --- > include/syslog.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/syslog.h b/include/syslog.h > index 5b4d296..25eb3e4 100644 > --- a/include/syslog.h > +++ b/include/syslog.h > @@ -70,7 +70,7 @@ void vsyslog (int, const char *, va_list); > #define INTERNAL_NOPRI 0x10 > #define INTERNAL_MARK (LOG_NFACILITIES<<3) > typedef struct { > - char *c_name; > + const char *c_name; > int c_val; > } CODE; > #define prioritynames ((CODE *)(const CODE []){ \ > -- > 2.9.2 This is not the right fix; it changes the type of a struct member that's a public interface and thereby invalidates correct code that was using it. The cause is a bug (#61579) in GCC whereby -Wwrite-strings changes the language semantics (changes the type of string literals) rather than just generating a warning. Removing this option will fix it. However there are other reasons that having the names done with a compound literal rather than an external symbol is a bad idea (and contributing significant size waste to busybox, IIRC), and I suspect the right fix will make your problem go away too. Rich