From 74938d132093bc0ad99a5420da2e99edaa3734f9 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 15 Jan 2025 18:57:53 +0100 Subject: IWYU widely useful pragmas Add various widely useful "IWYU pragma" annotations, such as - Common header files such as c.h, postgres.h should be "always_keep". - System headers included in c.h, postgres.h etc. should be considered "export". - Some portability headers such as getopt_long.h should be "always_keep", so they are not considered superfluous on some platforms. - Certain system headers included from portability headers should be considered "export" because the purpose of the portability header is to wrap them. - Superfluous includes marked as "for backward compatibility" get a formal IWYU annotation. - Generated header included in utils/syscache.h is marked exported. This is a very commonly used include and this avoids lots of complaints. Discussion: https://www.postgresql.org/message-id/flat/9395d484-eff4-47c2-b276-8e228526c8ae@eisentraut.org --- src/include/postgres.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/include/postgres.h') diff --git a/src/include/postgres.h b/src/include/postgres.h index cdce4823e7e..8a41a668687 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -14,6 +14,7 @@ * *------------------------------------------------------------------------- */ +/* IWYU pragma: always_keep */ /* *---------------------------------------------------------------- * TABLE OF CONTENTS @@ -42,10 +43,14 @@ #ifndef POSTGRES_H #define POSTGRES_H +/* IWYU pragma: begin_exports */ + #include "c.h" #include "utils/elog.h" #include "utils/palloc.h" +/* IWYU pragma: end_exports */ + /* ---------------------------------------------------------------- * Section 1: Datum type + support functions * ---------------------------------------------------------------- -- cgit v1.2.3