File: unused.sh

package info (click to toggle)
swi-prolog 6.6.6-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 82,312 kB
  • sloc: ansic: 322,250; perl: 245,822; sh: 6,651; java: 5,254; makefile: 4,423; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (17 lines) | stat: -rwxr-xr-x 359 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

# Find unused functions in a set of object files
# Typical use:
#
# ../scripts/unused.sh *.o */*.o

files="$*"
deffed=unused.deffed$$
used=unused.used$$

nm $files | grep -w T | awk '{print $3}' | sort -u >> $deffed
nm $files | grep -w U | awk '{print $2}' | sort -u >> $used

comm -23 $deffed $used | egrep -v '^_?(PL|SP)_'

rm -f $deffed $used