Enable code analysis and resolve reported warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-06-14 13:08:03 +02:00
parent c1ce01ddad
commit af4b898688
3 changed files with 22 additions and 11 deletions

View File

@ -39,11 +39,10 @@ using namespace std;
/// Main program body
///
int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
)
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hInstance );
UNREFERENCED_PARAMETER(hPrevInstance);

View File

@ -49,7 +49,7 @@ struct LocalFree_delete<_Ty[]>
///
/// Frees memory
///
inline void operator()(_Ty *_Ptr) const
inline void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept
{
LocalFree(_Ptr);
}
@ -80,7 +80,7 @@ public:
///
/// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx)
///
inline com_initializer(_In_opt_ LPVOID pvReserved)
inline com_initializer(_In_opt_ LPVOID pvReserved) noexcept
{
m_result = CoInitialize(pvReserved);
}
@ -91,7 +91,7 @@ public:
///
/// \sa [CoInitializeEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279.aspx)
///
inline com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit)
inline com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept
{
m_result = CoInitializeEx(pvReserved, dwCoInit);
}
@ -114,7 +114,7 @@ public:
///
/// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx)
///
inline HRESULT status() const
inline HRESULT status() const noexcept
{
return m_result;
}
@ -136,7 +136,7 @@ struct WlanCloseHandle_delete
///
/// \sa [WlanCloseHandle function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms706610.aspx)
///
inline void operator()(void *_Ptr) const
inline void operator()(void *_Ptr) const noexcept
{
WlanCloseHandle(_Ptr, NULL);
}
@ -154,7 +154,7 @@ struct WlanFreeMemory_delete
///
/// \sa [WlanFreeMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms706722.aspx)
///
void operator()(_Ty *_Ptr) const
void operator()(_Ty *_Ptr) const noexcept
{
WlanFreeMemory(_Ptr);
}

View File

@ -70,24 +70,33 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -98,6 +107,7 @@
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -108,6 +118,7 @@
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -120,6 +131,7 @@
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>