Re: silence compiler warning in brin.c
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Zhihong Yu <zyu@yugabyte.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2022-06-01T17:38:24Z
Lists: pgsql-hackers
On Wed, Jun 01, 2022 at 01:06:21PM -0400, Tom Lane wrote: > Zhihong Yu <zyu@yugabyte.com> writes: >> It seems the variable can be initialized to the value of GUCNestLevel since >> later in the func: >> /* Roll back any GUC changes executed by index functions */ >> AtEOXact_GUC(false, save_nestlevel); > > That seems pretty inappropriate. If, thanks to some future thinko, > control were able to reach the AtEOXact_GUC call despite not having > called NewGUCNestLevel, we'd want that to fail. +1 > It looks like > AtEOXact_GUC asserts nestLevel > 0, so that either 0 or -1 would > do as an "invalid" value; I'd lean a bit to using 0. I only chose -1 to follow a117ceb's example in amcheck. I have no preference. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com
Commits
-
Silence compiler warnings from some older compilers.
- dd672be38d39 12.12 landed
- dd1c8dd1015f 15.0 landed
- c05118014776 10.22 landed
- 60ca2e8418a1 13.8 landed
- 4e467261560f 14.4 landed
- 37290f7f5a9a 11.17 landed