Improve method of avoiding fcinfo compile errors.
authorBruce Momjian <bruce@momjian.us>
Thu, 1 Sep 2011 18:15:36 +0000 (14:15 -0400)
committerBruce Momjian <bruce@momjian.us>
Thu, 1 Sep 2011 18:16:13 +0000 (14:16 -0400)
Fix pgrminclude C comment marker.

src/include/libpq/hba.h
src/tools/pginclude/pgcompinclude
src/tools/pginclude/pgdefine
src/tools/pginclude/pgrminclude

index 489e62ce8d7ce3f4b56dc853e4472cd9dec76812..c5a77c2a5af66371f8578e19df992e3ea4dc5201 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef HBA_H
 #define HBA_H
 
-#include "libpq/pqcomm.h"      /* pgrminclude remove */ /* needed for NetBSD */
+#include "libpq/pqcomm.h"      /* pgrminclude ignore */ /* needed for NetBSD */
 #include "nodes/pg_list.h"
 
 
index 89768335e64eb9512dae5f8f5035eaf06a00d5fc..afc079a31032ce65beb86c3ab46dcdc50a8aa9dc 100755 (executable)
@@ -13,14 +13,20 @@ find . \( -name .git -a -prune \) -o -name '*.h' -type f -print | while read FIL
 do
        sed 's/->[a-zA-Z0-9_\.]*//g' "$FILE" >/tmp/$$a
        echo "#include \"postgres.h\"" >/tmp/$$.c
-       echo "#include \"/tmp/$$a\"" >>/tmp/$$.c
+
        # supress fcinfo errors
-       echo "#undef PG_GETARG_DATUM" >>/tmp/$$.c
-       echo "#define PG_GETARG_DATUM(n)" >>/tmp/$$.c
-       echo "void include_test(void);" >>/tmp/$$.c
-       echo "void include_test() {" >>/tmp/$$.c
+       echo "struct {Datum       arg[1];} *fcinfo;" >>/tmp/$$.c
+
+       echo "#include \"/tmp/$$a\"" >>/tmp/$$.c
+
+       echo "Datum include_test(void);" >>/tmp/$$.c
+       echo "Datum include_test() {" >>/tmp/$$.c
+
        pgdefine "$FILE" >>/tmp/$$.c
+
+       echo "return (Datum)0;" >>/tmp/$$.c
        echo "}" >>/tmp/$$.c
+
        # Use -O1 to get warnings only generated by optimization,
        # but -O2 is too slow.
        cc -fsyntax-only -Werror -Wall -Wmissing-prototypes \
index 0284307381c48b4a9a74f26ceda77c1648c8a1c6..242d035a778f14f7f7449ee713c44dc2e9a916c3 100755 (executable)
@@ -18,5 +18,8 @@ do
        sed 's/([a-zA-Z0-9_ ]*,/(0,/g' |
        sed 's/,[a-zA-Z0-9_ ]*,/,0,/g' |
        sed 's/,[a-zA-Z0-9_ ]*)/,0)/g' |
+       # do not cast 'return' macros as (void)
+       sed 's/(=void)\(.*return\)/\1/g' |
+       sed 's/(=void)\(.*RETURN\)/\1/g' |
        sed 's/(=void)/(void)/g'
 done
index f162140379a1bbdb3b462eadc91c672109d9b974..2ac9c78880f4e68d3e81c048cebcec0415544492 100755 (executable)
@@ -68,19 +68,20 @@ compile_file() {
 
        if [ "$IS_INCLUDE" = "Y" ]
        then    echo "#include \"postgres.h\"" >/tmp/$$.c
+               # supress fcinfo errors
+               echo "struct {Datum       arg[1];} *fcinfo;" >>/tmp/$$.c
        else    >/tmp/$$.c
        fi
 
        echo "#include \"/tmp/$$b\"" >>/tmp/$$.c
-       # supress fcinfo errors
-       echo "#undef PG_GETARG_DATUM" >>/tmp/$$.c
-       echo "#define PG_GETARG_DATUM(n)" >>/tmp/$$.c
-       echo "void include_test(void);" >>/tmp/$$.c
-       echo "void include_test() {" >>/tmp/$$.c
+
        if [ "$IS_INCLUDE" = "Y" ]
-       then    pgdefine "$FILE" >>/tmp/$$.c
+       then    echo "Datum include_test(void);" >>/tmp/$$.c
+               echo "Datum include_test() {" >>/tmp/$$.c
+               pgdefine "$FILE" >>/tmp/$$.c
+               echo "return (Datum)0;" >>/tmp/$$.c
+               echo "}" >>/tmp/$$.c
        fi
-       echo "}" >>/tmp/$$.c
 
        # Use -O1 to get warnings only generated by optimization,
        # but -O2 is too slow.