Fix compilation warning with SerializeClientConnectionInfo()
authorMichael Paquier <[email protected]>
Thu, 14 Aug 2025 07:22:00 +0000 (16:22 +0900)
committerMichael Paquier <[email protected]>
Thu, 14 Aug 2025 07:22:00 +0000 (16:22 +0900)
This function uses an argument named "maxsize" that is only used in
assertions, being set once outside the assertion area.  Recent gcc
versions with -Wunused-but-set-parameter complain about a warning when
building without assertions enabled, because of that.

In order to fix this issue, PG_USED_FOR_ASSERTS_ONLY is added to the
function argument of SerializeClientConnectionInfo(), which is the first
time we are doing so in the tree.  The CI is fine with the change, but
let's see what the buildfarm has to say on the matter.

Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Jacob Champion <[email protected]>
Discussion: https://postgr.es/m/pevajesswhxafjkivoq3yvwxga77tbncghlf3gq5fvchsvfuda@6uivg25sb3nx
Backpatch-through: 16

src/backend/utils/init/miscinit.c

index 8ac8ecc0dbb9d16bc360a7205b6d20e6986e3924..0d06f0bdc70848f0f130134ff7f75422014a460c 100644 (file)
@@ -1094,7 +1094,8 @@ EstimateClientConnectionInfoSpace(void)
  * Serialize MyClientConnectionInfo for use by parallel workers.
  */
 void
-SerializeClientConnectionInfo(Size maxsize, char *start_address)
+SerializeClientConnectionInfo(Size maxsize PG_USED_FOR_ASSERTS_ONLY,
+                             char *start_address)
 {
    SerializedClientConnectionInfo serialized = {0};