pgsql: Remove circular #include's between plpython.h and plpy_util.h. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove circular #include's between plpython.h and plpy_util.h.
Date
Msg-id E1u949t-0023IV-3C@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: clang-tidy complaints
Next
From: Peter Geoghegan
Date:
Subject: Re: clang-tidy complaints