Skip to content

Commit 5f1ab46

Browse files
committed
Suppress a couple of compiler warnings seen with older gcc versions.
To wit, bgworker.c: In function `RegisterDynamicBackgroundWorker': bgworker.c:761: warning: `generation' might be used uninitialized in this function dsm_impl.c: In function `dsm_impl_op': dsm_impl.c:197: warning: control reaches end of non-void function Neither of these represent actual bugs, but we may as well tweak the code so that more compilers can tell that. This won't change the generated code on compilers that do recognize that the cases are unreachable.
1 parent 2c66f99 commit 5f1ab46

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/backend/postmaster/bgworker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ RegisterDynamicBackgroundWorker(BackgroundWorker *worker,
758758
{
759759
int slotno;
760760
bool success = false;
761-
uint64 generation;
761+
uint64 generation = 0;
762762

763763
/*
764764
* We can't register dynamic background workers from the postmaster.

src/backend/storage/ipc/dsm_impl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ dsm_impl_op(dsm_op op, dsm_handle handle, uint64 request_size,
191191
return dsm_impl_mmap(op, handle, request_size, impl_private,
192192
mapped_address, mapped_size, elevel);
193193
#endif
194+
default:
195+
elog(ERROR, "unexpected dynamic shared memory type: %d",
196+
dynamic_shared_memory_type);
197+
return false;
194198
}
195-
elog(ERROR, "unexpected dynamic shared memory type: %d",
196-
dynamic_shared_memory_type);
197199
}
198200

199201
/*

0 commit comments

Comments
 (0)