[tools] Check C & C++ syntax.

This commit is contained in:
Andrew Hamilton 2016-11-21 11:59:56 +01:00
parent 167f0a4a1d
commit e1adec2133
4 changed files with 23 additions and 4 deletions

View file

@ -509,6 +509,12 @@ perltidy.url = "http://perltidy.sourceforge.net/"
# perl6_syntax.dependencies = {"rakudo"}
def c_syntax(path):
return _run_command(["gcc", "-fsyntax-only", path])
c_syntax.dependencies = {"gcc"}
c_syntax.url = "https://gcc.gnu.org/"
def splint(path):
stdout, stderr, returncode = _do_command(["splint", "-preproc", path])
status = Status.ok if returncode == 0 else Status.problem
@ -595,6 +601,12 @@ html2text.dependencies = {"html2text"}
html2text.url = "html2text"
def cpp_syntax(path):
return _run_command(["gcc", "-fsyntax-only", path])
cpp_syntax.dependencies = {"gcc"}
cpp_syntax.url = "https://gcc.gnu.org/"
def bcpp(path):
stdout, stderr, returncode = _do_command(["bcpp", "-fi", path])
status = Status.normal if returncode == 0 else Status.problem
@ -754,9 +766,9 @@ TOOLS_FOR_EXTENSIONS = \
# (["p6", "pm6"], [perl6_syntax, perldoc]),
(["pod", "pod6"], [perldoc]),
(["java"], [uncrustify]),
(["c", "h"], [splint, uncrustify]),
(["c", "h"], [c_syntax, splint, uncrustify]),
(["o"], [objdump_headers, objdump_disassemble, readelf]),
(["cpp"], [bcpp, uncrustify]),
(["cpp"], [cpp_syntax, bcpp, uncrustify]),
(["pdf"], [pdf2txt]),
(["html"], [html_syntax, tidy, html2text]),
(["php"], [php5_syntax]),