From 5a1d284615a39bbb8bd420a7802c839e969a0baa Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sun, 13 Mar 2022 15:13:45 -0700 Subject: [PATCH] A few minor improvements when building with C++17 --- DirectXTex/BC6HBC7.cpp | 4 ++++ DirectXTex/DirectXTexConvert.cpp | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/DirectXTex/BC6HBC7.cpp b/DirectXTex/BC6HBC7.cpp index 37ff900..f87dc63 100644 --- a/DirectXTex/BC6HBC7.cpp +++ b/DirectXTex/BC6HBC7.cpp @@ -1195,7 +1195,11 @@ namespace // Find Min and Max points, as starting point HDRColorA X, Y; +#if (__cplusplus >= 201703L) + if constexpr (ishdr) +#else if (ishdr) +#endif { X = HDRColorA{ FLT_MAX, FLT_MAX, FLT_MAX, 0.0f }; Y = HDRColorA{ -FLT_MAX, -FLT_MAX, -FLT_MAX, 0.0f }; diff --git a/DirectXTex/DirectXTexConvert.cpp b/DirectXTex/DirectXTexConvert.cpp index e75b8c4..3660177 100644 --- a/DirectXTex/DirectXTexConvert.cpp +++ b/DirectXTex/DirectXTexConvert.cpp @@ -3263,10 +3263,11 @@ void DirectX::Internal::ConvertScanline( break; } -#ifdef _MSC_VER +#if (__cplusplus >= 201703L) + [[fallthrough]]; +#elif defined(_MSC_VER) __fallthrough; -#endif -#ifdef __clang__ +#elif defined(__clang__) [[clang::fallthrough]]; #endif @@ -3552,10 +3553,11 @@ void DirectX::Internal::ConvertScanline( break; } -#ifdef _MSC_VER +#if (__cplusplus >= 201703L) + [[fallthrough]]; +#elif defined(_MSC_VER) __fallthrough; -#endif -#ifdef __clang__ +#elif defined(__clang__) [[clang::fallthrough]]; #endif @@ -3650,10 +3652,11 @@ void DirectX::Internal::ConvertScanline( break; } -#ifdef _MSC_VER +#if (__cplusplus >= 201703L) + [[fallthrough]]; +#elif defined(_MSC_VER) __fallthrough; -#endif -#ifdef __clang__ +#elif defined(__clang__) [[clang::fallthrough]]; #endif