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 1oRwaw-0007Ex-Ei for pgsql-committers@arkaria.postgresql.org; Sat, 27 Aug 2022 14:15:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oRwau-0003kD-LJ for pgsql-committers@arkaria.postgresql.org; Sat, 27 Aug 2022 14:15:28 +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 1oRwau-0003k4-Ec for pgsql-committers@lists.postgresql.org; Sat, 27 Aug 2022 14:15:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRwan-0006MJ-Te for pgsql-committers@lists.postgresql.org; Sat, 27 Aug 2022 14:15:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 27REFH5h2295182; Sat, 27 Aug 2022 10:15:17 -0400 From: Tom Lane To: Justin Pryzby cc: Peter Eisentraut , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Remove unnecessary casts in free() and pfree() In-reply-to: <20220827112304.GL2342@telsasoft.com> References: <20220827112304.GL2342@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sat, 27 Aug 2022 06:23:04 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2295180.1661609717.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 27 Aug 2022 10:15:17 -0400 Message-ID: <2295181.1661609717@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Justin Pryzby writes: > On Fri, Aug 26, 2022 at 02:02:33PM +0000, Peter Eisentraut wrote: >> Remove unnecessary casts in free() and pfree() > This seems to be breaking cfbot's "warnings" test. > [07:49:48.983] label.c:665:10: error: passing argument 1 of =E2=80=98pfr= ee=E2=80=99 discards =E2=80=98const=E2=80=99 qualifier from pointer target= type [-Werror=3Ddiscarded-qualifiers] > [07:49:48.983] 665 | pfree(temp); Hmm, well, casting away const is certainly not within pfree's remit, so I'm glad we changed this. A quick-n-dirty fix is to cast away const at this call site, but I wonder whether this isn't a symptom of poor const choices. I'll take a look later today if no one beats me to it. regards, tom lane