Commit 187b190a authored by Tom Lane's avatar Tom Lane

There's no longer any good reason for genbki.sh and Gen_fmgrtab.sh to

run the data through cpp, and we know of at least one platform where
unusual cpp behavior breaks the process.  So remove the cpp step,
and make consequent simplifications.
parent 4351f882
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for backend/catalog # Makefile for backend/catalog
# #
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.49 2003/11/29 19:51:42 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.50 2004/01/04 05:57:21 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -42,7 +42,7 @@ postgres.description: postgres.bki ; ...@@ -42,7 +42,7 @@ postgres.description: postgres.bki ;
postgres.bki: genbki.sh $(POSTGRES_BKI_SRCS) \ postgres.bki: genbki.sh $(POSTGRES_BKI_SRCS) \
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config_manual.h $(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config_manual.h
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o postgres $(pg_includes) $(POSTGRES_BKI_SRCS) --set-version=$(VERSION) AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(VERSION) -o postgres $(POSTGRES_BKI_SRCS)
.PHONY: install-data .PHONY: install-data
install-data: $(BKIFILES) installdirs install-data: $(BKIFILES) installdirs
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.31 2003/11/29 19:51:42 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.32 2004/01/04 05:57:21 tgl Exp $
# #
# NOTES # NOTES
# non-essential whitespace is removed from the generated file. # non-essential whitespace is removed from the generated file.
...@@ -20,11 +20,9 @@ ...@@ -20,11 +20,9 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
: ${AWK='awk'} : ${AWK='awk'}
: ${CPP='cc -E'}
CMDNAME=`basename $0` CMDNAME=`basename $0`
BKIOPTS=
INCLUDE_DIRS= INCLUDE_DIRS=
OUTPUT_PREFIX= OUTPUT_PREFIX=
INFILES= INFILES=
...@@ -36,12 +34,6 @@ major_version= ...@@ -36,12 +34,6 @@ major_version=
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case $1 in case $1 in
-D)
BKIOPTS="$BKIOPTS -D$2"
shift;;
-D*)
BKIOPTS="$BKIOPTS $1"
;;
-I) -I)
INCLUDE_DIRS="$INCLUDE_DIRS $2" INCLUDE_DIRS="$INCLUDE_DIRS $2"
shift;; shift;;
...@@ -63,21 +55,20 @@ do ...@@ -63,21 +55,20 @@ do
echo "$CMDNAME generates system catalog bootstrapping files." echo "$CMDNAME generates system catalog bootstrapping files."
echo echo
echo "Usage:" echo "Usage:"
echo " $CMDNAME [ -D define [...] ] [ -I dir ] --set-version=VERSION -o prefix files..." echo " $CMDNAME [ -I dir ] --set-version=VERSION -o prefix files..."
echo echo
echo "Options:" echo "Options:"
echo " -I path to postgres_ext.h and pg_config_manual.h files" echo " -I path to postgres_ext.h and pg_config_manual.h files"
echo " -o prefix of output files" echo " -o prefix of output files"
echo " --set-version PostgreSQL version number for initdb cross-check" echo " --set-version PostgreSQL version number for initdb cross-check"
echo echo
echo "The environment variables CPP and AWK determine which C" echo "The environment variable AWK determines which Awk program"
echo "preprocessor and Awk program to use. The defaults are" echo "to use. The default is \`awk'."
echo "\`cc -E' and \`awk'."
echo echo
echo "Report bugs to <pgsql-bugs@postgresql.org>." echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0 exit 0
;; ;;
-*) -*)
echo "$CMDNAME: invalid option: $1" echo "$CMDNAME: invalid option: $1"
exit 1 exit 1
;; ;;
...@@ -108,12 +99,8 @@ if [ x"$major_version" = x"" ] ; then ...@@ -108,12 +99,8 @@ if [ x"$major_version" = x"" ] ; then
exit 1 exit 1
fi fi
if [ x"$TMPDIR" = x"" ] ; then
TMPDIR=/tmp
fi
TMPFILE="$TMPDIR/genbkitmp$$.c" TMPFILE="genbkitmp$$.c"
trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15 trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15
...@@ -214,7 +201,6 @@ sed -e "s/;[ ]*$//g" \ ...@@ -214,7 +201,6 @@ sed -e "s/;[ ]*$//g" \
# ---------------- # ----------------
BEGIN { BEGIN {
inside = 0; inside = 0;
raw = 0;
bootstrap = ""; bootstrap = "";
shared_relation = ""; shared_relation = "";
without_oids = ""; without_oids = "";
...@@ -237,14 +223,6 @@ comment_level > 0 { next; } ...@@ -237,14 +223,6 @@ comment_level > 0 { next; }
/^[ ]*$/ { next; } /^[ ]*$/ { next; }
# ----------------
# anything in a BKI_BEGIN .. BKI_END block should be passed
# along without interpretation.
# ----------------
/^BKI_BEGIN/ { raw = 1; next; }
/^BKI_END/ { raw = 0; next; }
raw == 1 { print; next; }
# ---------------- # ----------------
# DATA() statements are basically passed right through after # DATA() statements are basically passed right through after
# stripping off the DATA( and the ) on the end. However, # stripping off the DATA( and the ) on the end. However,
...@@ -410,9 +388,8 @@ END { ...@@ -410,9 +388,8 @@ END {
echo "# PostgreSQL $major_version" >${OUTPUT_PREFIX}.bki.$$ echo "# PostgreSQL $major_version" >${OUTPUT_PREFIX}.bki.$$
$CPP $BKIOPTS $TMPFILE | \
sed -e '/^[ ]*$/d' \ sed -e '/^[ ]*$/d' \
-e 's/[ ][ ]*/ /g' >>${OUTPUT_PREFIX}.bki.$$ || exit -e 's/[ ][ ]*/ /g' $TMPFILE >>${OUTPUT_PREFIX}.bki.$$ || exit
# #
# Sanity check: if one of the sed/awk/etc commands fails, we'll probably # Sanity check: if one of the sed/awk/etc commands fails, we'll probably
......
...@@ -9,20 +9,18 @@ ...@@ -9,20 +9,18 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.27 2003/11/29 19:51:57 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.28 2004/01/04 05:57:21 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
CMDNAME=`basename $0` CMDNAME=`basename $0`
: ${AWK='awk'} : ${AWK='awk'}
: ${CPP='cc -E'}
cleanup(){ cleanup(){
[ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$$-$OIDSFILE" "$$-$TABLEFILE" [ x"$noclean" != x"t" ] && rm -f "$SORTEDFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
} }
BKIOPTS=
noclean= noclean=
# #
...@@ -31,12 +29,6 @@ noclean= ...@@ -31,12 +29,6 @@ noclean=
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case $1 in case $1 in
-D)
BKIOPTS="$BKIOPTS -D$2"
shift;;
-D*)
BKIOPTS="$BKIOPTS $1"
;;
--noclean) --noclean)
noclean=t noclean=t
;; ;;
...@@ -44,17 +36,15 @@ do ...@@ -44,17 +36,15 @@ do
echo "$CMDNAME generates fmgroids.h and fmgrtab.c from pg_proc.h." echo "$CMDNAME generates fmgroids.h and fmgrtab.c from pg_proc.h."
echo echo
echo "Usage:" echo "Usage:"
echo " $CMDNAME [ -D define [...] ]" echo " $CMDNAME inputfile"
echo echo
echo "The environment variables CPP and AWK determine which C" echo "The environment variable AWK determines which Awk program"
echo "preprocessor and Awk program to use. The defaults are" echo "to use. The default is \`awk'."
echo "\`cc -E' and \`awk'."
echo echo
echo "Report bugs to <pgsql-bugs@postgresql.org>." echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0 exit 0
;; ;;
--) shift; break;; -*)
-*)
echo "$CMDNAME: invalid option: $1" echo "$CMDNAME: invalid option: $1"
exit 1 exit 1
;; ;;
...@@ -71,8 +61,7 @@ if [ x"$INFILE" = x ] ; then ...@@ -71,8 +61,7 @@ if [ x"$INFILE" = x ] ; then
exit 1 exit 1
fi fi
CPPTMPFILE="$$-fmgrtmp.c" SORTEDFILE="$$-fmgr.data"
RAWFILE="$$-fmgr.raw"
OIDSFILE=fmgroids.h OIDSFILE=fmgroids.h
TABLEFILE=fmgrtab.c TABLEFILE=fmgrtab.c
...@@ -84,34 +73,14 @@ trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15 ...@@ -84,34 +73,14 @@ trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
# Generate the file containing raw pg_proc tuple data # Generate the file containing raw pg_proc tuple data
# (but only for "internal" language procedures...). # (but only for "internal" language procedures...).
# #
# Unlike genbki.sh, which can run through cpp last, we have to
# deal with preprocessor statements first (before we sort the
# function table by oid).
#
# Note assumption here that prolang == $5 and INTERNALlanguageId == 12. # Note assumption here that prolang == $5 and INTERNALlanguageId == 12.
# #
$AWK ' egrep '^DATA' $INFILE | \
BEGIN { raw = 0; }
/^DATA/ { print; next; }
/^BKI_BEGIN/ { raw = 1; next; }
/^BKI_END/ { raw = 0; next; }
raw == 1 { print; next; }' $INFILE | \
sed -e 's/^.*OID[^=]*=[^0-9]*//' \ sed -e 's/^.*OID[^=]*=[^0-9]*//' \
-e 's/(//g' \ -e 's/(//g' \
-e 's/[ ]*).*$//' | \ -e 's/[ ]*).*$//' | \
$AWK ' $AWK '$5 == "12" { print }' | \
/^#/ { print; next; } sort -n > $SORTEDFILE
$5 == "12" { print; next; }' > $CPPTMPFILE
if [ $? -ne 0 ]; then
cleanup
echo "$CMDNAME failed"
exit 1
fi
$CPP $BKIOPTS $CPPTMPFILE | \
egrep '^[ ]*[0-9]' | \
sort -n > $RAWFILE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
...@@ -165,7 +134,7 @@ FuNkYfMgRsTuFf ...@@ -165,7 +134,7 @@ FuNkYfMgRsTuFf
# Note assumption here that prosrc == $(NF-2). # Note assumption here that prosrc == $(NF-2).
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \ tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $SORTEDFILE | \
$AWK ' $AWK '
BEGIN { OFS = ""; } BEGIN { OFS = ""; }
{ if (seenit[$(NF-2)]++ == 0) print "#define F_", $(NF-2), " ", $1; }' >> "$$-$OIDSFILE" { if (seenit[$(NF-2)]++ == 0) print "#define F_", $(NF-2), " ", $1; }' >> "$$-$OIDSFILE"
...@@ -215,7 +184,7 @@ FuNkYfMgRtAbStUfF ...@@ -215,7 +184,7 @@ FuNkYfMgRtAbStUfF
# Note assumption here that prosrc == $(NF-2). # Note assumption here that prosrc == $(NF-2).
$AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$$-$TABLEFILE" $AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $SORTEDFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
...@@ -242,7 +211,7 @@ $AWK 'BEGIN { ...@@ -242,7 +211,7 @@ $AWK 'BEGIN {
} }
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \ { printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-2), $11, Bool[$8], Bool[$9], $(NF-2) $1, $(NF-2), $11, Bool[$8], Bool[$9], $(NF-2)
}' $RAWFILE >> "$$-$TABLEFILE" }' $SORTEDFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
......
# #
# Makefile for utils # Makefile for utils
# #
# $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.21 2003/11/29 19:51:57 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.22 2004/01/04 05:57:21 tgl Exp $
# #
subdir = src/backend/utils/ subdir = src/backend/utils/
...@@ -24,7 +24,7 @@ $(SUBDIRS:%=%-recursive): fmgroids.h ...@@ -24,7 +24,7 @@ $(SUBDIRS:%=%-recursive): fmgroids.h
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
clean: clean:
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California * Portions Copyright (c) 1995, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/postgres.h,v 1.66 2003/11/29 22:40:53 pgsql Exp $ * $PostgreSQL: pgsql/src/include/postgres.h,v 1.67 2004/01/04 05:57:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -544,9 +544,6 @@ extern int ExceptionalCondition(char *conditionName, char *errorType, ...@@ -544,9 +544,6 @@ extern int ExceptionalCondition(char *conditionName, char *errorType,
#define DATA(x) extern int no_such_variable #define DATA(x) extern int no_such_variable
#define DESCR(x) extern int no_such_variable #define DESCR(x) extern int no_such_variable
#define BKI_BEGIN
#define BKI_END
typedef int4 aclitem; /* PHONY definition for catalog use only */ typedef int4 aclitem; /* PHONY definition for catalog use only */
#endif /* POSTGRES_H */ #endif /* POSTGRES_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment