Improve method of avoiding fcinfo compile errors.

Fix pgrminclude C comment marker.
This commit is contained in:
Bruce Momjian 2011-09-01 14:15:36 -04:00
parent e4df037330
commit 418d04ea73
4 changed files with 23 additions and 13 deletions

View 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"

View File

@ -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 \

View File

@ -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

View File

@ -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.