summaryrefslogtreecommitdiffstats
path: root/src/tools/pginclude/pgdefine
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
commit311bcfc6b3acdd6fd152798c7f287ddf74fa2a98 (patch)
tree0ec307299b1dada3701e42f4ca6eda57d708261e /src/tools/pginclude/pgdefine
parentInitial commit. (diff)
downloadpostgresql-15-upstream.tar.xz
postgresql-15-upstream.zip
Adding upstream version 15.4.upstream/15.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/pginclude/pgdefine')
-rwxr-xr-xsrc/tools/pginclude/pgdefine25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/pginclude/pgdefine b/src/tools/pginclude/pgdefine
new file mode 100755
index 0000000..242d035
--- /dev/null
+++ b/src/tools/pginclude/pgdefine
@@ -0,0 +1,25 @@
+:
+# create macro calls for all defines in the file
+
+# src/tools/pginclude/pgdefine
+
+trap "rm -f /tmp/$$" 0 1 2 3 15
+for FILE
+do
+ cat "$FILE" | grep "^#define" >/tmp/$$
+ cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*\)[ ][ ]*[^ ].*\\\\$/\1;/p'
+ cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*\)[ ][ ]*[^ ].*[^\\\\]$/(void)\1;/p'
+
+ (
+ cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*([^)]*)\).*\\\\$/\1;/p'
+ cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*([^)]*)\).*[^\\\\]$/(=void)\1;/p'
+ ) |
+ sed 's/([a-zA-Z0-9_ ][a-zA-Z0-9_ ]*)/(0)/g' |
+ 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