Subject: Add missing includes

From: "Tristan Partin" <[email-masked]>
Date: Mon, 22 May 2023 10:10:31 -0500

Hi,

Some files were missing information from the c.h header.

-- 
Tristan Partin
Neon (https://neon.tech)
From 3c0c32077bb9626d4ebad1452b9fc9937c99518d Mon Sep 17 00:00:00 2001
From: Tristan Partin <[email-masked]>
Date: Mon, 22 May 2023 10:07:45 -0500
Subject: [PATCH postgres v1] Add some missing includes

Both files were missing defines/types from c.h. Issue found through
usage of clangd.
---
 src/bin/psql/settings.h       | 1 +
 src/include/fe_utils/cancel.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h
index 73d4b393bc..f429ca6ad9 100644
--- a/src/bin/psql/settings.h
+++ b/src/bin/psql/settings.h
@@ -8,6 +8,7 @@
 #ifndef SETTINGS_H
 #define SETTINGS_H
 
+#include "c.h"
 #include "fe_utils/print.h"
 #include "variables.h"
 
diff --git a/src/include/fe_utils/cancel.h b/src/include/fe_utils/cancel.h
index 6e8b9ddfc4..733aaf7751 100644
--- a/src/include/fe_utils/cancel.h
+++ b/src/include/fe_utils/cancel.h
@@ -16,6 +16,7 @@
 
 #include <signal.h>
 
+#include "c.h"
 #include "libpq-fe.h"
 
 extern PGDLLIMPORT volatile sig_atomic_t CancelRequested;
-- 
-- 
Tristan Partin
Neon (https://neon.tech)

---

From: Alvaro Herrera <[email-masked]>
Date: Mon, 22 May 2023 17:16:57 +0200

Hi,

> Some files were missing information from the c.h header.

Actually, these omissions are intentional, and we have bespoke handling
for this in our own header-checking scripts (src/tools/pginclude).  I
imagine this is documented somewhere, but ATM I can't remember where.
(And if not, maybe that's something we should do.)

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/

---

From: "Tristan Partin" <[email-masked]>
Date: Mon, 22 May 2023 10:27:37 -0500

> (And if not, maybe that's something we should do.)

Interesting. Thanks for the information. Thought I had seen in a
different email thread that header files were supposed to include all
that they needed to. Anyways, ignore the patch :).

-- 
Tristan Partin
Neon (https://neon.tech)

---

From: Tom Lane <[email-masked]>
Date: Mon, 22 May 2023 11:34:14 -0400

> that they needed to. Anyways, ignore the patch :).

There is such a policy, but not with respect to those particular
headers.  You might find src/tools/pginclude/headerscheck and
src/tools/pginclude/cpluspluscheck to be interesting reading,
as those are the tests we run to verify this policy.

			regards, tom lane

---

From: Michael Paquier <[email-masked]>
Date: Tue, 23 May 2023 07:55:32 +0900

> as those are the tests we run to verify this policy.

The standalone compile policy is documented in
src/tools/pginclude/README, AFAIK, so close enough :p
--
Michael