Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u8XyL-006vD0-5k for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Apr 2025 05:21:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u8XyI-0016qW-K2 for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Apr 2025 05:21:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u8XyI-0016qO-A8 for pgsql-hackers@lists.postgresql.org; Sat, 26 Apr 2025 05:21:03 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u8XyF-0027qY-22 for pgsql-hackers@postgresql.org; Sat, 26 Apr 2025 05:21:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53Q5Kuaf2238518; Sat, 26 Apr 2025 01:20:56 -0400 From: Tom Lane To: Bertrand Drouvot cc: PostgreSQL Hackers Subject: Re: Avoid circular header file dependency In-reply-to: References: Comments: In-reply-to Bertrand Drouvot message dated "Sat, 26 Apr 2025 03:20:09 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2238516.1745644856.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 26 Apr 2025 01:20:56 -0400 Message-ID: <2238517.1745644856@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bertrand Drouvot writes: > While working on wait events I faced some compilation issues due to circ= ular > header file dependency (introduced in fa88928470b5) between wait_event.h= and > wait_event_types.h. Ugh. I still carry the scars of cleaning up after a previous circular-inclusion mess (cf 1609797c2), so I'm always worried about introducing new cases. I don't have an opinion about whether this specific refactoring is the best way to deal with this case, but I definitely feel that we mustn't allow the situation to persist. > Out of curiosity, I ran clang-tidy with misc-header-include-cycle ([1]) = and it > also reports: > ../src/pl/plpython/plpy_util.h:9:10: warning: circular header file depen= dency detected while including 'plpython.h' > This one worries me less because plpy_util.h only contains simple extern= al = > function declarations. Whatever it contains, we need to kill it with fire before the problem metastasizes like it did the last time. (yeah, yeah, badly mixed metaphors) I can take a look at this one over the weekend if nobody beats me to it. I am very glad to hear that there's a readily available tool to catch such cases. We ought to run it every so often. regards, tom lane