Re: pgsql: Change ThisTimeLineID from a global variable to a local variable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Change ThisTimeLineID from a global variable to a local variable
Date: 2021-11-07 17:23:25
Message-ID: 757856.1636305805@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Fri, Nov 05, 2021 at 04:55:52PM +0000, Robert Haas wrote:
>> Change ThisTimeLineID from a global variable to a local variable.

> lapwing looks unhappy after this commit:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lapwing&dt=2021-11-05%2022%3A40%3A10
> xlog.c: In function 'StartupXLOG':
> xlog.c:7249:5: error: 'checkPointLoc' may be used uninitialized in
> this function [-Werror=maybe-uninitialized]
> xlog.c:6686:5: note: 'checkPointLoc' was declared here

Yeah. I've seen some older compilers complain about that code before,
but now there are over a dozen buildfarm members warning about it.
It's clearly a false positive, since checkPointLoc does get set in
the read_backup_label()-failure-return code path. I think we've
seen a few other places where likely-to-be-inlined functions have
to initialize their result variables to prevent compiler warnings,
so I stuck an initialization step into read_backup_label in hopes
of silencing it.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-11-07 19:22:27 pgsql: Release notes for 14.1, 13.5, 12.9, 11.14, 10.19, 9.6.24.
Previous Message Tom Lane 2021-11-07 17:18:25 pgsql: Silence uninitialized-variable warning.