Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwVv4-00075p-ER for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jun 2022 21:30:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nwVv3-0007ZC-63 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jun 2022 21:30:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwVv2-0007Z2-Rj for pgsql-hackers@lists.postgresql.org; Wed, 01 Jun 2022 21:30:20 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nwVv0-0000BN-7G for pgsql-hackers@postgresql.org; Wed, 01 Jun 2022 21:30:20 +0000 Received: by mail-il1-x135.google.com with SMTP id p1so2211005ilj.9 for ; Wed, 01 Jun 2022 14:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ysK4FSR2vVBAzp7QUTqqxSrIyUVVkr7OrZoUuy13HR4=; b=ZIAXm7KsNwXV/mYobQRxwaeb6MrL8HIPftZo64c253et1Eu6DagxdYmW82G7GwRewU ZnzqBYfWt6qKJIXJYRd87iM1EIOS8vkwqVIyfbLpuZmV1mGX0zplwglUWMLN4Dhmpbaa vBTOeFL0vC/WsUR70bt/ApjoGrdU9Y4eUPsthQo4PKgpT3dKRFnPdUa1yIBt1gYZNngP EDKr0XRxS7sgqrCVDHB68582wFsHbXX4Wn6pFu/pYkbQ8TWs1UTngIIaJeAR0O3fF20V ymYngdJf3OmKCDX716nB3RkuAFpyVouO01TArz/i3KeghDBKT4gh7yY1wohxcbRo8Nyl X0Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ysK4FSR2vVBAzp7QUTqqxSrIyUVVkr7OrZoUuy13HR4=; b=DHvUkC+LrZB96tDgcdugynD7BdCbsiyNuIPKscPCiT1Dp1bWgwwXuFFzG39wKSNUsr Bi8+GRVQM1lN/oVwydTIvbTuCPO5gYMDOsDcyHAFMGkfurlc7Y3T3nnsymFIkjXF0/tk MsTQ7u/6Wo3JeCOQUBfD+5lDSDC6MKcr1lVL2bIZG2f8FIT5R+BdL/U0kl8s+LLyaU2Q 8Kgs4laEe78XpbDkEnYdGGU1HYeN1o9EnX5NernvXM/+tnnjSmMDVHz4rWP+5nDrtHhk /TDp90daRybzwyQE47kNelohQdFTFdvJlHlnKOjRmEjm4eZgcGXN2CZYfuJ0G94L4Xjy yoRQ== X-Gm-Message-State: AOAM533kEl7LVhF6kQ+IdhA7YqKIbMs2ayTm5uW1Jf4WVwABd8HE/+TU 8iHkO1fbxHmdv+7npzoboHo= X-Google-Smtp-Source: ABdhPJypIlRZcZBZyO3PtH6rxWHVRpJaCZ5ofjqN7ngcWzIb+l4vO3dRAornC83z5Qm9tLjoAAFPnw== X-Received: by 2002:a92:cc82:0:b0:2d1:8efa:f8f4 with SMTP id x2-20020a92cc82000000b002d18efaf8f4mr1294130ilo.23.1654119016211; Wed, 01 Jun 2022 14:30:16 -0700 (PDT) Received: from nathanxps13 ([2600:1700:48f8:340f:524e:63cc:7981:ca43]) by smtp.gmail.com with ESMTPSA id f23-20020a02b797000000b0032e64ddfef6sm725304jam.125.2022.06.01.14.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:30:15 -0700 (PDT) Date: Wed, 1 Jun 2022 14:30:13 -0700 From: Nathan Bossart To: Tom Lane Cc: Zhihong Yu , PostgreSQL-development Subject: Re: silence compiler warning in brin.c Message-ID: <20220601213013.GA2400888@nathanxps13> References: <20220601163537.GA2331988@nathanxps13> <626379.1654103181@sss.pgh.pa.us> <20220601173824.GA2396891@nathanxps13> <710790.1654117683@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <710790.1654117683@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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