Here is the first of several (to come at a later date) patch sets to
take some advantage of C11 features.
This is, I hope, a very gentle start that shouldn't stress even older
compilers very much, and should bring some tangible benefits that had
already been asked for around here.
In C11, typedef redefinitions are allowed, as long as they are the same. So
typedef int foo;
typedef int foo;
is allowed, where the second occurrence would have led to a diagnostic
in previous C versions.
(C++ also allows this, so this will preserve C++ compatibility of the
headers.)
What is not allowed is something like this of course:
typedef int foo;
typedef double foo;
This will continue to be an error.
This facility is often useful to untangle dependencies between header
files. So instead of having one header include another, now the first
header can just make its own typedef of whatever types it needs. If the
two headers are later included together, then this will not (any more)
be a conflict. This often works together with declaring incomplete
types using struct.
The PostgreSQL code already contains a couple of places that wanted to
do something like this but had to install manual workarounds with #ifdef
guards. These can now be removed. There are also a bunch of struct
forward declarations that can be "upgraded" to full typedefs. This
makes the function prototypes look more consistent.
In this patch set, 0001 is a prerequisite for 0002, 0002 and 0003 remove
some existing workarounds, the remaining patches are additional
opportunities for cleanup and simplification.
All of this is only notational, there are no include changes or API
changes or changes in behavior.
(After this, it would probably be possible to undertake some deeper
efforts to untangle header files, with the help of IWYU. But that is a
separate project.)