head	1.16;
access;
symbols
	REL9_0_0:1.16
	REL9_1_ALPHA1:1.16
	REL9_0_RC1:1.16
	REL9_0_BETA4:1.16
	REL9_0_STABLE:1.16.0.14
	REL9_0_BETA3:1.16
	REL9_0_BETA2:1.16
	REL7_4_29:1.2
	REL8_0_25:1.3
	REL8_1_21:1.3.6.1
	REL8_2_17:1.6
	REL8_3_11:1.8
	REL8_4_4:1.16
	REL9_0_BETA1:1.16
	REL9_0_ALPHA5_BRANCH:1.16.0.12
	REL9_0_ALPHA5:1.16
	REL7_4_28:1.2
	REL8_0_24:1.3
	REL8_1_20:1.3.6.1
	REL8_2_16:1.6
	REL8_3_10:1.8
	REL8_4_3:1.16
	REL9_0_ALPHA4:1.16
	REL9_0_ALPHA4_BRANCH:1.16.0.10
	REL8_5_ALPHA3:1.16
	REL8_5_ALPHA3_BRANCH:1.16.0.8
	REL7_4_27:1.2
	REL8_0_23:1.3
	REL8_1_19:1.3.6.1
	REL8_2_15:1.6
	REL8_3_9:1.8
	REL8_4_2:1.16
	REL8_5_ALPHA2:1.16
	REL8_5_ALPHA2_BRANCH:1.16.0.6
	REL7_4_26:1.2
	REL8_0_22:1.3
	REL8_1_18:1.3.6.1
	REL8_2_14:1.6
	REL8_3_8:1.8
	REL8_4_1:1.16
	REL8_5_ALPHA1:1.16
	REL8_5_ALPHA1_BRANCH:1.16.0.4
	REL8_4_STABLE:1.16.0.2
	REL8_4_0:1.16
	REL8_4_RC2:1.16
	REL8_4_RC1:1.16
	REL8_4_BETA2:1.11
	REL8_4_BETA1:1.11
	REL7_4_25:1.2
	REL8_0_21:1.3
	REL8_1_17:1.3.6.1
	REL8_2_13:1.6
	REL8_3_7:1.8
	REL7_4_24:1.2
	REL8_0_20:1.3
	REL8_1_16:1.3.6.1
	REL8_2_12:1.6
	REL8_3_6:1.8
	REL7_4_23:1.2
	REL8_0_19:1.3
	REL8_1_15:1.3.6.1
	REL8_2_11:1.6
	REL8_3_5:1.8
	REL7_4_22:1.2
	REL8_0_18:1.3
	REL8_1_14:1.3.6.1
	REL8_2_10:1.6
	REL8_3_4:1.8
	REL7_4_21:1.2
	REL8_0_17:1.3
	REL8_1_13:1.3.6.1
	REL8_2_9:1.6
	REL8_3_3:1.8
	REL7_4_20:1.2
	REL8_0_16:1.3
	REL8_1_12:1.3.6.1
	REL8_2_8:1.6
	REL8_3_2:1.8
	REL8_2_7:1.6
	REL8_3_1:1.8
	REL8_3_STABLE:1.8.0.2
	REL8_3_0:1.8
	REL8_3_RC2:1.8
	REL7_3_21:1.2
	REL7_4_19:1.2
	REL8_0_15:1.3
	REL8_1_11:1.3.6.1
	REL8_2_6:1.6
	REL8_3_RC1:1.8
	REL8_3_BETA4:1.6
	REL8_3_BETA3:1.6
	REL8_3_BETA2:1.6
	REL8_3_BETA1:1.6
	REL7_3_20:1.2
	REL7_4_18:1.2
	REL8_0_14:1.3
	REL8_1_10:1.3.6.1
	REL8_2_5:1.6
	REL7_3_19:1.2
	REL7_4_17:1.2
	REL8_0_13:1.3
	REL8_1_9:1.3.6.1
	REL8_2_4:1.6
	REL8_0_12:1.3
	REL8_1_8:1.3.6.1
	REL8_2_3:1.6
	REL7_3_18:1.2
	REL7_4_16:1.2
	REL8_0_11:1.3
	REL8_1_7:1.3.6.1
	REL8_2_2:1.6
	REL8_0_10:1.3
	REL8_1_6:1.3.6.1
	REL8_2_1:1.6
	REL7_4_15:1.2
	REL7_3_17:1.2
	REL8_2_STABLE:1.6.0.2
	REL8_2_0:1.6
	REL8_2_RC1:1.6
	REL8_2_BETA3:1.6
	REL8_2_BETA2:1.6
	REL8_1_5:1.3.6.1
	REL8_0_9:1.3
	REL7_4_14:1.2
	REL7_3_16:1.2
	REL8_2_BETA1:1.6
	REL7_3_15:1.2
	REL7_4_13:1.2
	REL8_0_8:1.3
	REL8_1_4:1.3.6.1
	REL7_3_14:1.2
	REL7_4_12:1.2
	REL8_0_7:1.3
	REL8_1_3:1.3.6.1
	REL7_3_13:1.2
	REL7_4_11:1.2
	REL8_0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2_BETA4:1.2
	REL7_2_BETA3:1.2
	REL7_2_BETA2:1.2
	REL7_2_BETA1:1.2
	REL7_1_2:1.2
	REL7_1_STABLE:1.2.0.6
	REL7_1_BETA:1.2
	REL7_1_BETA3:1.2
	REL7_1_BETA2:1.2
	REL7_1:1.2
	REL7_0_PATCHES:1.2.0.4
	REL7_0:1.2
	REL6_5_PATCHES:1.2.0.2
	REL6_5:1.2
	REL6_4:1.1.0.2
	release-6-3:1.1;
locks; strict;
comment	@# @;


1.16
date	2009.06.12.03.09.07;	author momjian;	state Exp;
branches;
next	1.15;

1.15
date	2009.06.12.03.04.48;	author momjian;	state Exp;
branches;
next	1.14;

1.14
date	2009.06.11.03.14.08;	author momjian;	state Exp;
branches;
next	1.13;

1.13
date	2009.06.10.15.13.45;	author momjian;	state Exp;
branches;
next	1.12;

1.12
date	2009.06.10.03.38.32;	author momjian;	state Exp;
branches;
next	1.11;

1.11
date	2008.03.18.23.23.08;	author momjian;	state Exp;
branches;
next	1.10;

1.10
date	2008.03.18.23.04.34;	author momjian;	state Exp;
branches;
next	1.9;

1.9
date	2008.03.18.22.45.11;	author momjian;	state Exp;
branches;
next	1.8;

1.8
date	2007.12.21.21.02.41;	author momjian;	state Exp;
branches;
next	1.7;

1.7
date	2007.12.21.14.20.36;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	2006.03.11.04.38.41;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	2005.11.15.14.45.10;	author momjian;	state Exp;
branches;
next	1.4;

1.4
date	2005.11.15.00.43.01;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	2004.01.04.00.50.11;	author momjian;	state Exp;
branches
	1.3.6.1;
next	1.2;

1.2
date	99.02.10.17.14.32;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	97.09.08.04.13.46;	author momjian;	state Exp;
branches;
next	;

1.3.6.1
date	2005.11.15.14.45.14;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Tighten typedef check for Linux.
@
text
@#!/bin/sh

# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.15 2009/06/12 03:04:48 momjian Exp $

# 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 or Linux, so you may need to make changes.
# 
# Ignore the nm errors about a file not being a binary file.
#
# It gets typedefs by reading "STABS":
#
#    http://www.informatik.uni-frankfurt.de/doc/texi/stabs_toc.html
#
#    objdump:
#       -G, --stabs  Display (in raw form) any STABS info in the file
#
#       --stabs
#         Display the contents of the .stab, .stab.index, and
#         .stab.excl sections from an ELF file.  This is only
#         useful on systems (such as Solaris  2.0)  in  which
#         .stab debugging symbol-table entries are carried in
#         an ELF section.  In most other file formats, debug-
#         ging  symbol-table  entries  are  interleaved  with
#         linkage symbols, and are visible in the --syms out-
#         put.


if [ "$#" -eq 0 -o ! -d "$1" ]
then	echo "Usage:  $0 postgres_binary_directory [...]" 1>&2
	exit 1
fi

for DIR
do	# if objdump -W is recognized, only one line of error should appear
	if [ `objdump -W 2>&1 | wc -l` -eq 1 ]
	then	# Linux
		# Unfortunately the Linux version doesn't show unreferenced typedefs.
		# The problem is that they are still in the source code so should be
		# indented properly.  However, I think pgindent only cares about
		# the typedef references, not the definitions, so I think it might
		# be fine
		objdump -W "$DIR"/* |
		egrep -A3 '\(DW_TAG_typedef\)' |
		awk ' $2 == "DW_AT_name" {print $NF}'
	elif [ `readelf -w 2>&1 | wc -l` -gt 1 ]
	then	# FreeBSD, similar output to Linux
		readelf -w "$DIR"/* |
		egrep -A3 '\(DW_TAG_typedef\)' |
		awk ' $1 == "DW_AT_name" {print $NF}'
	else	# BSD/OS
		# BSD/OS reports all typedefs, even those defined in system
		# include files but never referenced in the PG code.
		objdump --stabs "$DIR"/* |
		awk ' $2 == "LSYM" && $7 ~ /:t/ {sub(":.*", "", $7); print $7}'
	fi
done |
grep -v ' ' | # some typedefs have spaces, remove them
sort |
uniq |
# these are used both for typedefs and variable names
# so do not include them
egrep -v '^(date|interval|timestamp|ANY)$'
@


1.15
log
@Mention BSD/OS find_typedef behavior.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.14 2009/06/11 03:14:08 momjian Exp $
d48 1
a48 1
		egrep -A3 'DW_TAG_typedef' |
@


1.14
log
@Add FreeBSD support for find_typedef, per request from Andrew.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.13 2009/06/10 15:13:45 momjian Exp $
d56 2
@


1.13
log
@Fix Linux typedef code.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.12 2009/06/10 03:38:32 momjian Exp $
d50 5
@


1.12
log
@Fix BSD find_typedef logic.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.11 2008/03/18 23:23:08 momjian Exp $
d48 1
a48 1
		egrep -A3 '(DW_TAG_typedef|DW_TAG_structure_type|DW_TAG_union_type)' |
@


1.11
log
@Add find_typedef comments for Linux.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.10 2008/03/18 23:04:34 momjian Exp $
d52 1
a52 1
		awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}'
@


1.10
log
@Add find_typedef comment.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.9 2008/03/18 22:45:11 momjian Exp $
d42 5
a46 1
		# unfortunately the Linux version doesn't show unreferenced typedefs
@


1.9
log
@Add Linux support to find_typedefs, with help from Alvaro.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.8 2007/12/21 21:02:41 momjian Exp $
d39 1
a39 1
do
@


1.8
log
@Update find_typedefs to handle simple 'typedef X' cases, per request
from Tom.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.7 2007/12/21 14:20:36 momjian Exp $
d11 1
a11 1
# This is run on BSD/OS 4.0, so you may need to make changes.
d40 10
a49 3
	objdump --stabs "$DIR"/* |
	awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}' |
	grep -v ' ' # some typedefs have spaces, remove them
d51 1
@


1.7
log
@Modify pgindent to use an external typedefs file rather than included
list.

Remove pgjindent.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.6 2006/03/11 04:38:41 momjian Exp $
d15 1
a15 1
# Remember, debugging symbols are your friends.
d17 15
d41 1
a41 4
	grep "LSYM" |
	awk '{print $7}' |
	grep ':t' |
	sed 's/^\([^:]*\).*$/\1/' |
@


1.6
log
@Add CVS tag lines to files that were lacking them.
@
text
@d3 1
a3 1
# $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.314 2006/03/07 02:54:23 momjian Exp $
d36 1
a36 2
egrep -v '^(date|interval|timestamp|ANY)$' |
sed 's/\(.*\)/-T\1 \\/'
@


1.5
log
@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.
@
text
@d2 3
@


1.4
log
@Fix recent problems with BSD indent, including indenting past 80
columns, shifting comment to the right when more than 150 'else if'
clauses were used, and update typedefs for 8.1.X.

NetBSD patched updated, with documentation.
@
text
@d31 3
@


1.3
log
@Remove trailing newline from file.
@
text
@d15 2
a16 2
if [ "$#" -ne 1 -o ! -d "$1" ]
then	echo "Usage:  $0 postgres_binary_directory" 1>&2
d20 9
a28 6
objdump --stabs "$1"/* |
grep "LSYM" |
awk '{print $7}' |
grep ':t' |
sed 's/^\([^:]*\).*$/\1/' |
grep -v ' ' | # some typedefs have spaces, remove them
d30 2
a31 1
uniq
@


1.3.6.1
log
@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.
@
text
@d15 2
a16 2
if [ "$#" -eq 0 -o ! -d "$1" ]
then	echo "Usage:  $0 postgres_binary_directory [...]" 1>&2
d20 6
a25 9
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 |
d27 1
a27 5
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 \\/'
@


1.2
log
@Update find_typedefs for bsdi 4.0.
@
text
@a27 1

@


1.1
log
@Reorganize developers files.
@
text
@d8 1
a8 2
# This is run on BSD/OS 3.0, so you may need to make changes for your
# version of nm.
d20 3
a22 2
nm -a "$1"/* |
grep LSYM |
d24 3
a26 3
sed 's/^.*LSYM \([^:]*\):.*$/\1/' |
grep -v ' ' | # some typedefs have spaces, revove them
sort | 
d28 1
@
