Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guiZA-0002ju-FN for pgsql-committers@arkaria.postgresql.org; Fri, 15 Feb 2019 18:50:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guiZ8-0005uR-4L for pgsql-committers@arkaria.postgresql.org; Fri, 15 Feb 2019 18:50:26 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1guiZ7-0005uK-V3 for pgsql-committers@lists.postgresql.org; Fri, 15 Feb 2019 18:50:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guiZ1-0002ko-9U for pgsql-committers@lists.postgresql.org; Fri, 15 Feb 2019 18:50:25 +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 x1FIoFjg015862; Fri, 15 Feb 2019 13:50:15 -0500 From: Tom Lane To: Alvaro Herrera cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix compiler builtin usage in new pg_bitutils.c In-reply-to: <20190215170034.GA28311@alvherre.pgsql> References: <20190215170034.GA28311@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 15 Feb 2019 14:00:34 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15860.1550256615.1@sss.pgh.pa.us> Date: Fri, 15 Feb 2019 13:50:15 -0500 Message-ID: <15861.1550256615@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > Hmm, this should fix the build, but I'm rushing out to lunch -- maybe > I'm missing something. > diff --git a/src/port/pg_bitutils.c b/src/port/pg_bitutils.c > index 97bfcebe4e1..e0198f3ab35 100644 > --- a/src/port/pg_bitutils.c > +++ b/src/port/pg_bitutils.c > @@ -90,9 +90,11 @@ pg_popcount_available(void) > static int > pg_popcount32_choose(uint32 word) > { > +#if defined(HAVE__GET_CPUID) || defined(HAVE__CPUID) > if (pg_popcount_available()) > pg_popcount32 = pg_popcount32_hw; > else > +#endif > pg_popcount32 = pg_popcount32_builtin; Meh. I don't see why this entire function should exist if there is nothing for it to do. I'm inclined to think that somewhere there needs to be a symbol NEED_POPCOUNT_CHOOSING that is only enabled if we have all three of HAVE__BUILTIN_POPCOUNT, nonempty CFLAGS_POPCOUNT, and HAVE__GET_CPUID || HAVE__CPUID. Possibly we should gate building of pg_bitutils_hwpopcnt.c that way too? Not much point in building that file if we have no way to figure out when to use it. regards, tom lane