Skip to content

Commit 418d04e

Browse files
committed
Improve method of avoiding fcinfo compile errors.
Fix pgrminclude C comment marker.
1 parent e4df037 commit 418d04e

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

src/include/libpq/hba.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#ifndef HBA_H
1212
#define HBA_H
1313

14-
#include "libpq/pqcomm.h" /* pgrminclude remove */ /* needed for NetBSD */
14+
#include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */
1515
#include "nodes/pg_list.h"
1616

1717

src/tools/pginclude/pgcompinclude

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ find . \( -name .git -a -prune \) -o -name '*.h' -type f -print | while read FIL
1313
do
1414
sed 's/->[a-zA-Z0-9_\.]*//g' "$FILE" >/tmp/$$a
1515
echo "#include \"postgres.h\"" >/tmp/$$.c
16-
echo "#include \"/tmp/$$a\"" >>/tmp/$$.c
16+
1717
# supress fcinfo errors
18-
echo "#undef PG_GETARG_DATUM" >>/tmp/$$.c
19-
echo "#define PG_GETARG_DATUM(n)" >>/tmp/$$.c
20-
echo "void include_test(void);" >>/tmp/$$.c
21-
echo "void include_test() {" >>/tmp/$$.c
18+
echo "struct {Datum arg[1];} *fcinfo;" >>/tmp/$$.c
19+
20+
echo "#include \"/tmp/$$a\"" >>/tmp/$$.c
21+
22+
echo "Datum include_test(void);" >>/tmp/$$.c
23+
echo "Datum include_test() {" >>/tmp/$$.c
24+
2225
pgdefine "$FILE" >>/tmp/$$.c
26+
27+
echo "return (Datum)0;" >>/tmp/$$.c
2328
echo "}" >>/tmp/$$.c
29+
2430
# Use -O1 to get warnings only generated by optimization,
2531
# but -O2 is too slow.
2632
cc -fsyntax-only -Werror -Wall -Wmissing-prototypes \

src/tools/pginclude/pgdefine

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ do
1818
sed 's/([a-zA-Z0-9_ ]*,/(0,/g' |
1919
sed 's/,[a-zA-Z0-9_ ]*,/,0,/g' |
2020
sed 's/,[a-zA-Z0-9_ ]*)/,0)/g' |
21+
# do not cast 'return' macros as (void)
22+
sed 's/(=void)\(.*return\)/\1/g' |
23+
sed 's/(=void)\(.*RETURN\)/\1/g' |
2124
sed 's/(=void)/(void)/g'
2225
done

src/tools/pginclude/pgrminclude

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,20 @@ compile_file() {
6868

6969
if [ "$IS_INCLUDE" = "Y" ]
7070
then echo "#include \"postgres.h\"" >/tmp/$$.c
71+
# supress fcinfo errors
72+
echo "struct {Datum arg[1];} *fcinfo;" >>/tmp/$$.c
7173
else >/tmp/$$.c
7274
fi
7375

7476
echo "#include \"/tmp/$$b\"" >>/tmp/$$.c
75-
# supress fcinfo errors
76-
echo "#undef PG_GETARG_DATUM" >>/tmp/$$.c
77-
echo "#define PG_GETARG_DATUM(n)" >>/tmp/$$.c
78-
echo "void include_test(void);" >>/tmp/$$.c
79-
echo "void include_test() {" >>/tmp/$$.c
77+
8078
if [ "$IS_INCLUDE" = "Y" ]
81-
then pgdefine "$FILE" >>/tmp/$$.c
79+
then echo "Datum include_test(void);" >>/tmp/$$.c
80+
echo "Datum include_test() {" >>/tmp/$$.c
81+
pgdefine "$FILE" >>/tmp/$$.c
82+
echo "return (Datum)0;" >>/tmp/$$.c
83+
echo "}" >>/tmp/$$.c
8284
fi
83-
echo "}" >>/tmp/$$.c
8485

8586
# Use -O1 to get warnings only generated by optimization,
8687
# but -O2 is too slow.

0 commit comments

Comments
 (0)