summaryrefslogtreecommitdiff
path: root/bin/find-unused-typedefs.py
blob: e292f097526a2f0a4e41085fa46faddbc37dff57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python

import subprocess

a = subprocess.Popen("git grep -P '^typedef\s+.+\s+\w+;' -- \"[!e][!x][!t]*\"", stdout=subprocess.PIPE, shell=True)

with a.stdout as txt:
    for line in txt:
        idx2 = line.rfind(";")
        idx1 = line.rfind(" ", 0, idx2)
        typedefName = line[idx1+1 : idx2]
        if typedefName.startswith("*"):
           typedefName = typedefName[1:]
        # ignore anything less than 5 characters, it's probably a parsing error
        if len(typedefName) > 4:
            print typedefName