pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: allow benign typedef redefinitions (C11)
Date: Sun, 28 Sep 2025 10:35:19 -0400
Message-ID: <832524.1759070119@sss.pgh.pa.us> (raw)
In-Reply-To: <a08ed217-1bf3-4c1d-97ca-7f5ca93e53cf@app.fastmail.com>
References: <10d32190-f31b-40a5-b177-11db55597355@eisentraut.org>
	<a08ed217-1bf3-4c1d-97ca-7f5ca93e53cf@app.fastmail.com>

=?UTF-8?Q?=C3=81lvaro_Herrera?= <alvherre@kurilemu.de> writes:
> The changes to inet.h and varbit.h are surprising, but required.

Why?  Those headers compile now, and you've not removed any includes
that they might indirectly depend on.

> (It's possible that we should be including varatt.h in more datatype headers than just those two, but at least these are the ones that complained.  So another option would be to include varatt.h in the files that include those headers. However, that seems to me to be the wrong direction).

If what you mean is that some of the macros in these headers require
varatt.h to be used, I do not agree that that means we should put
varatt.h into these headers.  We've frequently relied on exactly
that property of macro definitions to avoid excessive or circular
inclusions.  Moreover, even if we wanted to change that policy,
I know of no simple way to check it.

Furthermore, this whole business of using "typedef struct foo foo;"
to avoid including foo.h is predicated on the assumption that the
ultimate consumer (some .c file) will itself include foo.h, because
otherwise it's most likely gonna have problems with the incomplete
typedef.  So changing the rules about macros seems to me to be going
in quite the wrong direction.

I think what we're trying to do here is reduce the #includes of
header files to be just enough to compile the headers themselves.
That will bleed out into more #include's required in .c files,
but that's fine by me.

			regards, tom lane





view thread (23+ messages)  latest in thread

Message-ID: <832524.1759070119@sss.pgh.pa.us>
Permalink:  ../832524.1759070119@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/832524.1759070119@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@kurilemu.de, peter@eisentraut.org
  Subject: Re: allow benign typedef redefinitions (C11)
  In-Reply-To: <832524.1759070119@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox