3 # ***** BEGIN GPL LICENSE BLOCK *****
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # Contributor(s): Campbell Barton
21 # ***** END GPL LICENSE BLOCK *****
25 CHECKER_IGNORE_PREFIX = [
30 CHECKER_BIN = "splint"
47 # we may want to remove these later
55 "-bufferoverflowhigh", # warns a lot about sprintf()
57 # re-definitions, rna causes most of these
61 # dummy, witjout this splint complains with:
62 # /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
67 import project_source_info
72 USE_QUIET = (os.environ.get("QUIET", None) is not None)
76 source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
79 for c, inc_dirs, defs in source_info:
80 cmd = ([CHECKER_BIN] +
83 [("-I%s" % i) for i in inc_dirs] +
84 [("-D%s" % d) for d in defs]
87 check_commands.append((c, cmd))
89 def my_process(i, c, cmd):
91 percent = 100.0 * (i / len(check_commands))
92 percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
94 sys.stdout.write("%s %s\n" % (percent_str, c))
97 return subprocess.Popen(cmd)
99 process_functions = []
100 for i, (c, cmd) in enumerate(check_commands):
101 process_functions.append((my_process, (i, c, cmd)))
103 project_source_info.queue_processes(process_functions)
106 if __name__ == "__main__":