aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/Gen_fmgrtab.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/Gen_fmgrtab.pl')
-rw-r--r--src/backend/utils/Gen_fmgrtab.pl35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index bc5865a14be..cdd603ab6fe 100644
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -87,9 +87,11 @@ foreach my $row (@$data)
# Emit headers for both files
my $tmpext = ".tmp$$";
my $oidsfile = $output_path . 'fmgroids.h';
+my $protosfile = $output_path . 'fmgrprotos.h';
my $tabfile = $output_path . 'fmgrtab.c';
open H, '>', $oidsfile . $tmpext or die "Could not open $oidsfile$tmpext: $!";
+open P, '>', $protosfile . $tmpext or die "Could not open $protosfile$tmpext: $!";
open T, '>', $tabfile . $tmpext or die "Could not open $tabfile$tmpext: $!";
print H
@@ -130,6 +132,33 @@ qq|/*-------------------------------------------------------------------------
*/
|;
+print P
+qq|/*-------------------------------------------------------------------------
+ *
+ * fmgrprotos.h
+ * Prototypes for built-in functions.
+ *
+ * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * NOTES
+ * ******************************
+ * *** DO NOT EDIT THIS FILE! ***
+ * ******************************
+ *
+ * It has been GENERATED by $0
+ * from $infile
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef FMGRPROTOS_H
+#define FMGRPROTOS_H
+
+#include "fmgr.h"
+
+|;
+
print T
qq|/*-------------------------------------------------------------------------
*
@@ -154,6 +183,7 @@ qq|/*-------------------------------------------------------------------------
#include "postgres.h"
#include "utils/fmgrtab.h"
+#include "utils/fmgrprotos.h"
|;
@@ -164,7 +194,7 @@ foreach my $s (sort { $a->{oid} <=> $b->{oid} } @fmgr)
next if $seenit{ $s->{prosrc} };
$seenit{ $s->{prosrc} } = 1;
print H "#define F_" . uc $s->{prosrc} . " $s->{oid}\n";
- print T "extern Datum $s->{prosrc} (PG_FUNCTION_ARGS);\n";
+ print P "extern Datum $s->{prosrc}(PG_FUNCTION_ARGS);\n";
}
# Create the fmgr_builtins table
@@ -180,6 +210,7 @@ foreach my $s (sort { $a->{oid} <=> $b->{oid} } @fmgr)
# And add the file footers.
print H "\n#endif /* FMGROIDS_H */\n";
+print P "\n#endif /* FMGRPROTOS_H */\n";
print T
qq| /* dummy entry is easier than getting rid of comma after last real one */
@@ -193,10 +224,12 @@ const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
|;
close(H);
+close(P);
close(T);
# Finally, rename the completed files into place.
Catalog::RenameTempFile($oidsfile, $tmpext);
+Catalog::RenameTempFile($protosfile, $tmpext);
Catalog::RenameTempFile($tabfile, $tmpext);
sub usage