aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-02-07 17:56:58 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-02-07 18:54:33 -0600
commitbee6a20d1c7d807b5023d932ae179db1bc9a0f80 (patch)
tree855c28ed77f81d8212d1a9ecf67253c97190935a
parent69567aaa95f41812a49afa7454b69a3d79c5010d (diff)
downloadwix-bee6a20d1c7d807b5023d932ae179db1bc9a0f80.tar.gz
wix-bee6a20d1c7d807b5023d932ae179db1bc9a0f80.tar.bz2
wix-bee6a20d1c7d807b5023d932ae179db1bc9a0f80.zip
Ignore enum CA warnings and scope the osutil deprecation suppression.
Also, fix project reference so the .vcx project system understands it.
-rw-r--r--src/Cpp.Build.props4
-rw-r--r--src/CustomizedNativeRecommendedRules.ruleset8
-rw-r--r--src/dutil/dutil.vcxproj5
-rw-r--r--src/dutil/osutil.cpp7
-rw-r--r--src/test/DUtilUnitTest/DUtilUnitTest.vcxproj4
5 files changed, 23 insertions, 5 deletions
diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props
index 44a042c7..fb805b42 100644
--- a/src/Cpp.Build.props
+++ b/src/Cpp.Build.props
@@ -12,6 +12,10 @@
12 <WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion> 12 <WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>
13 </PropertyGroup> 13 </PropertyGroup>
14 14
15 <PropertyGroup>
16 <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CustomizedNativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
17 </PropertyGroup>
18
15 <ItemDefinitionGroup> 19 <ItemDefinitionGroup>
16 <ClCompile> 20 <ClCompile>
17 <DisableSpecificWarnings>$(DisableSpecificCompilerWarnings)</DisableSpecificWarnings> 21 <DisableSpecificWarnings>$(DisableSpecificCompilerWarnings)</DisableSpecificWarnings>
diff --git a/src/CustomizedNativeRecommendedRules.ruleset b/src/CustomizedNativeRecommendedRules.ruleset
new file mode 100644
index 00000000..142b141c
--- /dev/null
+++ b/src/CustomizedNativeRecommendedRules.ruleset
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="utf-8"?>
2<RuleSet Name="Customized Microsoft Native Recommended Rules" Description="Microsoft Native Recommended Rules, -C26812" ToolsVersion="16.0">
3 <Include Path="nativerecommendedrules.ruleset" Action="Default" />
4 <Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
5 <!-- We need C style enums since we support BAs written in C -->
6 <Rule Id="C26812" Action="None" />
7 </Rules>
8</RuleSet> \ No newline at end of file
diff --git a/src/dutil/dutil.vcxproj b/src/dutil/dutil.vcxproj
index 2cf99d13..b84fd80f 100644
--- a/src/dutil/dutil.vcxproj
+++ b/src/dutil/dutil.vcxproj
@@ -83,10 +83,7 @@
83 <ClCompile Include="memutil.cpp" /> 83 <ClCompile Include="memutil.cpp" />
84 <ClCompile Include="metautil.cpp" /> 84 <ClCompile Include="metautil.cpp" />
85 <ClCompile Include="monutil.cpp" /> 85 <ClCompile Include="monutil.cpp" />
86 <ClCompile Include="osutil.cpp"> 86 <ClCompile Include="osutil.cpp" />
87 <!-- turn off deprecation warning -->
88 <DisableSpecificWarnings>4996</DisableSpecificWarnings>
89 </ClCompile>
90 <ClCompile Include="path2utl.cpp" /> 87 <ClCompile Include="path2utl.cpp" />
91 <ClCompile Include="pathutil.cpp" /> 88 <ClCompile Include="pathutil.cpp" />
92 <ClCompile Include="perfutil.cpp" /> 89 <ClCompile Include="perfutil.cpp" />
diff --git a/src/dutil/osutil.cpp b/src/dutil/osutil.cpp
index 38b32eb3..8834cd30 100644
--- a/src/dutil/osutil.cpp
+++ b/src/dutil/osutil.cpp
@@ -22,7 +22,14 @@ extern "C" void DAPI OsGetVersion(
22 if (OS_VERSION_UNKNOWN == vOsVersion) 22 if (OS_VERSION_UNKNOWN == vOsVersion)
23 { 23 {
24 ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); 24 ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
25
26#pragma warning (push)
27#pragma warning(suppress: 4996) // deprecated
28#pragma warning (push)
29#pragma warning(suppress: 28159)// deprecated, use other function instead
25 ::GetVersionExW(reinterpret_cast<OSVERSIONINFOW*>(&ovi)); // only fails if version info size is set incorrectly. 30 ::GetVersionExW(reinterpret_cast<OSVERSIONINFOW*>(&ovi)); // only fails if version info size is set incorrectly.
31#pragma warning (pop)
32#pragma warning (pop)
26 33
27 vdwOsServicePack = static_cast<DWORD>(ovi.wServicePackMajor) << 16 | ovi.wServicePackMinor; 34 vdwOsServicePack = static_cast<DWORD>(ovi.wServicePackMajor) << 16 | ovi.wServicePackMinor;
28 if (4 == ovi.dwMajorVersion) 35 if (4 == ovi.dwMajorVersion)
diff --git a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
index e1164aca..942c39f0 100644
--- a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
+++ b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
@@ -70,7 +70,9 @@
70 </Reference> 70 </Reference>
71 </ItemGroup> 71 </ItemGroup>
72 <ItemGroup> 72 <ItemGroup>
73 <ProjectReference Include="..\..\dutil\dutil.vcxproj" /> 73 <ProjectReference Include="..\..\dutil\dutil.vcxproj">
74 <Project>{1244E671-F108-4334-BA52-8A7517F26ECD}</Project>
75 </ProjectReference>
74 </ItemGroup> 76 </ItemGroup>
75 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 77 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
76 <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets')" /> 78 <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets')" />