public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Thomas Munro <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Warning in geqo_main.c from clang 13
Date: Sat, 22 Jan 2022 17:34:16 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com>
<[email protected]>
I wrote:
> Thomas Munro <[email protected]> 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
Attachments:
[text/x-diff] silence-clang-warning-v2.patch (753B, ../[email protected]/2-silence-clang-warning-v2.patch)
download | inline diff:
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/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 *initial_rels)
}
-#if defined(ERX) && defined(GEQO_DEBUG)
+#if defined(ERX)
+#if defined(GEQO_DEBUG)
if (edge_failures != 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)
view thread (2+ messages)
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Warning in geqo_main.c from clang 13
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox