Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2VbM-0002CQ-VP for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2017 05:00:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e2VbM-00049L-4U for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2017 05:00:08 +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 1e2VbJ-00044W-2C; Thu, 12 Oct 2017 05:00:05 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e2VbA-00010x-LV; Thu, 12 Oct 2017 05:00:04 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 1B1AA20B97; Thu, 12 Oct 2017 00:59:55 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Thu, 12 Oct 2017 00:59:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=YPQwLZ5iOdVQaCMyVpPoLqr8bx3FN YMl2mWhy+IZsLc=; b=B+S4qsjCE6EkWm8MBhK7BV0M1ejrH90MUebH+ka7P9Iwm n9hkMXDfQmxmaB2WR3RdH0oCfr8O2ituAfUKtQXMxX0XbrbznJec9GIq+0zpsP9A PsAwCH6jp2r28QJ9q0uO0PQ7NwEwDFcFqb42U4dTWm/akHvbZVrWHwbwwY5d9dXF R+lMN4axtgyCFPZ7L8fMHWYslhhFaXyjC1f/tt4h6HcCY0ApZNcf/dIuJkWSDK/r /ERnrs86gIDQvBvArh4RaLyKPe+/4s2bq9Ct7AIF2f7ibOkQfvBUtFwdZruQsVCH tYgnx05Qk14I9YtJjx0ao+TtzyEoBnY9k9ApkMCDA== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id C503F24775; Thu, 12 Oct 2017 00:59:54 -0400 (EDT) Date: Wed, 11 Oct 2017 21:59:53 -0700 From: Andres Freund To: pgsql-committers@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [COMMITTERS] pgsql: Add configure infrastructure to detect support for C99's restric Message-ID: <20171012045953.khz4bjdrar5mzrm7@alap3.anarazel.de> References: <20171012001320.4putagiruuehtvb6@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171012001320.4putagiruuehtvb6@alap3.anarazel.de> 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 On 2017-10-11 17:13:20 -0700, Andres Freund wrote: > Hi, > > On 2017-10-11 23:11:15 +0000, Andres Freund wrote: > > Add configure infrastructure to detect support for C99's restrict. > > > > Will be used in later commits improving performance for a few key > > routines where information about aliasing allows for significantly > > better code generation. > > > > This allows to use the C99 'restrict' keyword without breaking C89, or > > for that matter C++, compilers. If not supported it's defined to be > > empty. > > Woodlouse doesn't like this, erroring out with: > C:\buildfarm\buildenv\HEAD\pgsql.build\src\include\libpq/pqformat.h(47): error C2219: syntax error : type qualifier must be after '*' (src/backend/access/common/printsimple.c) [C:\buildfarm\buildenv\HEAD\pgsql.build\postgres.vcxproj] > > It's MSVC being super peculiar about error checks. I think msvc is just > confused by the pointer hiding typedef. Using some online MSVC (and > other compilers) frontend: > https://godbolt.org/g/TD3nmA > > I confirmed that removing the pointer hiding typedef indeed resolves the > isssue. > > I can't quite decide whether msvc just has taste and dislikes pointer > hiding typedefs as much as I do, or whether it's incredibly stupid ;) > > I'll add a comment and use StringInfoData *. That fixed that problem I think. But unfortunately since then another problem has been reported by some other animals, all with older msvc versions afaict (thrips - vs 2012, bowerbird - vs 2012). Those report that the defining of restrict to __restrict interfers with some system headers: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdlib.h(619): error C2485: '__restrict' : unrecognized extended attribute (src/backend/access/brin/brin.c) [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] Presumably that is because the headers contain __declspec(restrict) on some function declarations. I've temporarily silenced that error by moving the stdlib.h include before the definition of restrict, but that seems fairly fragile. I primarily wanted to see whether there's other problems. At least thrips is is now happy. I see a number of options to continue: - only define restrict on msvc 2013+ - for some reason woodlouse didn't complain about this problem, but I'm very doubtful that that's actually reliable. - rename restrict to pg_restrict. That's annoying because we'd have to copy the autoconf test. - live with the hack of including stdlib.h early, in pg_config.h.win32. - $better_idea Comments? Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers