Skip to content

Commit

Permalink
Visual Studio solution:
Browse files Browse the repository at this point in the history
- Fixed include paths
- Export simplecpp to cppcheck-core.dll
- Added /Zc:rvalueCast
  • Loading branch information
PKEuS committed Jul 21, 2016
1 parent 9930784 commit 12e3cf5
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 46 deletions.
24 changes: 16 additions & 8 deletions cli/cli.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BrowseInformation>false</BrowseInformation>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand All @@ -165,6 +165,7 @@
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;4482;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -178,7 +179,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BrowseInformation>false</BrowseInformation>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand All @@ -189,6 +190,7 @@
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;4482;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -201,7 +203,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -211,6 +213,7 @@
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;4482;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -222,7 +225,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -232,6 +235,7 @@
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;4482;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -243,7 +247,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -260,6 +264,7 @@
</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/Zc:inline /Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -275,7 +280,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;TIXML_USE_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -292,6 +297,7 @@
</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/Zc:inline /Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -307,7 +313,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -325,6 +331,7 @@
</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/Zc:inline /Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -339,7 +346,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\lib;..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\lib;..\externals\..\externals\simplecpp;..\externals\tinyxml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -357,6 +364,7 @@
</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/Zc:inline /Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand Down
6 changes: 4 additions & 2 deletions cppcheck.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio Express 2013 for Windows Desktop
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cli", "cli\cli.vcxproj", "{35CBDF51-2456-3EC3-99ED-113C30858883}"
ProjectSection(ProjectDependencies) = postProject
{C183DB5B-AD6C-423D-80CA-1F9549555A1A} = {C183DB5B-AD6C-423D-80CA-1F9549555A1A}
Expand Down
30 changes: 22 additions & 8 deletions externals/simplecpp/simplecpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@
#include <string>
#include <vector>


#ifdef _WIN32
# ifdef SIMPLECPP_EXPORT
# define SIMPLECPP_LIB __declspec(dllexport)
# elif defined(SIMPLECPP_IMPORT)
# define SIMPLECPP_LIB __declspec(dllimport)
# else
# define SIMPLECPP_LIB
# endif
#else
# define SIMPLECPP_LIB
#endif


namespace simplecpp {

typedef std::string TokenString;

/**
* Location in source code
*/
class Location {
class SIMPLECPP_LIB Location {
public:
Location(const std::vector<std::string> &f) : files(f), fileIndex(0), line(1U), col(0U) {}

Expand Down Expand Up @@ -76,7 +90,7 @@ class Location {
* token class.
* @todo don't use std::string representation - for both memory and performance reasons
*/
class Token {
class SIMPLECPP_LIB Token {
public:
Token(const TokenString &s, const Location &loc) :
str(string), location(loc), previous(NULL), next(NULL), string(s)
Expand Down Expand Up @@ -134,7 +148,7 @@ class Token {
};

/** Output from preprocessor */
struct Output {
struct SIMPLECPP_LIB Output {
Output(const std::vector<std::string> &files) : type(ERROR), location(files) {}
enum Type {
ERROR, /* #error */
Expand All @@ -148,7 +162,7 @@ struct Output {
typedef std::list<struct Output> OutputList;

/** List of tokens. */
class TokenList {
class SIMPLECPP_LIB TokenList {
public:
TokenList(std::vector<std::string> &filenames);
TokenList(std::istream &istr, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = 0);
Expand Down Expand Up @@ -228,20 +242,20 @@ class TokenList {
};

/** Tracking how macros are used */
struct MacroUsage {
struct SIMPLECPP_LIB MacroUsage {
MacroUsage(const std::vector<std::string> &f) : macroLocation(f), useLocation(f) {}
std::string macroName;
Location macroLocation;
Location useLocation;
};

struct DUI {
struct SIMPLECPP_LIB DUI {
std::list<std::string> defines;
std::set<std::string> undefined;
std::list<std::string> includePaths;
};

std::map<std::string, TokenList*> load(const TokenList &rawtokens, std::vector<std::string> &filenames, const struct DUI &dui, OutputList *outputList = 0);
SIMPLECPP_LIB std::map<std::string, TokenList*> load(const TokenList &rawtokens, std::vector<std::string> &filenames, const struct DUI &dui, OutputList *outputList = 0);

/**
* Preprocess
Expand All @@ -257,7 +271,7 @@ std::map<std::string, TokenList*> load(const TokenList &rawtokens, std::vector<s
*
* @todo simplify interface
*/
void preprocess(TokenList &output, const TokenList &rawtokens, std::vector<std::string> &files, const std::map<std::string, TokenList*> &filedata, const struct DUI &dui, OutputList *outputList = 0, std::list<struct MacroUsage> *macroUsage = 0);
SIMPLECPP_LIB void preprocess(TokenList &output, const TokenList &rawtokens, std::vector<std::string> &files, const std::map<std::string, TokenList*> &filedata, const struct DUI &dui, OutputList *outputList = 0, std::list<struct MacroUsage> *macroUsage = 0);
}

#endif
Loading

0 comments on commit 12e3cf5

Please sign in to comment.