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 1oOoph-0007rK-00 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 23:21:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOopf-0006X3-Jn for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 23:21:47 +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 1oOopf-0006Ws-Ag for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 23:21:47 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oOopc-0006h5-Jh for pgsql-hackers@postgresql.org; Thu, 18 Aug 2022 23:21:46 +0000 Received: by mail-io1-xd2f.google.com with SMTP id b142so2204001iof.10 for ; Thu, 18 Aug 2022 16:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc; bh=YXn/OodGfWC41fSq8lskf1A62rgzg0T8kWP56to+9EE=; b=oF8FYeFpAS2q/iwm3XK6FRTikR8G4plBUwJfcxlIl5AQuMojBGMMGtlTz0QXCdKcbj Z7wmLwwzFZYH4BEMXj0wdYsWj96ER7/e3wHFSVs1kIfy/Hvz01dfAaZtJBU+FfXHx7w5 1LbW5KImXlrP5ggaIaxSkxEKzR4FMvg2whDp8BW7bj3l04Q1StLaw6GHG61WitIPUNEr E221yK6lQA10e+O0DMJ/B9GMsj7t6dCxgVuauHCmIHWALWtNHdsmBvmGz/ibBJ1O588k UdEorBjITO84IWH3Xw+n7R3mpCc8QL4bXAUuJM/RfyyOjyOmcoLY7Vay7o1UmUSg0wlH 3OCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=YXn/OodGfWC41fSq8lskf1A62rgzg0T8kWP56to+9EE=; b=gEdMzivSYw6lHWeDCJUF1TjS4czSfnYpDNHN3ymnq4oYaT3CS2twgAYwAphS3e9Wsa TwIs6R2Il/vUvlgg4OmZ3tGrxuByZQ2SLp9jxORBQnSmSUrLptpyj4uIMespC1IrduhR ytDXdJ+Sor2Keb7e+Zj6YJkIXOlqQvODSjfwx+csrJeO5UlzM+J/hH6lljXX8FNOjxW0 rKlD3H5o8GwfkXkXJyFHvKHNgherXZDeuoPOLqXEGq8szmod6YT/RJwxUFOdnxk+iG/q ID9aEPpisKvdZsWLjym5mUZX85re7QdwtO6uQfB3Npkzai5H796QmxBd6oD92lpEdxci GJHw== X-Gm-Message-State: ACgBeo3O4wIui/VLUS1VtpquqCx4iH7za6x5mAyTlU14v8JkumnG2QcM pmZxnM6+fDM4okzkppmMu1sKLw== X-Google-Smtp-Source: AA6agR7wU+0MxgzjbWUGHX47rU0SuQNw6i5CfsNWVYC2G5qnXmooRG8ONvkvHkCVU4FPHk8MKGxQlA== X-Received: by 2002:a6b:1543:0:b0:688:6fcb:fa76 with SMTP id 64-20020a6b1543000000b006886fcbfa76mr2304346iov.60.1660864902473; Thu, 18 Aug 2022 16:21:42 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id r8-20020a92ce88000000b002dde208f0c6sm1128961ilo.67.2022.08.18.16.21.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2022 16:21:42 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 548E5800B00; Thu, 18 Aug 2022 18:21:41 -0500 (CDT) Date: Thu, 18 Aug 2022 18:21:41 -0500 From: Justin Pryzby To: David Rowley Cc: pgsql-hackers@postgresql.org, Tomas Vondra , Peter Smith Subject: Re: shadow variables - pg15 edition Message-ID: <20220818232141.GQ26426@telsasoft.com> References: <20220817145434.GC26426@telsasoft.com> <20220818051637.GK26426@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Aug 18, 2022 at 07:27:09PM +1200, David Rowley wrote: > 0001. I'd also rather see these 4 renamed: .. > 0002. I don't really like the "my" name. I also see you've added the .. > How about just "tinfo"? .. > 0005. How about just "tslot". I'm not a fan of "this". .. > Since I'm not a fan of "this", how about the outer one gets renamed .. > 0007. Meh, more "this". How about just "col". .. > 0008. Sorry, I had to change this one too. I agree that ii_oid and newtype are better names (although it's a bit unfortunate to rename the outer "ttype" var of wider scope). > 0003. The following is used for the exact same purpose as its shadowed > counterpart. I suggest just using the variable from the outer scope. And that's what my original patch did, before people insisted that the patches shouldn't change variable scope. Now it's back to where I stared. > There's a discussion about reverting this entire patch. Not sure if > patching master and not backpatching to pg15 would be useful to the > people who may be doing that revert. I think if it were reverted, it'd be in both branches. > I've attached a patch which does things more along the lines of how I > would have done it. I don't think we should be back patching this > stuff. > > Any objections to pushing this to master only? I won't object, but some of your changes are what makes backpatching this less reasonable (foreach_current_index and newtype). I had made these v15 patches first to simplify backpatching, since having the same code in v15 means that there's no backpatch hazard for this new-in-v15 code. I am opened to presenting the patches differently, but we need to come up with a better process than one person writing patches and someone else rewriting it. I also don't see the value of debating which order to write the patches in. Grouping by variable name or doing other statistical analysis doesn't change the fact that there are 50+ issues to address to allow -Wshadow to be usable. Maybe these would be helpful ? - if I publish the patches on github; - if I send the patches with more context; - if you have an suggestion/objection/complaint with a patch, I can address it and/or re-arrange the patchset so this is later, and all the polished patches are presented first. -- Justin