generate `*.vcxproj` file lists with `dmake` (#4652)

This commit is contained in:
Oliver Stöneberg 2023-01-21 11:55:36 +01:00 committed by GitHub
parent 38abeccd24
commit 41849b1a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 271 additions and 88 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug-PCRE|Win32"> <ProjectConfiguration Include="Debug-PCRE|Win32">
@ -403,24 +403,23 @@
<ItemGroup> <ItemGroup>
<ResourceCompile Include="version.rc" /> <ResourceCompile Include="version.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="..\lib\config.h" />
<ClInclude Include="cmdlineparser.h" /> <ClInclude Include="cmdlineparser.h" />
<ClInclude Include="cppcheckexecutor.h" /> <ClInclude Include="cppcheckexecutor.h" />
<ClCompile Include="cppcheckexecutorseh.h" /> <ClInclude Include="cppcheckexecutorseh.h" />
<ClCompile Include="cppcheckexecutorsig.h" /> <ClInclude Include="cppcheckexecutorsig.h" />
<ClInclude Include="executor.h" /> <ClInclude Include="executor.h" />
<ClInclude Include="filelister.h" /> <ClInclude Include="filelister.h" />
<ClInclude Include="processexecutor.h" /> <ClInclude Include="processexecutor.h" />
<ClInclude Include="threadexecutor.h" />
<ClInclude Include="stacktrace.h" /> <ClInclude Include="stacktrace.h" />
<ClInclude Include="threadexecutor.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\lib\cppcheck.vcxproj"> <ProjectReference Include="..\lib\cppcheck.vcxproj">
<Project>{c183db5b-ad6c-423d-80ca-1f9549555a1a}</Project> <Project>{c183db5b-ad6c-423d-80ca-1f9549555a1a}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="cmdlineparser.cpp" /> <ClCompile Include="cmdlineparser.cpp" />
<ClCompile Include="cppcheckexecutor.cpp" /> <ClCompile Include="cppcheckexecutor.cpp" />
<ClCompile Include="cppcheckexecutorseh.cpp" /> <ClCompile Include="cppcheckexecutorseh.cpp" />
@ -429,8 +428,8 @@
<ClCompile Include="filelister.cpp" /> <ClCompile Include="filelister.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="processexecutor.cpp" /> <ClCompile Include="processexecutor.cpp" />
<ClCompile Include="threadexecutor.cpp" />
<ClCompile Include="stacktrace.cpp" /> <ClCompile Include="stacktrace.cpp" />
<ClCompile Include="threadexecutor.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" /> <ImportGroup Label="ExtensionTargets" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Header Files"> <Filter Include="Header Files">
@ -13,7 +13,7 @@
<UniqueIdentifier>{6d3be647-edb6-43e6-a7eb-3031a2c7b655}</UniqueIdentifier> <UniqueIdentifier>{6d3be647-edb6-43e6-a7eb-3031a2c7b655}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="..\lib\config.h"> <ClInclude Include="..\lib\config.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -45,7 +45,7 @@
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testrunner", "test\testrunn
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppcheck", "lib\cppcheck.vcxproj", "{C183DB5B-AD6C-423D-80CA-1F9549555A1A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppcheck", "lib\cppcheck.vcxproj", "{C183DB5B-AD6C-423D-80CA-1F9549555A1A}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "tools\dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@ -75,8 +77,23 @@ Global
{C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|Win32.Build.0 = Release-PCRE|Win32 {C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|Win32.Build.0 = Release-PCRE|Win32
{C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|x64.ActiveCfg = Release-PCRE|x64 {C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|x64.ActiveCfg = Release-PCRE|x64
{C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|x64.Build.0 = Release-PCRE|x64 {C183DB5B-AD6C-423D-80CA-1F9549555A1A}.Release-PCRE|x64.Build.0 = Release-PCRE|x64
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug|Win32.ActiveCfg = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug|Win32.Build.0 = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug|x64.ActiveCfg = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug-PCRE|Win32.ActiveCfg = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug-PCRE|Win32.Build.0 = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug-PCRE|x64.ActiveCfg = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release|Win32.ActiveCfg = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release|Win32.Build.0 = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release|x64.ActiveCfg = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release-PCRE|Win32.ActiveCfg = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release-PCRE|Win32.Build.0 = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release-PCRE|x64.ActiveCfg = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8CB50DEA-06DB-48E8-9C7B-F917494480A1}
EndGlobalSection
EndGlobal EndGlobal

View File

@ -178,7 +178,7 @@ bool isTemporary(bool cpp, const Token* tok, const Library* library, bool unknow
const Token* previousBeforeAstLeftmostLeaf(const Token* tok); const Token* previousBeforeAstLeftmostLeaf(const Token* tok);
Token* previousBeforeAstLeftmostLeaf(Token* tok); Token* previousBeforeAstLeftmostLeaf(Token* tok);
const Token * nextAfterAstRightmostLeaf(const Token * tok); CPPCHECKLIB const Token * nextAfterAstRightmostLeaf(const Token * tok);
Token* nextAfterAstRightmostLeaf(Token* tok); Token* nextAfterAstRightmostLeaf(Token* tok);
Token* astParentSkipParens(Token* tok); Token* astParentSkipParens(Token* tok);
@ -240,7 +240,7 @@ SmallVector<ReferenceToken> followAllReferences(const Token* tok,
int depth = 20); int depth = 20);
const Token* followReferences(const Token* tok, ErrorPath* errors = nullptr); const Token* followReferences(const Token* tok, ErrorPath* errors = nullptr);
bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2, const Library& library, bool pure, bool followVar, ErrorPath* errors=nullptr); CPPCHECKLIB bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2, const Library& library, bool pure, bool followVar, ErrorPath* errors=nullptr);
bool isEqualKnownValue(const Token * const tok1, const Token * const tok2); bool isEqualKnownValue(const Token * const tok1, const Token * const tok2);
@ -251,7 +251,7 @@ const Token* isInLoopCondition(const Token* tok);
/** /**
* Is token used a boolean, that is to say cast to a bool, or used as a condition in a if/while/for * Is token used a boolean, that is to say cast to a bool, or used as a condition in a if/while/for
*/ */
bool isUsedAsBool(const Token * const tok); CPPCHECKLIB bool isUsedAsBool(const Token * const tok);
/** /**
* Are two conditions opposite * Are two conditions opposite
@ -277,10 +277,10 @@ bool isUniqueExpression(const Token* tok);
bool isEscapeFunction(const Token* ftok, const Library* library); bool isEscapeFunction(const Token* ftok, const Library* library);
/** Is scope a return scope (scope will unconditionally return) */ /** Is scope a return scope (scope will unconditionally return) */
bool isReturnScope(const Token* const endToken, CPPCHECKLIB bool isReturnScope(const Token* const endToken,
const Library* library = nullptr, const Library* library = nullptr,
const Token** unknownFunc = nullptr, const Token** unknownFunc = nullptr,
bool functionScope = false); bool functionScope = false);
/** Is tok within a scope of the given type, nested within var's scope? */ /** Is tok within a scope of the given type, nested within var's scope? */
bool isWithinScope(const Token* tok, bool isWithinScope(const Token* tok,
@ -312,10 +312,10 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, nonneg int
* @param settings program settings * @param settings program settings
* @param inconclusive pointer to output variable which indicates that the answer of the question is inconclusive * @param inconclusive pointer to output variable which indicates that the answer of the question is inconclusive
*/ */
bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Settings *settings, bool *inconclusive); CPPCHECKLIB bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Settings *settings, bool *inconclusive);
/** Is variable changed in block of code? */ /** Is variable changed in block of code? */
bool isVariableChanged(const Token *start, const Token *end, const nonneg int exprid, bool globalvar, const Settings *settings, bool cpp, int depth = 20); CPPCHECKLIB bool isVariableChanged(const Token *start, const Token *end, const nonneg int exprid, bool globalvar, const Settings *settings, bool cpp, int depth = 20);
bool isVariableChanged(const Token *start, const Token *end, int indirect, const nonneg int exprid, bool globalvar, const Settings *settings, bool cpp, int depth = 20); bool isVariableChanged(const Token *start, const Token *end, int indirect, const nonneg int exprid, bool globalvar, const Settings *settings, bool cpp, int depth = 20);
bool isVariableChanged(const Token *tok, int indirect, const Settings *settings, bool cpp, int depth = 20); bool isVariableChanged(const Token *tok, int indirect, const Settings *settings, bool cpp, int depth = 20);
@ -380,14 +380,14 @@ int getArgumentPos(const Variable* var, const Function* f);
*/ */
bool isIteratorPair(std::vector<const Token*> args); bool isIteratorPair(std::vector<const Token*> args);
const Token *findLambdaStartToken(const Token *last); CPPCHECKLIB const Token *findLambdaStartToken(const Token *last);
/** /**
* find lambda function end token * find lambda function end token
* \param first The [ token * \param first The [ token
* \return nullptr or the } * \return nullptr or the }
*/ */
const Token *findLambdaEndToken(const Token *first); CPPCHECKLIB const Token *findLambdaEndToken(const Token *first);
Token* findLambdaEndToken(Token* first); Token* findLambdaEndToken(Token* first);
bool isLikelyStream(bool cpp, const Token *stream); bool isLikelyStream(bool cpp, const Token *stream);
@ -418,7 +418,7 @@ const Token* findAllocFuncCallToken(const Token *expr, const Library &library);
bool isScopeBracket(const Token* tok); bool isScopeBracket(const Token* tok);
bool isNullOperand(const Token *expr); CPPCHECKLIB bool isNullOperand(const Token *expr);
bool isGlobalData(const Token *expr, bool cpp); bool isGlobalData(const Token *expr, bool cpp);

View File

@ -33,7 +33,7 @@
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="..\externals\simplecpp\simplecpp.cpp" /> <ClCompile Include="..\externals\simplecpp\simplecpp.cpp" />
<ClCompile Include="..\externals\tinyxml2\tinyxml2.cpp" /> <ClCompile Include="..\externals\tinyxml2\tinyxml2.cpp" />
<ClCompile Include="analyzerinfo.cpp" /> <ClCompile Include="analyzerinfo.cpp" />
@ -56,9 +56,8 @@
<ClCompile Include="checkbufferoverrun.cpp" /> <ClCompile Include="checkbufferoverrun.cpp" />
<ClCompile Include="checkclass.cpp" /> <ClCompile Include="checkclass.cpp" />
<ClCompile Include="checkcondition.cpp" /> <ClCompile Include="checkcondition.cpp" />
<ClCompile Include="checkfunctions.cpp" />
<ClCompile Include="checkstring.cpp" />
<ClCompile Include="checkexceptionsafety.cpp" /> <ClCompile Include="checkexceptionsafety.cpp" />
<ClCompile Include="checkfunctions.cpp" />
<ClCompile Include="checkinternal.cpp" /> <ClCompile Include="checkinternal.cpp" />
<ClCompile Include="checkio.cpp" /> <ClCompile Include="checkio.cpp" />
<ClCompile Include="checkleakautovar.cpp" /> <ClCompile Include="checkleakautovar.cpp" />
@ -68,6 +67,7 @@
<ClCompile Include="checkpostfixoperator.cpp" /> <ClCompile Include="checkpostfixoperator.cpp" />
<ClCompile Include="checksizeof.cpp" /> <ClCompile Include="checksizeof.cpp" />
<ClCompile Include="checkstl.cpp" /> <ClCompile Include="checkstl.cpp" />
<ClCompile Include="checkstring.cpp" />
<ClCompile Include="checktype.cpp" /> <ClCompile Include="checktype.cpp" />
<ClCompile Include="checkuninitvar.cpp" /> <ClCompile Include="checkuninitvar.cpp" />
<ClCompile Include="checkunusedfunctions.cpp" /> <ClCompile Include="checkunusedfunctions.cpp" />
@ -79,7 +79,9 @@
<ClCompile Include="ctu.cpp" /> <ClCompile Include="ctu.cpp" />
<ClCompile Include="errorlogger.cpp" /> <ClCompile Include="errorlogger.cpp" />
<ClCompile Include="errortypes.cpp" /> <ClCompile Include="errortypes.cpp" />
<ClCompile Include="forwardanalyzer.cpp" />
<ClCompile Include="fwdanalysis.cpp" /> <ClCompile Include="fwdanalysis.cpp" />
<ClCompile Include="importproject.cpp" />
<ClCompile Include="infer.cpp" /> <ClCompile Include="infer.cpp" />
<ClCompile Include="library.cpp" /> <ClCompile Include="library.cpp" />
<ClCompile Include="mathlib.cpp" /> <ClCompile Include="mathlib.cpp" />
@ -88,8 +90,8 @@
<ClCompile Include="pathmatch.cpp" /> <ClCompile Include="pathmatch.cpp" />
<ClCompile Include="platform.cpp" /> <ClCompile Include="platform.cpp" />
<ClCompile Include="preprocessor.cpp" /> <ClCompile Include="preprocessor.cpp" />
<ClCompile Include="importproject.cpp" />
<ClCompile Include="programmemory.cpp" /> <ClCompile Include="programmemory.cpp" />
<ClCompile Include="reverseanalyzer.cpp" />
<ClCompile Include="settings.cpp" /> <ClCompile Include="settings.cpp" />
<ClCompile Include="summaries.cpp" /> <ClCompile Include="summaries.cpp" />
<ClCompile Include="suppressions.cpp" /> <ClCompile Include="suppressions.cpp" />
@ -101,10 +103,8 @@
<ClCompile Include="tokenlist.cpp" /> <ClCompile Include="tokenlist.cpp" />
<ClCompile Include="utils.cpp" /> <ClCompile Include="utils.cpp" />
<ClCompile Include="valueflow.cpp" /> <ClCompile Include="valueflow.cpp" />
<ClCompile Include="forwardanalyzer.cpp" />
<ClCompile Include="reverseanalyzer.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="..\externals\simplecpp\simplecpp.h" /> <ClInclude Include="..\externals\simplecpp\simplecpp.h" />
<ClInclude Include="..\externals\tinyxml2\tinyxml2.h" /> <ClInclude Include="..\externals\tinyxml2\tinyxml2.h" />
<ClInclude Include="analyzer.h" /> <ClInclude Include="analyzer.h" />
@ -120,9 +120,8 @@
<ClInclude Include="checkbufferoverrun.h" /> <ClInclude Include="checkbufferoverrun.h" />
<ClInclude Include="checkclass.h" /> <ClInclude Include="checkclass.h" />
<ClInclude Include="checkcondition.h" /> <ClInclude Include="checkcondition.h" />
<ClInclude Include="checkfunctions.h" />
<ClInclude Include="checkstring.h" />
<ClInclude Include="checkexceptionsafety.h" /> <ClInclude Include="checkexceptionsafety.h" />
<ClInclude Include="checkfunctions.h" />
<ClInclude Include="checkinternal.h" /> <ClInclude Include="checkinternal.h" />
<ClInclude Include="checkio.h" /> <ClInclude Include="checkio.h" />
<ClInclude Include="checkleakautovar.h" /> <ClInclude Include="checkleakautovar.h" />
@ -132,6 +131,7 @@
<ClInclude Include="checkpostfixoperator.h" /> <ClInclude Include="checkpostfixoperator.h" />
<ClInclude Include="checksizeof.h" /> <ClInclude Include="checksizeof.h" />
<ClInclude Include="checkstl.h" /> <ClInclude Include="checkstl.h" />
<ClInclude Include="checkstring.h" />
<ClInclude Include="checktype.h" /> <ClInclude Include="checktype.h" />
<ClInclude Include="checkuninitvar.h" /> <ClInclude Include="checkuninitvar.h" />
<ClInclude Include="checkunusedfunctions.h" /> <ClInclude Include="checkunusedfunctions.h" />
@ -144,8 +144,9 @@
<ClInclude Include="ctu.h" /> <ClInclude Include="ctu.h" />
<ClInclude Include="errorlogger.h" /> <ClInclude Include="errorlogger.h" />
<ClInclude Include="errortypes.h" /> <ClInclude Include="errortypes.h" />
<ClInclude Include="fwdanalysis.h" />
<ClInclude Include="forwardanalyzer.h" /> <ClInclude Include="forwardanalyzer.h" />
<ClInclude Include="fwdanalysis.h" />
<ClInclude Include="importproject.h" />
<ClInclude Include="infer.h" /> <ClInclude Include="infer.h" />
<ClInclude Include="library.h" /> <ClInclude Include="library.h" />
<ClInclude Include="mathlib.h" /> <ClInclude Include="mathlib.h" />
@ -155,7 +156,6 @@
<ClInclude Include="platform.h" /> <ClInclude Include="platform.h" />
<ClInclude Include="precompiled.h" /> <ClInclude Include="precompiled.h" />
<ClInclude Include="preprocessor.h" /> <ClInclude Include="preprocessor.h" />
<ClInclude Include="importproject.h" />
<ClInclude Include="programmemory.h" /> <ClInclude Include="programmemory.h" />
<ClInclude Include="reverseanalyzer.h" /> <ClInclude Include="reverseanalyzer.h" />
<ClInclude Include="settings.h" /> <ClInclude Include="settings.h" />

View File

@ -10,7 +10,7 @@
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="tokenize.cpp"> <ClCompile Include="tokenize.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -192,7 +192,7 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="checkbufferoverrun.h"> <ClInclude Include="checkbufferoverrun.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -3,8 +3,10 @@
include($$PWD/pcrerules.pri) include($$PWD/pcrerules.pri)
include($$PWD/../externals/externals.pri) include($$PWD/../externals/externals.pri)
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
HEADERS += $${PWD}/analyzerinfo.h \ HEADERS += $${PWD}/analyzer.h \
$${PWD}/analyzerinfo.h \
$${PWD}/astutils.h \ $${PWD}/astutils.h \
$${PWD}/calculate.h \
$${PWD}/check.h \ $${PWD}/check.h \
$${PWD}/check64bit.h \ $${PWD}/check64bit.h \
$${PWD}/checkassert.h \ $${PWD}/checkassert.h \
@ -33,6 +35,7 @@ HEADERS += $${PWD}/analyzerinfo.h \
$${PWD}/checkvaarg.h \ $${PWD}/checkvaarg.h \
$${PWD}/clangimport.h \ $${PWD}/clangimport.h \
$${PWD}/color.h \ $${PWD}/color.h \
$${PWD}/config.h \
$${PWD}/cppcheck.h \ $${PWD}/cppcheck.h \
$${PWD}/ctu.h \ $${PWD}/ctu.h \
$${PWD}/errorlogger.h \ $${PWD}/errorlogger.h \
@ -47,10 +50,13 @@ HEADERS += $${PWD}/analyzerinfo.h \
$${PWD}/pathanalysis.h \ $${PWD}/pathanalysis.h \
$${PWD}/pathmatch.h \ $${PWD}/pathmatch.h \
$${PWD}/platform.h \ $${PWD}/platform.h \
$${PWD}/precompiled.h \
$${PWD}/preprocessor.h \ $${PWD}/preprocessor.h \
$${PWD}/programmemory.h \ $${PWD}/programmemory.h \
$${PWD}/reverseanalyzer.h \ $${PWD}/reverseanalyzer.h \
$${PWD}/settings.h \ $${PWD}/settings.h \
$${PWD}/smallvector.h \
$${PWD}/standards.h \
$${PWD}/summaries.h \ $${PWD}/summaries.h \
$${PWD}/suppressions.h \ $${PWD}/suppressions.h \
$${PWD}/symboldatabase.h \ $${PWD}/symboldatabase.h \
@ -59,8 +65,11 @@ HEADERS += $${PWD}/analyzerinfo.h \
$${PWD}/token.h \ $${PWD}/token.h \
$${PWD}/tokenize.h \ $${PWD}/tokenize.h \
$${PWD}/tokenlist.h \ $${PWD}/tokenlist.h \
$${PWD}/tokenrange.h \
$${PWD}/utils.h \ $${PWD}/utils.h \
$${PWD}/valueflow.h $${PWD}/valueflow.h \
$${PWD}/valueptr.h \
$${PWD}/version.h
SOURCES += $${PWD}/analyzerinfo.cpp \ SOURCES += $${PWD}/analyzerinfo.cpp \
$${PWD}/astutils.cpp \ $${PWD}/astutils.cpp \

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
@ -23,15 +23,16 @@
<Project>{c183db5b-ad6c-423d-80ca-1f9549555a1a}</Project> <Project>{c183db5b-ad6c-423d-80ca-1f9549555a1a}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="..\cli\cmdlineparser.cpp" /> <ClCompile Include="..\cli\cmdlineparser.cpp" />
<ClCompile Include="..\cli\cppcheckexecutor.cpp" /> <ClCompile Include="..\cli\cppcheckexecutor.cpp" />
<ClCompile Include="..\cli\cppcheckexecutorseh.cpp" /> <ClCompile Include="..\cli\cppcheckexecutorseh.cpp" />
<ClCompile Include="..\cli\filelister.cpp" /> <ClCompile Include="..\cli\cppcheckexecutorsig.cpp" />
<ClCompile Include="..\cli\executor.cpp" /> <ClCompile Include="..\cli\executor.cpp" />
<ClCompile Include="..\cli\filelister.cpp" />
<ClCompile Include="..\cli\processexecutor.cpp" /> <ClCompile Include="..\cli\processexecutor.cpp" />
<ClCompile Include="..\cli\stacktrace.cpp" />
<ClCompile Include="..\cli\threadexecutor.cpp" /> <ClCompile Include="..\cli\threadexecutor.cpp" />
<ClCompile Include="..\lib\astutils.cpp" />
<ClCompile Include="options.cpp" /> <ClCompile Include="options.cpp" />
<ClCompile Include="test64bit.cpp" /> <ClCompile Include="test64bit.cpp" />
<ClCompile Include="testanalyzerinformation.cpp" /> <ClCompile Include="testanalyzerinformation.cpp" />
@ -51,6 +52,7 @@
<ClCompile Include="testerrorlogger.cpp" /> <ClCompile Include="testerrorlogger.cpp" />
<ClCompile Include="testexceptionsafety.cpp" /> <ClCompile Include="testexceptionsafety.cpp" />
<ClCompile Include="testfilelister.cpp" /> <ClCompile Include="testfilelister.cpp" />
<ClCompile Include="testfunctions.cpp" />
<ClCompile Include="testgarbage.cpp" /> <ClCompile Include="testgarbage.cpp" />
<ClCompile Include="testimportproject.cpp" /> <ClCompile Include="testimportproject.cpp" />
<ClCompile Include="testincompletestatement.cpp" /> <ClCompile Include="testincompletestatement.cpp" />
@ -61,7 +63,6 @@
<ClCompile Include="testmathlib.cpp" /> <ClCompile Include="testmathlib.cpp" />
<ClCompile Include="testmemleak.cpp" /> <ClCompile Include="testmemleak.cpp" />
<ClCompile Include="testnullpointer.cpp" /> <ClCompile Include="testnullpointer.cpp" />
<ClCompile Include="testfunctions.cpp" />
<ClCompile Include="testoptions.cpp" /> <ClCompile Include="testoptions.cpp" />
<ClCompile Include="testother.cpp" /> <ClCompile Include="testother.cpp" />
<ClCompile Include="testpath.cpp" /> <ClCompile Include="testpath.cpp" />
@ -80,10 +81,10 @@
<ClCompile Include="teststl.cpp" /> <ClCompile Include="teststl.cpp" />
<ClCompile Include="teststring.cpp" /> <ClCompile Include="teststring.cpp" />
<ClCompile Include="testsuite.cpp"> <ClCompile Include="testsuite.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="testsummaries.cpp" /> <ClCompile Include="testsummaries.cpp" />
<ClCompile Include="testsuppressions.cpp" /> <ClCompile Include="testsuppressions.cpp" />
@ -104,11 +105,16 @@
<ClCompile Include="testvalueflow.cpp" /> <ClCompile Include="testvalueflow.cpp" />
<ClCompile Include="testvarid.cpp" /> <ClCompile Include="testvarid.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="..\cli\cmdlineparser.h" /> <ClInclude Include="..\cli\cmdlineparser.h" />
<ClInclude Include="..\cli\cppcheckexecutor.h" />
<ClInclude Include="..\cli\cppcheckexecutorseh.h" />
<ClInclude Include="..\cli\cppcheckexecutorsig.h" />
<ClInclude Include="..\cli\executor.h" />
<ClInclude Include="..\cli\filelister.h" /> <ClInclude Include="..\cli\filelister.h" />
<ClInclude Include="..\cli\processexecutor.h" />
<ClInclude Include="..\cli\stacktrace.h" />
<ClInclude Include="..\cli\threadexecutor.h" /> <ClInclude Include="..\cli\threadexecutor.h" />
<ClInclude Include="..\lib\config.h" />
<ClInclude Include="options.h" /> <ClInclude Include="options.h" />
<ClInclude Include="precompiled.h" /> <ClInclude Include="precompiled.h" />
<ClInclude Include="redirect.h" /> <ClInclude Include="redirect.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Header Files"> <Filter Include="Header Files">
@ -18,7 +18,7 @@
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="SourceFiles">
<ClCompile Include="options.cpp"> <ClCompile Include="options.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -211,9 +211,6 @@
<ClCompile Include="testastutils.cpp"> <ClCompile Include="testastutils.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\lib\astutils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="testsimplifyusing.cpp"> <ClCompile Include="testsimplifyusing.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -230,7 +227,7 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Label="HeaderFiles">
<ClInclude Include="options.h"> <ClInclude Include="options.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -252,9 +249,6 @@
<ClInclude Include="..\cli\cmdlineparser.h"> <ClInclude Include="..\cli\cmdlineparser.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\lib\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="precompiled.h"> <ClInclude Include="precompiled.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -21,6 +21,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <fstream> // IWYU pragma: keep #include <fstream> // IWYU pragma: keep
#include <functional>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -157,6 +158,105 @@ static void makeConditionalVariable(std::ostream &os, const std::string &variabl
<< "\n"; << "\n";
} }
static int write_vcxproj(const std::string &proj_name, const std::function<void(std::string&)> &source_f, const std::function<void(std::string&)> &header_f)
{
std::string outstr;
{
// treat as binary to prevent inplicit line ending conversions
std::ifstream in(proj_name, std::ios::binary);
if (!in.is_open()) {
std::cerr << "Could not open " << proj_name << std::endl;
return EXIT_FAILURE;
}
std::string line;
bool in_itemgroup = false;
while (std::getline(in, line)) {
if (in_itemgroup) {
if (line.find("</ItemGroup>") == std::string::npos)
continue;
in_itemgroup = false;
}
// strip all remaining line endings
const std::string::size_type pos = line.find_last_not_of("\r\n");
if (pos != std::string::npos)
line.resize(pos+1, '\0');
outstr += line;
outstr += "\r\n";
if (line.find("<ItemGroup Label=\"SourceFiles\">") != std::string::npos) {
in_itemgroup = true;
source_f(outstr);
}
if (line.find("<ItemGroup Label=\"HeaderFiles\">") != std::string::npos) {
in_itemgroup = true;
header_f(outstr);
}
}
}
// strip trailing \r\n
{
const std::string::size_type pos = outstr.find_last_not_of("\r\n");
if (pos != std::string::npos)
outstr.resize(pos+1, '\0');
}
// treat as binary to prevent inplicit line ending conversions
std::ofstream out(proj_name, std::ios::binary|std::ios::trunc);
out << outstr;
return EXIT_SUCCESS;
}
enum ClType { Compile, Include, Precompile, PrecompileNoPCRE };
static std::string make_vcxproj_cl_entry(const std::string& file, ClType type)
{
std::string outstr;
if (type == Precompile || type == PrecompileNoPCRE) {
outstr += R"( <ClCompile Include=")";
outstr += file;
outstr += R"(">)";
outstr += "\r\n";
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>)";
outstr += "\r\n";
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>)";
outstr += "\r\n";
if (type == Precompile) {
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|Win32'">Create</PrecompiledHeader>)";
outstr += "\r\n";
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|Win32'">Create</PrecompiledHeader>)";
outstr += "\r\n";
}
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>)";
outstr += "\r\n";
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>)";
outstr += "\r\n";
if (type == Precompile) {
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|x64'">Create</PrecompiledHeader>)";
outstr += "\r\n";
outstr += R"( <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|x64'">Create</PrecompiledHeader>)";
outstr += "\r\n";
}
outstr += " </ClCompile>\r\n";
return outstr;
}
outstr += " <";
outstr += (type == Compile) ? "ClCompile" : "ClInclude";
outstr += R"( Include=")";
outstr += file;
outstr += R"(" />)";
outstr += "\r\n";
return outstr;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const bool release(argc >= 2 && std::string(argv[1]) == "--release"); const bool release(argc >= 2 && std::string(argv[1]) == "--release");
@ -202,6 +302,93 @@ int main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// TODO: add files without source via parsing
std::vector<std::string> libfiles_h;
for (const std::string &libfile : libfiles) {
std::string fname(libfile.substr(4));
fname.erase(fname.find(".cpp"));
libfiles_h.emplace_back(fname + ".h");
}
libfiles_h.emplace_back("analyzer.h");
libfiles_h.emplace_back("calculate.h");
libfiles_h.emplace_back("config.h");
libfiles_h.emplace_back("precompiled.h");
libfiles_h.emplace_back("smallvector.h");
libfiles_h.emplace_back("standards.h");
libfiles_h.emplace_back("tokenrange.h");
libfiles_h.emplace_back("valueptr.h");
libfiles_h.emplace_back("version.h");
std::sort(libfiles_h.begin(), libfiles_h.end());
std::vector<std::string> clifiles_h;
for (const std::string &clifile : clifiles) {
std::string fname(clifile.substr(4));
if (fname == "main.cpp")
continue;
fname.erase(fname.find(".cpp"));
clifiles_h.emplace_back(fname + ".h");
}
std::vector<std::string> testfiles_h;
testfiles_h.emplace_back("options.h");
testfiles_h.emplace_back("precompiled.h");
testfiles_h.emplace_back("redirect.h");
testfiles_h.emplace_back("testsuite.h");
testfiles_h.emplace_back("testutils.h");
std::sort(testfiles_h.begin(), testfiles_h.end());
// TODO: write filter files
// Visual Studio projects
write_vcxproj("cli/cli.vcxproj", [&](std::string &outstr){
for (const std::string &clifile: clifiles) {
outstr += make_vcxproj_cl_entry(clifile.substr(4), Compile);
}
}, [&](std::string &outstr){
for (const std::string &clifile_h: clifiles_h) {
outstr += make_vcxproj_cl_entry(clifile_h, Include);
}
});
write_vcxproj("lib/cppcheck.vcxproj", [&](std::string &outstr){
outstr += make_vcxproj_cl_entry(R"(..\externals\simplecpp\simplecpp.cpp)", Compile);
outstr += make_vcxproj_cl_entry(R"(..\externals\tinyxml2\tinyxml2.cpp)", Compile);
for (const std::string &libfile: libfiles) {
const std::string l = libfile.substr(4);
outstr += make_vcxproj_cl_entry(l, l == "check.cpp" ? Precompile : Compile);
}
}, [&](std::string &outstr){
outstr += make_vcxproj_cl_entry(R"(..\externals\simplecpp\simplecpp.h)", Include);
outstr += make_vcxproj_cl_entry(R"(..\externals\tinyxml2\tinyxml2.h)", Include);
for (const std::string &libfile_h: libfiles_h) {
outstr += make_vcxproj_cl_entry(libfile_h, Include);
}
});
write_vcxproj("test/testrunner.vcxproj", [&](std::string &outstr){
for (const std::string &clifile: clifiles) {
if (clifile == "cli/main.cpp")
continue;
const std::string c = R"(..\cli\)" + clifile.substr(4);
outstr += make_vcxproj_cl_entry(c, Compile);
}
for (const std::string &testfile: testfiles) {
const std::string t = testfile.substr(5);
outstr += make_vcxproj_cl_entry(t, t == "testsuite.cpp" ? PrecompileNoPCRE : Compile);
}
}, [&](std::string &outstr){
for (const std::string &clifile_h: clifiles_h) {
const std::string c = R"(..\cli\)" + clifile_h;
outstr += make_vcxproj_cl_entry(c, Include);
}
for (const std::string &testfile_h: testfiles_h) {
outstr += make_vcxproj_cl_entry(testfile_h, Include);
}
});
// QMAKE - lib/lib.pri // QMAKE - lib/lib.pri
{ {
std::ofstream fout1("lib/lib.pri"); std::ofstream fout1("lib/lib.pri");
@ -211,13 +398,9 @@ int main(int argc, char **argv)
fout1 << "include($$PWD/../externals/externals.pri)\n"; fout1 << "include($$PWD/../externals/externals.pri)\n";
fout1 << "INCLUDEPATH += $$PWD\n"; fout1 << "INCLUDEPATH += $$PWD\n";
fout1 << "HEADERS += "; fout1 << "HEADERS += ";
for (const std::string &libfile : libfiles) { for (const std::string &libfile_h : libfiles_h) {
std::string fname(libfile.substr(4)); fout1 << "$${PWD}/" << libfile_h;
if (fname.find(".cpp") == std::string::npos) if (libfile_h != libfiles_h.back())
continue; // shouldn't happen
fname.erase(fname.find(".cpp"));
fout1 << "$${PWD}/" << fname << ".h";
if (libfile != libfiles.back())
fout1 << " \\\n" << std::string(11, ' '); fout1 << " \\\n" << std::string(11, ' ');
} }
fout1 << "\n\nSOURCES += "; fout1 << "\n\nSOURCES += ";

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug|Win32.ActiveCfg = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Debug|Win32.Build.0 = Debug|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release|Win32.ActiveCfg = Release|Win32
{19EC86CD-0004-4917-B852-E6BD110B6E6F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C0A1D1C-BDE8-453D-9FB3-EC4DEB9BC733}
EndGlobalSection
EndGlobal