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

From Alvaro Herrera
Subject Re: Unused header file inclusion
Date
Msg-id 20190731203607.GA5260@alvherre.pgsql
Whole thread Raw
In response to Re: Unused header file inclusion  (Andres Freund <andres@anarazel.de>)
Responses Re: Unused header file inclusion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2019-Jul-31, Andres Freund wrote:

> IDK, I find the compilation times annoying. And it's gotten quite
> noticably worse with all the speculative execution mitigations. Although
> to some degree that's not really the fault of individual compilations,
> but our buildsystem being pretty slow.

We're in a much better position now than a decade ago, in terms of clock
time.  Back then I would resort to many tricks to avoid spurious
compiles, even manually touching some files to dates in the past to
avoid them.  Nowadays I never bother with such things.  But yes,
reducing the build time even more would be welcome for sure.

> * 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.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: block-level incremental backup
Next
From: Alvaro Herrera
Date:
Subject: Re: Replication & recovery_min_apply_delay