def prototypes_win(): p = [] for name in source_files(): if not fnmatch.fnmatch(name, '*.[ci]'): continue if not fnmatch.fnmatch(name, '*/os_win/*'): continue prototypes(p, name) output(p, "../src/include/extern_win.h")
def prototypes_posix(): p = [] for name in source_files(): if not fnmatch.fnmatch(name, '*.c') + fnmatch.fnmatch( name, '*_inline.h'): continue if not fnmatch.fnmatch(name, '*/os_posix/*'): continue prototypes(p, name) output(p, "../src/include/extern_posix.h")
def prototypes_win(): fns = [] tests = [] for name in source_files(): if not fnmatch.fnmatch(name, '*.c') + fnmatch.fnmatch( name, '*_inline.h'): continue if not fnmatch.fnmatch(name, '*/os_win/*'): continue fn_prototypes(fns, tests, name) output(fns, tests, "../src/include/extern_win.h")
def missing_comment(): for f in source_files(): skip_re = re.compile(r'DO NOT EDIT: automatically built') func_re = re.compile(r'(/\*(?:[^\*]|\*[^/])*\*/)?\n\w[\w \*]+\n(\w+)', re.DOTALL) s = open(f, 'r').read() if skip_re.search(s): continue for m in func_re.finditer(s): if not m.group(1) or \ not m.group(1).startswith('/*\n * %s --\n' % m.group(2)): print "%s:%d: missing or malformed comment for %s" % \ (f, s[:m.start(2)].count('\n'), m.group(2))
def missing_comment(): for f in source_files(): skip_re = re.compile(r'DO NOT EDIT: automatically built') func_re = re.compile( r'(/\*(?:[^\*]|\*[^/])*\*/)?\n\w[\w \*]+\n(\w+)', re.DOTALL) s = open(f, 'r').read() if skip_re.search(s): continue for m in func_re.finditer(s): if not m.group(1) or \ not m.group(1).startswith('/*\n * %s --\n' % m.group(2)): print "%s:%d: missing or malformed comment for %s" % \ (f, s[:m.start(2)].count('\n'), m.group(2))
def lines_could_join(): for f in source_files(): skip_re = re.compile(r'__asm__') match_re = re.compile('(^[ \t].*\()\n^[ \t]*([^\n]*)', re.MULTILINE) s = open(f, 'r').read() if skip_re.search(s): continue for m in match_re.finditer(s): if len(m.group(1).expandtabs()) + \ len(m.group(2).expandtabs()) < 80: print f + ': lines may be combined: ' print '\t' + m.group(1).lstrip() + m.group(2) print
def prototypes_extern(): p = [] for name in source_files(): if not fnmatch.fnmatch(name, '*.[ci]'): continue if fnmatch.fnmatch(name, '*/checksum/arm64/*'): continue if fnmatch.fnmatch(name, '*/checksum/power8/*'): continue if fnmatch.fnmatch(name, '*/checksum/zseries/*'): continue if fnmatch.fnmatch(name, '*/os_posix/*'): continue if fnmatch.fnmatch(name, '*/os_win/*'): continue if fnmatch.fnmatch(name, '*/ext/*'): continue prototypes(p, name) output(p, "../src/include/extern.h")
def prototypes_extern(): fns = [] tests = [] for name in source_files(): if not fnmatch.fnmatch(name, '*.c') + fnmatch.fnmatch( name, '*_inline.h'): continue if fnmatch.fnmatch(name, '*/checksum/arm64/*'): continue if fnmatch.fnmatch(name, '*/checksum/power8/*'): continue if fnmatch.fnmatch(name, '*/checksum/riscv64/*'): continue if fnmatch.fnmatch(name, '*/checksum/zseries/*'): continue if fnmatch.fnmatch(name, '*/os_posix/*'): continue if fnmatch.fnmatch(name, '*/os_win/*'): continue if fnmatch.fnmatch(name, '*/ext/*'): continue fn_prototypes(fns, tests, name) output(fns, tests, "../src/include/extern.h")