From 09fc5fe957366de648c807324262eda48d9e8542 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 3 Jun 2020 14:12:14 -0700 Subject: [PATCH] Suppress some additional warnings for VS 2019 (16.7) Preview --- CMakeLists.txt | 2 +- CMakeSettings.json | 14 +++++++++++++- DirectXTex/BC4BC5.cpp | 16 ++++++++-------- DirectXTex/DirectXTexP.h | 3 ++- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f8b324..dc6ceac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(texconv PRIVATE /openmp /Zc:twoPhase-) endif() - set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") + set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd5219") target_compile_options(texassemble PRIVATE ${WarningsEXE}) target_compile_options(texconv PRIVATE ${WarningsEXE}) target_compile_options(texdiag PRIVATE ${WarningsEXE}) diff --git a/CMakeSettings.json b/CMakeSettings.json index 58fc3c8..323627d 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,4 +1,4 @@ -{ +{ "configurations": [ { "name": "x86-Clang-Debug", @@ -47,6 +47,18 @@ "ctestCommandArgs": "", "inheritEnvironments": [ "clang_cl_x64" ], "variables": [] + }, + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] } ] } \ No newline at end of file diff --git a/DirectXTex/BC4BC5.cpp b/DirectXTex/BC4BC5.cpp index f7acac7..c3afdc9 100644 --- a/DirectXTex/BC4BC5.cpp +++ b/DirectXTex/BC4BC5.cpp @@ -47,11 +47,11 @@ namespace float DecodeFromIndex(size_t uIndex) const noexcept { if (uIndex == 0) - return red_0 / 255.0f; + return float(red_0) / 255.0f; if (uIndex == 1) - return red_1 / 255.0f; - float fred_0 = red_0 / 255.0f; - float fred_1 = red_1 / 255.0f; + return float(red_1) / 255.0f; + float fred_0 = float(red_0) / 255.0f; + float fred_1 = float(red_1) / 255.0f; if (red_0 > red_1) { uIndex -= 1; @@ -106,11 +106,11 @@ namespace int8_t sred_1 = (red_1 == -128) ? -127 : red_1; if (uIndex == 0) - return sred_0 / 127.0f; + return float(sred_0) / 127.0f; if (uIndex == 1) - return sred_1 / 127.0f; - float fred_0 = sred_0 / 127.0f; - float fred_1 = sred_1 / 127.0f; + return float(sred_1) / 127.0f; + float fred_0 = float(sred_0) / 127.0f; + float fred_1 = float(sred_1) / 127.0f; if (red_0 > red_1) { uIndex -= 1; diff --git a/DirectXTex/DirectXTexP.h b/DirectXTex/DirectXTexP.h index da1a816..adbc635 100644 --- a/DirectXTex/DirectXTexP.h +++ b/DirectXTex/DirectXTexP.h @@ -12,7 +12,7 @@ #pragma once // Off by default warnings -#pragma warning(disable : 4619 4616 4061 4265 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4774 4820 4987 5026 5027 5031 5032 5039 5045 26812) +#pragma warning(disable : 4619 4616 4061 4265 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4774 4820 4987 5026 5027 5031 5032 5039 5045 5219 26812) // C4619/4616 #pragma warning warnings // C4061 enumerator 'X' in switch of enum 'X' is not explicitly handled by a case label // C4265 class has virtual functions, but destructor is not virtual @@ -34,6 +34,7 @@ // C5031/5032 push/pop mismatches in windows headers // C5039 pointer or reference to potentially throwing function passed to extern C function under - EHc // C5045 Spectre mitigation warning +// C5219 implicit conversion from 'int' to 'float', possible loss of data // 26812: The enum type 'x' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). // Windows 8.1 SDK related Off by default warnings