Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFRBE-005726-0E for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 06:35:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFRBD-00BxBg-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 06:35:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFRBC-00BxBY-19 for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 06:35:22 +0000 Received: from m16.mail.163.com ([117.135.210.4]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wFRB4-00000002Cvk-3ce4 for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 06:35:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:To:From: Content-Type; bh=DIDJmp8G0xyQAzbrP0INHz9XfsPEI82+Nn5k4Acfwso=; b=iI8fPz84dgwRBPKjfXrxj7zKYLKr1ABRqGIq+cVzUlysZfvjywjmtYC93QTVea dNla54hfWcmY6ahAtKjMSytXos3A7XNVN3U3lUrQdJmVWnU1hNUiKrN9ZXU2b8+d wLhAG3NnivZ/+lSgtQboOlT0QbiFPfHFIElPtzj+eMtEU= Received: from [192.168.11.136] (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgDnsC0JbOhp6qHpAw--.100S2; Wed, 22 Apr 2026 14:34:52 +0800 (CST) Message-ID: <9edb73f8-72ef-4d62-ae6c-e4c5af439629@163.com> Date: Wed, 22 Apr 2026 14:34:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Cleanup shadows variable warnings, round 1 To: Chao Li , =?UTF-8?Q?=C3=81lvaro_Herrera?= , David Rowley Cc: Postgres hackers , Peter Eisentraut , Peter Smith References: <8B830174-7794-411F-B936-37DDB509EC5D@gmail.com> From: Yuchen Li In-Reply-To: <8B830174-7794-411F-B936-37DDB509EC5D@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: PygvCgDnsC0JbOhp6qHpAw--.100S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxXw4xtrWUtw15GFWDtr4DCFg_yoW5GF4xp3 yrX3ZFkw1xXF1FqanFkr4aqryUZw4kJa98Gwn7J3yUG345C3W8WF48tr48uFy7GrZYgF42 9F45KFWrWF1YvaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jRiihUUUUU= X-Originating-IP: [123.233.246.114] X-CM-SenderInfo: 5ol13upkhqs5l126il2tof0z/xtbC9g2y+mnobA1lagAA3c List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/22/2026 1:14 PM, Chao Li wrote: > >> On Apr 21, 2026, at 21:51, Álvaro Herrera wrote: >> >> On 2026-Apr-21, David Rowley wrote: >> >>> On Tue, 21 Apr 2026 at 19:02, Chao Li wrote: >>>> PFA v8 - rebased and fixed a few new occurrences. >>> Which of these are new to v19? Can you separate those ones out? IMO, >>> we should commit at least those, as those won't cause any backpatching >>> pain. >> I agree. The others are v20 material. >> > Sounds reasonable. > > The attached new v1 patch fixes the v19-only shadow warnings. There are not many. I strictly limited it to warnings newly introduced in v19, without touching any pre-existing ones, even where an old occurrence is very close to a new one. > > I intentionally left out one occurrence in ruleutils.c: > ``` > ruleutils.c:13100:23: warning: declaration shadows a local variable [-Wshadow] > 13100 | deparse_context context = {0}; > | ^ > ruleutils.c:12955:67: note: previous declaration is here > 12955 | get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) > | ^ > 1 warning generated. > ``` > > I saw there is a thread [1] that will remove this deparse_context context = {0};, so I skipped this one to avoid a potential conflict. > > Besides the patch file, I am also attaching three files for reference: > > * v18-shadow-warnings.txt - all shadow warnings from branch REL_18_STABLE > * v19-shadow-warnings-master.txt - all shadow warnings from current master (9d3e094f12c) > * v19-shadow-warnings-patched.txt - all shadow warnings after applying this v1 patch > > Except for the one in ruleutils.c, v19-shadow-warnings-patched.txt is a pure subset of v18-shadow-warnings.txt. You don't need to read these large files; they are attached only for reference. > > I will recreate the previous patch set for v20. > >> Specifically about 0003 (v20 material for sure, as this is ancient >> code), I don't like this patch very much. I wonder if it would be >> possible to do away with the idea of using these codeFragment things >> without introducing a performance issue here. Is that doable by turning >> these macros into static functions? >> > Okay, I will remove 0003 from this patch set, and use a separate patch to try converting the macros to static functions. > > [1] http://postgr.es/m/CAHg+QDcLVa2iBnggkHxY4itZbXtDMfsYHEjnCUYe9hNbnxDi-w@mail.gmail.com > > Best regards, > -- > Chao Li (Evan) > HighGo Software Co., Ltd. > https://www.highgo.com/ > > > > The v1 patch LGTM, and “make check-world” passed after applying it. Regards, Yuchen Li