pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove circular #include's between plpython.h and plpy_util.h.
2+ messages / 2 participants
[nested] [flat]

* pgsql: Remove circular #include's between plpython.h and plpy_util.h.
@ 2025-04-27 15:43  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-04-27 15:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Remove circular #include's between plpython.h and plpy_util.h.

plpython.h included plpy_util.h, simply on the grounds that "it's
easier to just include it everywhere".  However, plpy_util.h must
include plpython.h, or it won't pass headerscheck.  While the
resulting circularity doesn't have any immediate bad effect,
it's poor design.  We have seen serious messes arise in the past
from overly-broad inclusion footprints created by such circularities,
so let's establish a project policy against it.

To fix, just replace *.c files' inclusions of plpython.h with
plpy_util.h.  They'll pull in plpython.h indirectly; indeed, almost
all have already done so via inclusions of other plpy_xxx.h headers.
(Any extensions using plpython.h can do likewise without breaking
the compatibility of their code with prior Postgres versions.)

Reported-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aAxQ6fcY5QQV1lo3@ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2311f193ea7db23f68f5471ae2c35940fc0d4794

Modified Files
--------------
contrib/hstore_plpython/hstore_plpython.c | 2 +-
contrib/jsonb_plpython/jsonb_plpython.c   | 2 +-
contrib/ltree_plpython/ltree_plpython.c   | 2 +-
src/pl/plpython/plpy_cursorobject.c       | 2 +-
src/pl/plpython/plpy_elog.c               | 2 +-
src/pl/plpython/plpy_exec.c               | 2 +-
src/pl/plpython/plpy_main.c               | 2 +-
src/pl/plpython/plpy_planobject.c         | 2 +-
src/pl/plpython/plpy_plpymodule.c         | 2 +-
src/pl/plpython/plpy_procedure.c          | 2 +-
src/pl/plpython/plpy_resultobject.c       | 2 +-
src/pl/plpython/plpy_spi.c                | 2 +-
src/pl/plpython/plpy_subxactobject.c      | 2 +-
src/pl/plpython/plpy_typeio.c             | 2 +-
src/pl/plpython/plpy_util.c               | 1 -
src/pl/plpython/plpython.h                | 9 ++++-----
16 files changed, 18 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Remove circular #include's between wait_event.h and wait_event_t
@ 2025-04-28 00:10  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-04-28 00:10 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Remove circular #include's between wait_event.h and wait_event_types.h

wait_event_types.h is generated by the code, and included wait_event.h.
wait_event.h did the opposite move, including wait_event_types.h,
causing a circular dependency between both.

wait_event_types.h only needs to now about the wait event classes, so
this information is moved into its own file, and wait_event_types.h uses
this new header so as it does not depend anymore on wait_event.h.

Note that such errors can be found with clang-tidy, with commands like
this one:
clang-tidy source_file.c --checks=misc-header-include-cycle -- \
  -I/install/path/include/ -I/install/path/include/server/

Issue introduced by fa88928470b5.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/350192.1745768770@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b225c5e76ed1053e505e392423b0dab065a3b813

Modified Files
--------------
.../utils/activity/generate-wait_event_types.pl    |  2 +-
src/include/utils/wait_classes.h                   | 29 ++++++++++++++++++++++
src/include/utils/wait_event.h                     | 16 ------------
3 files changed, 30 insertions(+), 17 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-04-28 00:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-27 15:43 pgsql: Remove circular #include's between plpython.h and plpy_util.h. Tom Lane <tgl@sss.pgh.pa.us>
2025-04-28 00:10 pgsql: Remove circular #include's between wait_event.h and wait_event_t Michael Paquier <michael@paquier.xyz>

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