mirror of
https://bitbucket.org/smil3y/katana.git
synced 2025-02-23 18:32:47 +00:00
22 lines
842 B
Python
Executable file
22 lines
842 B
Python
Executable file
#!/usr/bin/python2
|
|
|
|
# a script to check for possible functions inlining/deinlining in headers files
|
|
|
|
import os, re
|
|
|
|
regex = re.compile('(.*[\\t| ](.*)\(\).*\{.*return.*\(\).*\})')
|
|
|
|
for root, dirs, files in os.walk(os.getcwd()):
|
|
for sfile in files:
|
|
if not sfile.endswith(('.hpp', '.h', '.hh')):
|
|
continue
|
|
sfull = '%s/%s' % (root, sfile)
|
|
with open(sfull, 'rb') as f:
|
|
content = f.read()
|
|
for match in regex.findall(content):
|
|
if 'inline' in match[0]:
|
|
print('possible removal of %s in %s' % (match[1], sfull.replace('%s/' % os.getcwd(), "")))
|
|
continue
|
|
elif 'const' in match[0] or 'virtual' in match[0]:
|
|
continue
|
|
print('possible inlining of %s in %s' % (match[1], sfull.replace('%s/' % os.getcwd(), "")))
|