Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coWFV-00074J-Th for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2017 14:19:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1coWFV-0006Xb-5K for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2017 14:19:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1coWDz-0001KI-Cr for pgsql-hackers@postgresql.org; Thu, 16 Mar 2017 14:17:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1coWDw-0006tt-Pa for pgsql-hackers@postgresql.org; Thu, 16 Mar 2017 14:17:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v2GEHjnD008652; Thu, 16 Mar 2017 10:17:45 -0400 From: Tom Lane To: Noah Misch cc: Aleksander Alekseev , David Steele , PostgreSQL Developers Subject: Re: [PATCH] Suppress Clang 3.9 warnings In-reply-to: <20170316065520.GA1976012@tornado.leadboat.com> References: <20170220141239.GD12278@e733.localdomain> <20170313153553.GB2564@e733.localdomain> <20170315022538.GA1723554@tornado.leadboat.com> <20170315090410.GA25568@e733.localdomain> <20170316065520.GA1976012@tornado.leadboat.com> Comments: In-reply-to Noah Misch message dated "Thu, 16 Mar 2017 02:55:20 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8650.1489673865.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 16 Mar 2017 10:17:45 -0400 Message-ID: <8651.1489673865@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Noah Misch 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. Th= e #if > you modified exists to avoid that, and your change would make it ineffect= ive > 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 --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers