postgresql/src/tools/find_typedef
Bruce Momjian 62fb1d6028 Prevent certain symbols that are used for both typedefs and variable
names from being added to pgindent's typedef list.  The existance of
them caused weird formatting in the date/type files, and in keywords.c.

Backpatch to 8.1.X.
2005-11-15 14:45:10 +00:00

35 lines
854 B
Bash
Executable File

#!/bin/sh
# This script attempts to find all typedef's in the postgres binaries
# by using 'nm' to report all typedef debugging symbols.
#
# For this program to work, you must have compiled all binaries with
# debugging symbols.
#
# This is run on BSD/OS 4.0, so you may need to make changes.
#
# Ignore the nm errors about a file not being a binary file.
#
# Remember, debugging symbols are your friends.
#
if [ "$#" -eq 0 -o ! -d "$1" ]
then echo "Usage: $0 postgres_binary_directory [...]" 1>&2
exit 1
fi
for DIR
do
objdump --stabs "$DIR"/* |
grep "LSYM" |
awk '{print $7}' |
grep ':t' |
sed 's/^\([^:]*\).*$/\1/' |
grep -v ' ' # some typedefs have spaces, remove them
done |
sort |
uniq |
# these are used both for typedefs and variable names
# so do not include them
egrep -v '^(date|interval|timestamp|ANY)$' |
sed 's/\(.*\)/-T\1 \\/'