Re: Unused header file inclusion - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Unused header file inclusion
Date
Msg-id CA+hUKGJ4RjuST0=4afyHYfE=T6VQYqWPCcYOgkvRQEwbwOUOcQ@mail.gmail.com
Whole thread Raw
In response to Re: Unused header file inclusion  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Unused header file inclusion
List 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



pgsql-hackers by date:

Previous
From: Isaac Morland
Date:
Subject: Re: Documentation clarification re: ANALYZE
Next
From: Thomas Munro
Date:
Subject: Re: Unused header file inclusion