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

import subprocess

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

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