~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/tools/find_static

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
trap "rm -f /tmp/$$" 0 1 2 3 15
 
3
 
 
4
# This script finds functions that are either never called, or
 
5
# should be static.
 
6
# Some functions, like library functions and debug_print functions,
 
7
# should remain unchanged.
 
8
 
 
9
# Run on a compiled source tree, from the top of the source tree
 
10
 
 
11
# My nm utility has 9 characters of address which I strip, then a 'type'
 
12
# character, with T as a text function, and U as an undefined function
 
13
# symbol, then the function name.
 
14
 
 
15
find . -name '[a-z]*.o' -type f -print | while read FILE
 
16
do
 
17
        nm $FILE | cut -c10-100 |awk '{printf "%s\t%s\t%s\n", "'"$FILE"'",$1,$2}'
 
18
done >/tmp/$$
 
19
dropdb debug
 
20
createdb debug
 
21
echo "
 
22
        create table debug (file text, scope char, func text);
 
23
 
 
24
        copy debug from '/tmp/"$$"';
 
25
 
 
26
        select  * 
 
27
        into    table debug2 
 
28
        from    debug;
 
29
 
 
30
        create index idebug on debug(scope,func);
 
31
        create index idebug2 on debug2(func,scope);
 
32
        vacuum debug;
 
33
        vacuum debug2;
 
34
 
 
35
        update  debug2 
 
36
        set     scope = '_' 
 
37
        from    debug
 
38
        where   debug2.func = debug.func and
 
39
                debug2.scope = 'T' and debug.scope = 'U';
 
40
 
 
41
        delete  from debug2
 
42
        where   scope = '_';
 
43
 
 
44
        select  *
 
45
        from    debug2
 
46
        where   scope = 'T'
 
47
        order by file, func;
 
48
" |psql debug
 
49