Re: Unused header file inclusion

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, vignesh C <vignesh21(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unused header file inclusion
Date: 2019-08-07 21:47:32
Message-ID: CA+hUKGJ4RjuST0=4afyHYfE=T6VQYqWPCcYOgkvRQEwbwOUOcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 8, 2019 at 9:00 AM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> On 2019-Aug-05, Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-08-07 21:49:48 Re: Unused header file inclusion
Previous Message Isaac Morland 2019-08-07 21:42:23 Re: Documentation clarification re: ANALYZE