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
 

Reply via email to