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 1oa7dQ-0001J7-9g for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Sep 2022 03:39:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oa7dO-0006MG-8M for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Sep 2022 03:39:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oa7dN-0006K9-VD for pgsql-hackers@lists.postgresql.org; Mon, 19 Sep 2022 03:39:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oa7dE-0007x5-Ei for pgsql-hackers@postgresql.org; Mon, 19 Sep 2022 03:39:46 +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 28J3dcOG251837; Sun, 18 Sep 2022 23:39:38 -0400 From: Tom Lane To: Thomas Munro cc: pgsql-hackers Subject: Re: Tree-walker callbacks vs -Wdeprecated-non-prototype In-reply-to: References: <1725174.1651449765@sss.pgh.pa.us> <3953550.1663376882@sss.pgh.pa.us> <208054.1663534665@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Mon, 19 Sep 2022 10:16:24 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <251835.1663558778.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 18 Sep 2022 23:39:38 -0400 Message-ID: <251836.1663558778@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > On Mon, Sep 19, 2022 at 8:57 AM Tom Lane wrote: >> ... This is fairly annoying, in that it gives up the function >> type safety the C committee wants to impose on us; but I really think >> the data type safety that we're giving up in this version of the patch >> is a worse hazard. > But is it defined behaviour? > https://stackoverflow.com/questions/559581/casting-a-function-pointer-to= -another-type Well, what we're talking about is substituting "void *" (which is required to be compatible with "char *") for a struct pointer type. Standards legalese aside, that could only be a problem if the platform ABI handles "char *" differently from struct pointer types. The last architecture I can remember dealing with where that might actually be a thing was the PDP-10. Everybody has learned better since then, but the C committee is apparently still intent on making the world safe for crappy machine architectures. Also, if you want to argue that "void *" is not compatible with struct pointer types, then it's not real clear to me that we aren't full of other spec violations, because we sure do a lot of casting across that (and even more with this patch as it stands). I don't have the slightest hesitation about saying that if there's still an architecture out there that's like that, we won't support it. I also note that our existing code in this area would break pretty thoroughly on such a machine, so this isn't making it worse. regards, tom lane