Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 187b190

Browse files
committed
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.
1 parent 4351f88 commit 187b190

File tree

5 files changed

+25
-82
lines changed

5 files changed

+25
-82
lines changed

src/backend/catalog/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for backend/catalog
44
#
5-
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.49 2003/11/29 19:51:42 pgsql Exp $
5+
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.50 2004/01/04 05:57:21 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -42,7 +42,7 @@ postgres.description: postgres.bki ;
4242

4343
postgres.bki: genbki.sh $(POSTGRES_BKI_SRCS) \
4444
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config_manual.h
45-
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o postgres $(pg_includes) $(POSTGRES_BKI_SRCS) --set-version=$(VERSION)
45+
AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(VERSION) -o postgres $(POSTGRES_BKI_SRCS)
4646

4747
.PHONY: install-data
4848
install-data: $(BKIFILES) installdirs

src/backend/catalog/genbki.sh

+7-30
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
#
1212
# IDENTIFICATION
13-
# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.31 2003/11/29 19:51:42 pgsql Exp $
13+
# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.32 2004/01/04 05:57:21 tgl Exp $
1414
#
1515
# NOTES
1616
# non-essential whitespace is removed from the generated file.
@@ -20,11 +20,9 @@
2020
#-------------------------------------------------------------------------
2121

2222
: ${AWK='awk'}
23-
: ${CPP='cc -E'}
2423

2524
CMDNAME=`basename $0`
2625

27-
BKIOPTS=
2826
INCLUDE_DIRS=
2927
OUTPUT_PREFIX=
3028
INFILES=
@@ -36,12 +34,6 @@ major_version=
3634
while [ $# -gt 0 ]
3735
do
3836
case $1 in
39-
-D)
40-
BKIOPTS="$BKIOPTS -D$2"
41-
shift;;
42-
-D*)
43-
BKIOPTS="$BKIOPTS $1"
44-
;;
4537
-I)
4638
INCLUDE_DIRS="$INCLUDE_DIRS $2"
4739
shift;;
@@ -63,21 +55,20 @@ do
6355
echo "$CMDNAME generates system catalog bootstrapping files."
6456
echo
6557
echo "Usage:"
66-
echo " $CMDNAME [ -D define [...] ] [ -I dir ] --set-version=VERSION -o prefix files..."
58+
echo " $CMDNAME [ -I dir ] --set-version=VERSION -o prefix files..."
6759
echo
6860
echo "Options:"
6961
echo " -I path to postgres_ext.h and pg_config_manual.h files"
7062
echo " -o prefix of output files"
7163
echo " --set-version PostgreSQL version number for initdb cross-check"
7264
echo
73-
echo "The environment variables CPP and AWK determine which C"
74-
echo "preprocessor and Awk program to use. The defaults are"
75-
echo "\`cc -E' and \`awk'."
65+
echo "The environment variable AWK determines which Awk program"
66+
echo "to use. The default is \`awk'."
7667
echo
7768
echo "Report bugs to <pgsql-bugs@postgresql.org>."
7869
exit 0
7970
;;
80-
-*)
71+
-*)
8172
echo "$CMDNAME: invalid option: $1"
8273
exit 1
8374
;;
@@ -108,12 +99,8 @@ if [ x"$major_version" = x"" ] ; then
10899
exit 1
109100
fi
110101

111-
if [ x"$TMPDIR" = x"" ] ; then
112-
TMPDIR=/tmp
113-
fi
114-
115102

116-
TMPFILE="$TMPDIR/genbkitmp$$.c"
103+
TMPFILE="genbkitmp$$.c"
117104

118105
trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15
119106

@@ -214,7 +201,6 @@ sed -e "s/;[ ]*$//g" \
214201
# ----------------
215202
BEGIN {
216203
inside = 0;
217-
raw = 0;
218204
bootstrap = "";
219205
shared_relation = "";
220206
without_oids = "";
@@ -237,14 +223,6 @@ comment_level > 0 { next; }
237223
238224
/^[ ]*$/ { next; }
239225
240-
# ----------------
241-
# anything in a BKI_BEGIN .. BKI_END block should be passed
242-
# along without interpretation.
243-
# ----------------
244-
/^BKI_BEGIN/ { raw = 1; next; }
245-
/^BKI_END/ { raw = 0; next; }
246-
raw == 1 { print; next; }
247-
248226
# ----------------
249227
# DATA() statements are basically passed right through after
250228
# stripping off the DATA( and the ) on the end. However,
@@ -410,9 +388,8 @@ END {
410388

411389
echo "# PostgreSQL $major_version" >${OUTPUT_PREFIX}.bki.$$
412390

413-
$CPP $BKIOPTS $TMPFILE | \
414391
sed -e '/^[ ]*$/d' \
415-
-e 's/[ ][ ]*/ /g' >>${OUTPUT_PREFIX}.bki.$$ || exit
392+
-e 's/[ ][ ]*/ /g' $TMPFILE >>${OUTPUT_PREFIX}.bki.$$ || exit
416393

417394
#
418395
# Sanity check: if one of the sed/awk/etc commands fails, we'll probably

src/backend/utils/Gen_fmgrtab.sh

+13-44
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@
99
#
1010
#
1111
# IDENTIFICATION
12-
# $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.27 2003/11/29 19:51:57 pgsql Exp $
12+
# $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.28 2004/01/04 05:57:21 tgl Exp $
1313
#
1414
#-------------------------------------------------------------------------
1515

1616
CMDNAME=`basename $0`
1717

1818
: ${AWK='awk'}
19-
: ${CPP='cc -E'}
2019

2120
cleanup(){
22-
[ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
21+
[ x"$noclean" != x"t" ] && rm -f "$SORTEDFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
2322
}
2423

25-
BKIOPTS=
2624
noclean=
2725

2826
#
@@ -31,30 +29,22 @@ noclean=
3129
while [ $# -gt 0 ]
3230
do
3331
case $1 in
34-
-D)
35-
BKIOPTS="$BKIOPTS -D$2"
36-
shift;;
37-
-D*)
38-
BKIOPTS="$BKIOPTS $1"
39-
;;
4032
--noclean)
4133
noclean=t
4234
;;
4335
--help)
4436
echo "$CMDNAME generates fmgroids.h and fmgrtab.c from pg_proc.h."
4537
echo
4638
echo "Usage:"
47-
echo " $CMDNAME [ -D define [...] ]"
39+
echo " $CMDNAME inputfile"
4840
echo
49-
echo "The environment variables CPP and AWK determine which C"
50-
echo "preprocessor and Awk program to use. The defaults are"
51-
echo "\`cc -E' and \`awk'."
41+
echo "The environment variable AWK determines which Awk program"
42+
echo "to use. The default is \`awk'."
5243
echo
5344
echo "Report bugs to <pgsql-bugs@postgresql.org>."
5445
exit 0
5546
;;
56-
--) shift; break;;
57-
-*)
47+
-*)
5848
echo "$CMDNAME: invalid option: $1"
5949
exit 1
6050
;;
@@ -71,8 +61,7 @@ if [ x"$INFILE" = x ] ; then
7161
exit 1
7262
fi
7363

74-
CPPTMPFILE="$$-fmgrtmp.c"
75-
RAWFILE="$$-fmgr.raw"
64+
SORTEDFILE="$$-fmgr.data"
7665
OIDSFILE=fmgroids.h
7766
TABLEFILE=fmgrtab.c
7867

@@ -84,34 +73,14 @@ trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
8473
# Generate the file containing raw pg_proc tuple data
8574
# (but only for "internal" language procedures...).
8675
#
87-
# Unlike genbki.sh, which can run through cpp last, we have to
88-
# deal with preprocessor statements first (before we sort the
89-
# function table by oid).
90-
#
9176
# Note assumption here that prolang == $5 and INTERNALlanguageId == 12.
9277
#
93-
$AWK '
94-
BEGIN { raw = 0; }
95-
/^DATA/ { print; next; }
96-
/^BKI_BEGIN/ { raw = 1; next; }
97-
/^BKI_END/ { raw = 0; next; }
98-
raw == 1 { print; next; }' $INFILE | \
78+
egrep '^DATA' $INFILE | \
9979
sed -e 's/^.*OID[^=]*=[^0-9]*//' \
10080
-e 's/(//g' \
10181
-e 's/[ ]*).*$//' | \
102-
$AWK '
103-
/^#/ { print; next; }
104-
$5 == "12" { print; next; }' > $CPPTMPFILE
105-
106-
if [ $? -ne 0 ]; then
107-
cleanup
108-
echo "$CMDNAME failed"
109-
exit 1
110-
fi
111-
112-
$CPP $BKIOPTS $CPPTMPFILE | \
113-
egrep '^[ ]*[0-9]' | \
114-
sort -n > $RAWFILE
82+
$AWK '$5 == "12" { print }' | \
83+
sort -n > $SORTEDFILE
11584

11685
if [ $? -ne 0 ]; then
11786
cleanup
@@ -165,7 +134,7 @@ FuNkYfMgRsTuFf
165134

166135
# Note assumption here that prosrc == $(NF-2).
167136

168-
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
137+
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $SORTEDFILE | \
169138
$AWK '
170139
BEGIN { OFS = ""; }
171140
{ if (seenit[$(NF-2)]++ == 0) print "#define F_", $(NF-2), " ", $1; }' >> "$$-$OIDSFILE"
@@ -215,7 +184,7 @@ FuNkYfMgRtAbStUfF
215184

216185
# Note assumption here that prosrc == $(NF-2).
217186

218-
$AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$$-$TABLEFILE"
187+
$AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $SORTEDFILE >> "$$-$TABLEFILE"
219188

220189
if [ $? -ne 0 ]; then
221190
cleanup
@@ -242,7 +211,7 @@ $AWK 'BEGIN {
242211
}
243212
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
244213
$1, $(NF-2), $11, Bool[$8], Bool[$9], $(NF-2)
245-
}' $RAWFILE >> "$$-$TABLEFILE"
214+
}' $SORTEDFILE >> "$$-$TABLEFILE"
246215

247216
if [ $? -ne 0 ]; then
248217
cleanup

src/backend/utils/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Makefile for utils
33
#
4-
# $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.21 2003/11/29 19:51:57 pgsql Exp $
4+
# $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.22 2004/01/04 05:57:21 tgl Exp $
55
#
66

77
subdir = src/backend/utils/
@@ -24,7 +24,7 @@ $(SUBDIRS:%=%-recursive): fmgroids.h
2424
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
2525

2626
fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
27-
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
27+
AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
2828

2929

3030
clean:

src/include/postgres.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1111
* Portions Copyright (c) 1995, Regents of the University of California
1212
*
13-
* $PostgreSQL: pgsql/src/include/postgres.h,v 1.66 2003/11/29 22:40:53 pgsql Exp $
13+
* $PostgreSQL: pgsql/src/include/postgres.h,v 1.67 2004/01/04 05:57:21 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -544,9 +544,6 @@ extern int ExceptionalCondition(char *conditionName, char *errorType,
544544
#define DATA(x) extern int no_such_variable
545545
#define DESCR(x) extern int no_such_variable
546546

547-
#define BKI_BEGIN
548-
#define BKI_END
549-
550547
typedef int4 aclitem; /* PHONY definition for catalog use only */
551548

552549
#endif /* POSTGRES_H */

0 commit comments

Comments
 (0)