Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBP05-00080o-Pw for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Jan 2022 22:36:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nBP04-0004oY-MH for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Jan 2022 22:36:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBOxh-00083B-LN for pgsql-hackers@lists.postgresql.org; Sat, 22 Jan 2022 22:34:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBOxf-0002xl-9C for pgsql-hackers@postgresql.org; Sat, 22 Jan 2022 22:34:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20MMYGnc1497685; Sat, 22 Jan 2022 17:34:16 -0500 From: Tom Lane To: Thomas Munro cc: pgsql-hackers Subject: Re: Warning in geqo_main.c from clang 13 In-reply-to: <85872.1637723874@sss.pgh.pa.us> References: <85872.1637723874@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 23 Nov 2021 22:17:54 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1497642.1642890813.0@sss.pgh.pa.us> Date: Sat, 22 Jan 2022 17:34:16 -0500 Message-ID: <1497684.1642890856@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1497642.1642890813.1@sss.pgh.pa.us> I wrote: > Thomas Munro writes: >> Clang 13 on my machine and peripatus (but not Apple clang 13 on eg >> sifika, I'm still confused about Apple's versioning but I think that's >> really llvm 12-based) warns: >> geqo_main.c:86:8: warning: variable 'edge_failures' set but not used >> [-Wunused-but-set-variable] >> Here's one way to silence it. > I'm kind of inclined to just drop the edge_failures recording/logging > altogether, rather than make that rats-nest of #ifdefs even worse. > It's not like anyone has cared about that number in the last decade > or two. We're starting to see more buildfarm animals producing this warning, so I took another look, and thought of a slightly less invasive way to silence it. I confirmed this works with clang 13.0.0 on Fedora 35. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="silence-clang-warning-v2.patch"; charset="us-ascii" Content-ID: <1497642.1642890813.2@sss.pgh.pa.us> Content-Description: silence-clang-warning-v2.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimize= r/geqo/geqo_main.c index 333a26a695..68ed74325c 100644 --- a/src/backend/optimizer/geqo/geqo_main.c +++ b/src/backend/optimizer/geqo/geqo_main.c @@ -227,12 +227,17 @@ geqo(PlannerInfo *root, int number_of_rels, List *in= itial_rels) } = = -#if defined(ERX) && defined(GEQO_DEBUG) +#if defined(ERX) +#if defined(GEQO_DEBUG) if (edge_failures !=3D 0) elog(LOG, "[GEQO] failures: %d, average: %d", edge_failures, (int) number_generations / edge_failures); else elog(LOG, "[GEQO] no edge failures detected"); +#else + /* suppress variable-set-but-not-used warnings from some compilers */ + (void) edge_failures; +#endif #endif = #if defined(CX) && defined(GEQO_DEBUG) ------- =_aaaaaaaaaa0--