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.94.2) (envelope-from ) id 1soYAR-00C4gJ-TM for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Sep 2024 00:58:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1soYAQ-00BOsJ-3X for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Sep 2024 00:58:38 +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.94.2) (envelope-from ) id 1soYAP-00BOs1-Nq for pgsql-hackers@lists.postgresql.org; Thu, 12 Sep 2024 00:58:37 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1soYAM-000iaI-P1 for pgsql-hackers@lists.postgresql.org; Thu, 12 Sep 2024 00:58:36 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53659c8d688so282752e87.1 for ; Wed, 11 Sep 2024 17:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726102712; x=1726707512; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lLCikLLKDwS1iezjzpXm3aw9Z+jyxAr56zoxIikFUDg=; b=g+yPGVbHmMb8sI2GpkVJwBDNbPoMMu2FbEfc6IMbIo8UQkPjeuucaGPX9Ku/olR2QH 3DTPA4GrJuP2fI3D+s5imNHo4kPRJpHAcXye1lgwq2VLx+sRKEoH0LRK8BgVRNAoJEZM i+M29uhOJn2g4yaezIT73MwEzBYN1YVX0vIjOXPfT6i4QmTCLP5KcOyC947megAZmAmY kMUkd3hy7u0mazWI21Ygt/9NxPqjImYx0e1gddAFBFaIn9Mv952LEIibKtJ55aSSReZB MEmaOAuMrz+/S+e0zHLD9W44RDVzgoUmQ3+RjF5ul/Wpm/CUZLRELr7kBPTY6Wv42N2L hY7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726102712; x=1726707512; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lLCikLLKDwS1iezjzpXm3aw9Z+jyxAr56zoxIikFUDg=; b=nwLwE9mmNuqB8nbGa9By0bp9A3v1dg5g19rQcwRQSl1Sn1eDMSJ50qTWdiDuvley2r XDgf1HqcwW2h3QUMpynGR0V4FhGGifgj999s+9eDZGwFJcSWPCf9Snv39IvPxSfLowF3 0qgnR9xioxhcjtJPGWBYWJU7ucYo1lagP491xTIyjmO/47uf+LkuG9Uehf6zBTNlLCJu DsGJwbayuESeAveV7X/5gEps5dGG4Qu005bIdrUJlWVSHY1hGxK6jhXA+UEL0I2Fi20A RMynx59E3OH8H93ah6/JgT+4vRFtWCzsaSG5LPAguK6awLv3Tv9XL0ktImxOLbifeX0l aCTA== X-Gm-Message-State: AOJu0YySxw0hV9721oC0ADnVDDvUGxK0xvOlriHSDAGzMnPUpqGdQZHw wUUklOatHC9qmIEVuZeSl6wKjDbSGM4fQf4Q9yvjTxNWNQZBE4r9Fkb9677SNQ4wOIQy0HBGr39 5x4SV6TdU+YbT9q6tZ9S289/7h6WxDJGL X-Google-Smtp-Source: AGHT+IFJYa3vruh93IRGKKOcVAXGydYOaEYTzUnxj81Ej2soWQVeLzsE2GR1wa4M+n2xhxpU30MFtFweNBwMIG3g8+s= X-Received: by 2002:a05:6512:3ba9:b0:533:3fc8:43fb with SMTP id 2adb3069b0e04-5367901a063mr309587e87.0.1726102711681; Wed, 11 Sep 2024 17:58:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Thu, 12 Sep 2024 12:58:19 +1200 Message-ID: Subject: Re: Remove shadowed declaration warnings To: Peter Smith Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 12 Sept 2024 at 12:33, Peter Smith wrote: > I normally build the code with warnings enabled (specifically, > -Wshadow) which exposes many "shadowed" declarations. > > It would be better to reduce warnings wherever it's easy to do so, > because if we always see/ignore lots of warnings then sooner or later > something important may escape attention. In any case, just removing > these warnings sometimes makes the code more readable by removing any > ambiguity. 0fe954c28 did add -Wshadow=compatible-local to the standard set of complication flags. I felt it was diminishing returns after that, but -Wshadow=local would be the next step before going full -Wshadow. There was justification for -Wshadow=compatible-local because there has been > 1 bug (see af7d270dd) fixed that would have been found if we'd had that sooner. Have we ever had any bugs that would have been highlighted by -Wshadow but not -Wshadow=compatible-local? I'd be curious to know if you do go through this process of weeding these out if you do find any bugs as a result. I also wonder if we could ever get this to a stable point. I didn't take the time to understand what 388e80132 did. Is that going to protect us from getting warnings where fixing them is beyond our control for full -Wshadow? David