Annoying warning in SerializeClientConnectionInfo

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jacob Champion <jchampion(at)postgresql(dot)org>
Subject: Annoying warning in SerializeClientConnectionInfo
Date: 2025-08-11 22:52:23
Message-ID: pevajesswhxafjkivoq3yvwxga77tbncghlf3gq5fvchsvfuda@6uivg25sb3nx
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When building without assertions with a rather recent gcc (trunk built in the
last weeks), I get this warning:

../../../../../home/andres/src/postgresql/src/backend/utils/init/miscinit.c: In function 'SerializeClientConnectionInfo':
../../../../../home/andres/src/postgresql/src/backend/utils/init/miscinit.c:1102:36: warning: parameter 'maxsize' set but not used [-Wunused-but-set-parameter=]
1102 | SerializeClientConnectionInfo(Size maxsize, char *start_address)
| ~~~~~^~~~~~~

And the warning is right. Not sure why a new compiler is needed, IIRC this
warning is present in other cases with older compilers too.

The most obvious fix is to slap on a PG_USED_FOR_ASSERTS_ONLY. However, we so
far don't seem to have used it for function parameters... But I don't see a
problem with starting to do so.

Greetings,

Andres Freund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-08-11 23:30:30 Re: Annoying warning in SerializeClientConnectionInfo
Previous Message Gavin Panella 2025-08-11 22:45:10 Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected