|
Message-ID: <CAOj2s=QtQW_BO3EF-cnYVXNMvXLDQ6zQ=iU_+dO9wr0Yu7QF1Q@mail.gmail.com> Date: Thu, 25 Aug 2016 09:47:06 +0200 From: Per Johansson <per@...th.org> To: musl@...ts.openwall.com Subject: syslog.h prioritynames define not compatible with -Wwrite-strings Hello, I'm trying to port a code base to musl. I've run into an issue with prioritynames as defined by syslog.h: CODE *pri_code = prioritynames; produces error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] This is repeated once per element in the array. While the error message points to -Wdiscarded-qualifiers I believe this is actually due to us using -Wwrite-strings which turns string literals into type const char* instead of char*. I suppose the most compatible solution would be to cast each string literal to char* in the define. It's either that or use const char* in the struct, but that's likely to cause issues in other programs. Or use some trickery to disable the warning I suppose, wouldn't know about that. Please CC me on any reply as I'm currently not subscribed. Minimal code to reproduce: #define SYSLOG_NAMES #include <syslog.h> CODE *c = prioritynames; Compiles without warning: gcc -nostdinc -isystem include -isystem obj/include -c test.c Adding -Wwrite-strings give warnings: gcc -Wwrite-strings -nostdinc -isystem include -isystem obj/include -c test.c Regards, -- Per Johansson
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.