Annoying warning in SerializeClientConnectionInfo - Mailing list pgsql-hackers

From Andres Freund
Subject Annoying warning in SerializeClientConnectionInfo
Date
Msg-id pevajesswhxafjkivoq3yvwxga77tbncghlf3gq5fvchsvfuda@6uivg25sb3nx
Whole thread Raw
Responses Re: Annoying warning in SerializeClientConnectionInfo
List 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
butnot 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



pgsql-hackers by date:

Previous
From: Gavin Panella
Date:
Subject: Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected
Next
From: Jacob Champion
Date:
Subject: Re: Annoying warning in SerializeClientConnectionInfo