Re: Unused header file inclusion
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>, vignesh C <vignesh21@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2019-07-31T20:55:31Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > On 2019-Jul-31, Andres Freund wrote: >> * I think a lot of the interlinking stems from the bad idea to use >> typedef's everywhere. In contrast to structs they cannot be forward >> declared portably in our version of C. We should use a lot more struct >> forward declarations, and just not use the typedef. > I don't know about that ... I think the problem is that we both declare > the typedef *and* define the struct in the same place. If we were to > split those things to separate files, the required rebuilds would be > much less, I think, because changing a struct would no longer require > recompiles of files that merely pass those structs around (that's very > common for Node-derived structs). Forward-declaring structs in > unrelated header files just because they need them, feels a bit like > cheating to me. Yeah. I seem to recall a proposal that nodes.h should contain typedef struct Foo Foo; for every node type Foo, and then the other headers would just fill in the structs, and we could get rid of a lot of ad-hoc forward struct declarations and other hackery. regards, tom lane
Commits
-
Add fmgr.h include to selfuncs.h.
- 4c01a1110388 13.0 landed
-
Add "headerscheck" script to test header-file compilability under C.
- 55ea10918847 13.0 landed
-
Fix failure-to-compile-standalone in scripts_parallel.h.
- 5f110933e114 13.0 landed
-
Remove fmgr.h includes from headers that don't really need it.
- fb3b098fe884 13.0 landed
-
Don't include utils/array.h from acl.h.
- 6a04d345fd80 13.0 landed
-
Remove redundant prototypes for SQL callable functions.
- 0ae2dc4db2ae 13.0 landed
-
Remove unnecessary #include <limits.h>
- e1f4c481b995 13.0 landed
-
Teach tuplesort.c about "top N" sorting, in which only the first N tuples
- d26559dbf356 8.3.0 cited