From: Tom Lane <tgl@sss.pgh.pa.us>
To: Noah Misch <noah@leadboat.com>
Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>
Cc: David Steele <david@pgmasters.net>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Suppress Clang 3.9 warnings
Date: Thu, 16 Mar 2017 10:17:45 -0400
Message-ID: <8651.1489673865@sss.pgh.pa.us> (raw)
In-Reply-To: <20170316065520.GA1976012@tornado.leadboat.com>
References: <20170220141239.GD12278@e733.localdomain>
<alpine.DEB.2.20.1702221532100.22403@lancre>
<dc2a33c7-a498-c277-592e-30a9ad8c7926@pgmasters.net>
<20170313153553.GB2564@e733.localdomain>
<20170315022538.GA1723554@tornado.leadboat.com>
<20170315090410.GA25568@e733.localdomain>
<20170316065520.GA1976012@tornado.leadboat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Noah Misch <noah@leadboat.com> writes:
> On Wed, Mar 15, 2017 at 12:04:11PM +0300, Aleksander Alekseev wrote:
>> If it no too much trouble could you please explain what will happen
>> on such platforms?
> Both port.h and a system header will furnish a strlcpy() declaration. The #if
> you modified exists to avoid that, and your change would make it ineffective
> for Clang. This will have no symptoms, or it will elicit a warning.
The reason why this is bad is that port.h's declaration might be different
from the system headers'. That's not hypothetical; for example, on my
Mac laptop, strlcpy is declared
size_t strlcpy(char * restrict dst, const char * restrict src, size_t size);
whereas of course there's no "restrict" in port.h. To make matters worse,
it looks like strlcpy is actually a macro expanding to
'__builtin___strlcpy_chk'. And the compiler on this box *is* clang,
meaning the proposed patch would affect it. When I try it, I get
boatloads of errors (not warnings) like these:
In file included from ../../src/include/postgres_fe.h:25:
In file included from ../../src/include/c.h:1125:
../../src/include/port.h:403:15: error: expected parameter declarator
extern size_t strlcpy(char *dst, const char *src, size_t siz);
^
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
../../src/include/port.h:403:15: error: conflicting types for '__builtin___strlcpy_chk'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'
In short, if this were to get committed, it would get reverted within
minutes, because more than a few of us use Macs.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, noah@leadboat.com, a.alekseev@postgrespro.ru, david@pgmasters.net
Subject: Re: [PATCH] Suppress Clang 3.9 warnings
In-Reply-To: <8651.1489673865@sss.pgh.pa.us>
References: <20170220141239.GD12278@e733.localdomain> <alpine.DEB.2.20.1702221532100.22403@lancre> <dc2a33c7-a498-c277-592e-30a9ad8c7926@pgmasters.net> <20170313153553.GB2564@e733.localdomain> <20170315022538.GA1723554@tornado.leadboat.com> <20170315090410.GA25568@e733.localdomain> <20170316065520.GA1976012@tornado.leadboat.com> <8651.1489673865@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox