postgres.git / summary / log / commit / refs

commit    bd110e250e9d9291d7fc1ea12ddd5d177a2460bd
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Sun Jan 23 16:09:00 2022 +0000
First released in: 15.0, 10.20, 11.15, 12.10, 13.6, 14.2

    Suppress variable-set-but-not-used warning from clang 13.
    
    In the normal configuration where GEQO_DEBUG isn't defined,
    recent clang versions have started to complain that geqo_main.c
    accumulates the edge_failures count but never does anything
    with it.  As a minimal back-patchable fix, insert a void cast
    to silence this warning.  (I'd speculated about ripping out the
    GEQO_DEBUG logic altogether, but I don't think we'd wish to
    back-patch that.)
    
    Per recently-established project policy, this is a candidate
    for back-patching into out-of-support branches: it suppresses
    an annoying compiler warning but changes no behavior.  Hence,
    back-patch all the way to 9.2.
    
    Discussion: https://postgr.es/m/CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com


src/backend/optimizer/geqo/geqo_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c index 3eb8bcb76f6..630fdd043b8 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) [parent: 5e9fe2530771]