Re: Unused header file inclusion
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, vignesh C <vignesh21@gmail.com>, Andres Freund <andres@anarazel.de>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2019-08-07T21:47:32Z
Lists: pgsql-hackers
On Thu, Aug 8, 2019 at 9:00 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote: > On 2019-Aug-05, Tom Lane wrote: > > Alvaro Herrera <alvherre@2ndquadrant.com> writes: > > > Then there's the <limits.h> removal, which is in tuplesort.c because of > > > INT_MAX as added by commit d26559dbf356 and still present ... > > > > One has to be especially wary of removing system-header inclusions; > > the fact that they don't seem to be needed on your own machine doesn't > > prove they aren't needed elsewhere. > > As far as I can see, this line was just carried over from tuplestore.c, > but that file uses INT_MAX and this one doesn't use any of those macros > as far as I can tell. Yeah, probably, or maybe I used one of those sorts of macros in an earlier version of the patch. By the way, I see now that I had put the offending #include <limits.h> *after* project headers, which is a convention I picked up from other projects, mentors and authors, but not what PostgreSQL usually does. In my own code I do that to maximise the chances that project headers will fail to compile if they themselves forget to include the system headers they depend on. Of course an attempt to compile every header in the project individually as a transaction unit also achieves that. /me runs away -- Thomas Munro https://enterprisedb.com
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