public inbox for [email protected]  
help / color / mirror / Atom feed
Warning in geqo_main.c from clang 13
2+ messages / 2 participants
[nested] [flat]

* Warning in geqo_main.c from clang 13
@ 2021-11-24 02:31  Thomas Munro <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Thomas Munro @ 2021-11-24 02:31 UTC (permalink / raw)
  To: pgsql-hackers

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);


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Warning in geqo_main.c from clang 13
@ 2021-11-24 03:17  Tom Lane <[email protected]>
  parent: Thomas Munro <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-11-24 03:17 UTC (permalink / raw)
  To: Thomas Munro <[email protected]>; +Cc: pgsql-hackers

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

Yeah, I noticed that a week or two ago, but didn't see a simple fix.

> 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.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-11-24 03:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 02:31 Warning in geqo_main.c from clang 13 Thomas Munro <[email protected]>
2021-11-24 03:17 ` Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox