From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Tighten header pre-inclusions in headerscheck and cpluspluscheck
Date: Sat, 04 Mar 2023 17:12:03 +0000
Message-ID: <E1pYVQQ-001sxx-K5@gemulon.postgresql.org> (raw)
Tighten header pre-inclusions in headerscheck and cpluspluscheck.
We allow our header files to depend on the appropriate one of
postgres.h, postgres_fe.h, or c.h having already been included.
However, there are a few headers such as libpq-fe.h that are
meant to be used by client applications and therefore must
compile without any assumptions about previous inclusions.
These test scripts failed to consider that, which seems quite
hazardous since we might not immediately notice such a problem
otherwise. Hence, adjust these scripts to test relevant libpq
and ecpg headers with no prior inclusion.
While at it, we can also make an effort to actually use the
relevant one of postgres.h, postgres_fe.h, or c.h. I added
some rules that guess which one to use based on the first-level
src subdirectory, e.g. use postgres_fe.h under src/bin/.
These rules are hardly water-tight but they seem to work today,
and we can always refine them in the future.
These changes don't reveal any live problems today, which is good,
but they should make these scripts more able to catch future bugs.
Discussion: https://postgr.es/m/2488193.1677863247@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f62975b2af6ace276a1d564a070b0aef479025af
Modified Files
--------------
src/tools/pginclude/cpluspluscheck | 32 +++++++++++++++++++++++++++++---
src/tools/pginclude/headerscheck | 28 +++++++++++++++++++++++++++-
2 files changed, 56 insertions(+), 4 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Tighten header pre-inclusions in headerscheck and cpluspluscheck
In-Reply-To: <E1pYVQQ-001sxx-K5@gemulon.postgresql.org>
References: <E1pYVQQ-001sxx-K5@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox