Validate platform files

This commit is contained in:
amai 2018-02-15 20:35:12 +01:00
parent 791f85295c
commit 0f00259a96
3 changed files with 68 additions and 2 deletions

View File

@ -305,6 +305,14 @@ ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))
xmllint --noout --relaxng cfg/cppcheck-cfg.rng $<
validateCFG: ${ConfigFilesCHECKED}
# Validation of platforms files:
PlatformFiles := $(wildcard platforms/*.xml)
PlatformFilesCHECKED := $(patsubst %.xml,%.checked,$(PlatformFiles))
.PHONY: validatePlatforms
%.checked:%.xml
xmllint --noout --relaxng platforms/cppcheck-platforms.rng $<
validatePlatforms: ${PlatformFilesCHECKED}
###### Build

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="platform">
<element name="char_bit">
<data type="integer"/>
</element>
<element name="default-sign">
<data type="NCName"/>
</element>
<element name="sizeof">
<zeroOrMore>
<choice>
<element name="bool">
<data type="integer"/>
</element>
<element name="short">
<data type="integer"/>
</element>
<element name="int">
<data type="integer"/>
</element>
<element name="long">
<data type="integer"/>
</element>
<element name="long-long">
<data type="integer"/>
</element>
<element name="float">
<data type="integer"/>
</element>
<element name="double">
<data type="integer"/>
</element>
<element name="long-double">
<data type="integer"/>
</element>
<element name="pointer">
<data type="integer"/>
</element>
<element name="size_t">
<data type="integer"/>
</element>
<element name="wchar_t">
<data type="integer"/>
</element>
</choice>
</zeroOrMore>
</element>
</element>
</start>
</grammar>

View File

@ -375,7 +375,7 @@ int main(int argc, char **argv)
fout << "\t./testrunner\n\n";
fout << "check:\tall\n";
fout << "\t./testrunner -q\n\n";
fout << "checkcfg:\tcppcheck validateCFG\n";
fout << "checkcfg:\tcppcheck validateCFG validatePlatforms\n";
fout << "\t./test/cfg/runtests.sh\n\n";
fout << "dmake:\ttools/dmake.o cli/filelister.o $(SRCDIR)/pathmatch.o $(SRCDIR)/path.o externals/simplecpp/simplecpp.o\n";
fout << "\t$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)\n\n";
@ -407,7 +407,13 @@ int main(int argc, char **argv)
fout << "%.checked:%.cfg\n";
fout << "\txmllint --noout --relaxng cfg/cppcheck-cfg.rng $<\n";
fout << "validateCFG: ${ConfigFilesCHECKED}\n\n";
fout << "# Validation of platforms files:\n";
fout << "PlatformFiles := $(wildcard platforms/*.xml)\n";
fout << "PlatformFilesCHECKED := $(patsubst %.xml,%.checked,$(PlatformFiles))\n";
fout << ".PHONY: validatePlatforms\n";
fout << "%.checked:%.xml\n";
fout << "\txmllint --noout --relaxng platforms/cppcheck-platforms.rng $<\n";
fout << "validatePlatforms: ${PlatformFilesCHECKED}\n\n";
fout << "\n###### Build\n\n";