Re: silence compiler warning in brin.c

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: silence compiler warning in brin.c
Date: 2022-06-01 21:30:13
Message-ID: 20220601213013.GA2400888@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 01, 2022 at 05:08:03PM -0400, Tom Lane wrote:
> Hmm, if we're following amcheck's example it should be more like this:
>
> diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
> index 52f171772d..0de1441dc6 100644
> --- a/src/backend/access/brin/brin.c
> +++ b/src/backend/access/brin/brin.c
> @@ -1051,7 +1051,13 @@ brin_summarize_range(PG_FUNCTION_ARGS)
> save_nestlevel = NewGUCNestLevel();
> }
> else
> + {
> heapRel = NULL;
> + /* Set these just to suppress "uninitialized variable" warnings */
> + save_userid = InvalidOid;
> + save_sec_context = -1;
> + save_nestlevel = -1;
> + }
>
> indexRel = index_open(indexoid, ShareUpdateExclusiveLock);
>
> I like this better anyway since the fact that the other two variables
> aren't warned about seems like an implementation artifact.

Yeah, that is better. It's not clear why the other variables aren't
subject to the same warnings, so we might as well cover our bases.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-06-01 22:43:06 Re: Prevent writes on large objects in read-only transactions
Previous Message Jacob Champion 2022-06-01 21:29:06 Re: [PATCH] Compression dictionaries for JSONB