public inbox for [email protected]  
help / color / mirror / Atom feed
From: Thomas Munro <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Warning in geqo_main.c from clang 13
Date: Wed, 24 Nov 2021 15:31:49 +1300
Message-ID: <CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com> (raw)

Hi,

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]
        int                     edge_failures = 0;

Here's one way to silence it.


Attachments:

  [text/x-patch] warning.patch (1.0K, ../CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com/2-warning.patch)
  download | inline diff:
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c
index 09d9e7d4dd..b18eccfae4 100644
--- a/src/backend/optimizer/geqo/geqo_main.c
+++ b/src/backend/optimizer/geqo/geqo_main.c
@@ -83,8 +83,10 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)
 
 #if defined(ERX)
 	Edge	   *edge_table;		/* list of edges */
+#if defined(GEQO_DEBUG)
 	int			edge_failures = 0;
 #endif
+#endif
 #if defined(CX) || defined(PX) || defined(OX1) || defined(OX2)
 	City	   *city_table;		/* list of cities */
 #endif
@@ -187,7 +189,10 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)
 		kid = momma;
 
 		/* are there any edge failures ? */
-		edge_failures += gimme_tour(root, edge_table, kid->string, pool->string_length);
+#if defined(GEQO_DEBUG)
+		edge_failures +=
+#endif
+			gimme_tour(root, edge_table, kid->string, pool->string_length);
 #elif defined(PMX)
 		/* PARTIALLY MATCHED CROSSOVER */
 		pmx(root, momma->string, daddy->string, kid->string, pool->string_length);


view thread (2+ messages)  latest in thread

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]
  Subject: Re: Warning in geqo_main.c from clang 13
  In-Reply-To: <CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com>

* 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