Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36c9c96

Browse files
committed
Add static finding script.
1 parent4a132ab commit36c9c96

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

‎src/FIND_STATIC

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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|whileread FILE
16+
do
17+
nm$FILE| cut -c10-100|awk'{printf "%s\t%s\t%s\n", "'"$FILE"'",$1,$2}'
18+
done>/tmp/$$
19+
destroydb 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+
intotable debug2
28+
from debug;
29+
30+
update debug2
31+
set scope = '_'
32+
from debug
33+
where debug2.func = debug.func and
34+
debug2.scope = 'T' and debug.scope = 'U';
35+
36+
delete from debug2
37+
where scope = '_';
38+
39+
select *
40+
from debug2
41+
wherescope = 'T';
42+
"|psql debug
43+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp