Commit 9a725f7b authored by Tom Lane's avatar Tom Lane

Silence assorted "variable may be used uninitialized" warnings.

All of these are false positives, but in each case a fair amount of
analysis is needed to see that, and it's not too surprising that not all
compilers are smart enough.  (In particular, in the logtape.c case, a
compiler lacking the knowledge provided by the Assert would almost surely
complain, so that this warning will be seen in any non-assert build.)

Some of these are of long standing while others are pretty recent,
but it only seems worth fixing them in HEAD.

Jaime Casanova, tweaked a bit by me

Discussion: https://postgr.es/m/CAJGNTeMcYAMJdPAom52dppLMtF-UnEZi0dooj==75OEv1EoBZA@mail.gmail.com
parent 0c62356c
......@@ -584,7 +584,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
if (include_image)
{
Page page = regbuf->page;
uint16 compressed_len;
uint16 compressed_len = 0;
/*
* The page needs to be backed up, so calculate its hole length
......
......@@ -1593,6 +1593,8 @@ get_object_address_opf_member(ObjectType objtype,
famaddr = get_object_address_opcf(OBJECT_OPFAMILY, copy, false);
/* find out left/right type names and OIDs */
typenames[0] = typenames[1] = NULL;
typeoids[0] = typeoids[1] = InvalidOid;
i = 0;
foreach(cell, lsecond(object))
{
......
......@@ -411,7 +411,7 @@ ltsConcatWorkerTapes(LogicalTapeSet *lts, TapeShare *shared,
SharedFileSet *fileset)
{
LogicalTape *lt = NULL;
long tapeblocks;
long tapeblocks = 0L;
long nphysicalblocks = 0L;
int i;
......
......@@ -1495,6 +1495,7 @@ coerceToBool(PgBenchValue *pval, bool *bval)
else /* NULL, INT or DOUBLE */
{
fprintf(stderr, "cannot coerce %s to boolean\n", valueTypeName(pval));
*bval = false; /* suppress uninitialized-variable warnings */
return false;
}
}
......@@ -1725,9 +1726,9 @@ evalLazyFunc(TState *thread, CState *st,
* which do not require lazy evaluation.
*/
static bool
evalStandardFunc(
TState *thread, CState *st,
PgBenchFunction func, PgBenchExprLink *args, PgBenchValue *retval)
evalStandardFunc(TState *thread, CState *st,
PgBenchFunction func, PgBenchExprLink *args,
PgBenchValue *retval)
{
/* evaluate all function arguments */
int nargs = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment