Skip to content

Commit 5ba8779

Browse files
author
Marina Polyakova
committed
Fix compiler warnings due to new checks in PostgreSQL 16
See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add -Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16. pg_query_state.c: In function ‘pg_query_state’: pg_query_state.c:615:66: warning: declaration of ‘msg’ shadows a previous local [-Wshadow=compatible-local] 615 | shm_mq_msg *msg = (shm_mq_msg *) lfirst(i); | ^~~ pg_query_state.c:489:42: note: shadowed declaration is here 489 | shm_mq_msg *msg; | ^~~ pg_query_state.c: In function ‘GetRemoteBackendWorkers’: pg_query_state.c:946:25: warning: declaration of ‘proc’ shadows a parameter [-Wshadow=compatible-local] 946 | PGPROC *proc = BackendPidGetProc(pid); | ^~~~ pg_query_state.c:913:33: note: shadowed declaration is here 913 | GetRemoteBackendWorkers(PGPROC *proc) | ~~~~~~~~^~~~
1 parent 74f6c16 commit 5ba8779

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

pg_query_state.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -612,17 +612,18 @@ pg_query_state(PG_FUNCTION_ARGS)
612612
foreach(i, msgs)
613613
{
614614
List *qs_stack;
615-
shm_mq_msg *msg = (shm_mq_msg *) lfirst(i);
615+
shm_mq_msg *current_msg = (shm_mq_msg *) lfirst(i);
616616
proc_state *p_state = (proc_state *) palloc(sizeof(proc_state));
617617

618-
if (msg->result_code != QS_RETURNED)
618+
if (current_msg->result_code != QS_RETURNED)
619619
continue;
620620

621-
AssertState(msg->result_code == QS_RETURNED);
621+
AssertState(current_msg->result_code == QS_RETURNED);
622622

623-
qs_stack = deserialize_stack(msg->stack, msg->stack_depth);
623+
qs_stack = deserialize_stack(current_msg->stack,
624+
current_msg->stack_depth);
624625

625-
p_state->proc = msg->proc;
626+
p_state->proc = current_msg->proc;
626627
p_state->stack = qs_stack;
627628
p_state->frame_index = 0;
628629
p_state->frame_cursor = list_head(qs_stack);
@@ -943,10 +944,10 @@ GetRemoteBackendWorkers(PGPROC *proc)
943944
for (i = 0; i < msg->number; i++)
944945
{
945946
pid_t pid = msg->pids[i];
946-
PGPROC *proc = BackendPidGetProc(pid);
947-
if (!proc || !proc->pid)
947+
PGPROC *current_proc = BackendPidGetProc(pid);
948+
if (!current_proc || !current_proc->pid)
948949
continue;
949-
result = lcons(proc, result);
950+
result = lcons(current_proc, result);
950951
}
951952

952953
#if PG_VERSION_NUM < 100000

0 commit comments

Comments
 (0)