Re: allow benign typedef redefinitions (C11) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: allow benign typedef redefinitions (C11)
Date
Msg-id 832524.1759070119@sss.pgh.pa.us
Whole thread Raw
In response to Re: allow benign typedef redefinitions (C11)  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: allow benign typedef redefinitions (C11)
List pgsql-hackers
=?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
arethe 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] GROUP BY ALL
Next
From: Tom Lane
Date:
Subject: Re: RFC: extensible planner state