libpq-fe.h should compile *entirely* standalone

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
libpq-fe.h should compile *entirely* standalone
Дата
Msg-id
2488193.1677863247@sss.pgh.pa.us
Список
Дерево обсуждения
libpq-fe.h should compile *entirely* standalone Tom Lane <tgl@sss.pgh.pa.us>
Re: libpq-fe.h should compile *entirely* standalone Tom Lane <tgl@sss.pgh.pa.us>
Re: libpq-fe.h should compile *entirely* standalone Andrew Dunstan <andrew@dunslane.net>
Re: libpq-fe.h should compile *entirely* standalone Tom Lane <tgl@sss.pgh.pa.us>
I realized that headerscheck is failing to enforce $SUBJECT.
This is bad, since we aren't really using libpq-fe.h ourselves
in a way that would ensure that c.h symbols don't creep into it.

We can easily do better, as attached, but I wonder which other
headers should get the same treatment.

			regards, tom lane

diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index abbba7aa63..69897092b2 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -142,7 +142,14 @@ do
 
 	# OK, create .c file to include this .h file.
 	{
-	    test "$f" != src/include/postgres_fe.h && echo '#include "postgres.h"'
+	    # Ideally we'd pre-include only the appropriate one of
+	    # postgres.h, postgres_fe.h, or c.h, but we don't have enough
+	    # info here to guess what to do in most cases.
+	    if test "$f" != src/include/postgres_fe.h -a \
+		    "$f" != src/interfaces/libpq/libpq-fe.h
+	    then
+		echo '#include "postgres.h"'
+	    fi
 	    echo "#include \"$f\""
 	} >$tmp/test.c
 
В списке pgsql-hackers по дате отправления
От: Jeroen Vermeulen
Дата:
От: Tom Lane
Дата:
FAQ