diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-08-20 02:10:47 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-08-20 02:10:47 +0000 |
commit | 36c9c968c083364c7a1103c5d170b64a3e952ec9 (patch) | |
tree | df1c54a6bc32aeff1846e1731872668d84998c62 | |
parent | 4a132abf6c129eed027bd7d119da007c420bc3de (diff) | |
download | postgresql-36c9c968c083364c7a1103c5d170b64a3e952ec9.tar.gz postgresql-36c9c968c083364c7a1103c5d170b64a3e952ec9.zip |
Add static finding script.
-rw-r--r-- | src/FIND_STATIC | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/FIND_STATIC b/src/FIND_STATIC new file mode 100644 index 00000000000..bce75a2bf67 --- /dev/null +++ b/src/FIND_STATIC @@ -0,0 +1,43 @@ +#!/bin/sh +trap "rm -f /tmp/$$" 0 1 2 3 15 + +# This script finds functions that are either never called, or +# should be static. +# Some functions, like library functions and debug_print functions, +# should remain unchanged. + +# Run on a compiled source tree, from the top of the source tree + +# My nm utility has 9 characters of address which I strip, then a 'type' +# character, with T as a text function, and U as an undefined function +# symbol, then the function name. + +find . -name '[a-z]*.o' -type f -print | while read FILE +do + nm $FILE | cut -c10-100 |awk '{printf "%s\t%s\t%s\n", "'"$FILE"'",$1,$2}' +done >/tmp/$$ +destroydb debug +createdb debug +echo " + create table debug (file text, scope char, func text); + + copy debug from '/tmp/"$$"'; + + select * + into table debug2 + from debug; + + update debug2 + set scope = '_' + from debug + where debug2.func = debug.func and + debug2.scope = 'T' and debug.scope = 'U'; + + delete from debug2 + where scope = '_'; + + select * + from debug2 + where scope = 'T'; +" |psql debug + |