ICU-20200 Treat select warnings as errors in the ICU4C library code (with MSVC).
authorJeff Genovy <jefgen@microsoft.com>
Tue, 22 Jan 2019 21:45:01 +0000 (13:45 -0800)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Fri, 25 Jan 2019 23:58:18 +0000 (15:58 -0800)
icu4c/source/allinone/Build.Windows.Library.ProjectConfiguration.props
icu4c/source/allinone/Build.Windows.Library.WarningSettings.ProjectConfiguration.props [new file with mode: 0644]
icu4c/source/allinone/Build.Windows.PlatformToolset.props

index 07e3c1bf512295a71f3aee6684523e693d58196d..5ca5ee58e2134e41c3de36f884bb59d05db19efc 100644 (file)
@@ -12,9 +12,6 @@
       </PreprocessorDefinitions>
     </ClCompile>
   </ItemDefinitionGroup>
-  <PropertyGroup>
-    <!-- Disable MSBuild warning about Linker OutputFile. -->
-    <!-- Ex: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. -->
-    <MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
-  </PropertyGroup>
+  <!-- The following import will set various settings for compiler Warnings and Errors. -->
+  <Import Project="Build.Windows.Library.WarningSettings.ProjectConfiguration.props" />
 </Project>
diff --git a/icu4c/source/allinone/Build.Windows.Library.WarningSettings.ProjectConfiguration.props b/icu4c/source/allinone/Build.Windows.Library.WarningSettings.ProjectConfiguration.props
new file mode 100644 (file)
index 0000000..d1b7f70
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!-- This file is used to set compiler Warning configurations that are common to *all* ICU library code (common, i18n, and io). -->
+  <!-- Note: These options are for *all* configurations for *all* library projects.  -->
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <!--
+        We treat the following Warnings as Errors in the ICU library code, in order to catch/prevent
+        issues like ICU-20209, ICU-20157, ICU-13816 and others.
+
+          C4251 Need to DLL-Export template instantiations.
+          C4661 No suitable definition provided for explicit template instantiation request.
+          C4715 Not all control paths return a value.
+          C4706 Assignment within conditional expression.
+          C4005 Macro redifintion.
+          C4068 Unknown pragma.
+          C4267 Conversion from size_t to type, possible loss of data.
+      -->
+      <TreatSpecificWarningsAsErrors>4251;4661;4715;4706;4005;4068;4267;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  
+  <PropertyGroup>
+    <!-- Disable MSBuild warning about Linker OutputFile. -->
+    <!-- Ex: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. -->
+    <MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
+  </PropertyGroup>
+</Project>
index b4777679b80aa9c0b151e07b5cf3d3279a4759ab..778ee2676d0f9e54b348370a90e6b43d8cf9a318 100644 (file)
@@ -18,9 +18,4 @@
   <PropertyGroup Label="PlatformToolset">
     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup>
-    <!-- Disable MSBuild warning about Linker OutputFile. -->
-    <!-- Ex: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. -->
-    <MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
-  </PropertyGroup>
 </Project>