From 7ddd98de0a0d2b1b444858f1f6575f927e4c82db Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Mon, 3 Apr 2023 20:14:01 +0200 Subject: [PATCH] Fix warnings in til for an upcoming version of MSVC (#15087) A trivial change. :) --- src/inc/til/color.h | 3 ++- src/inc/til/small_vector.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/inc/til/color.h b/src/inc/til/color.h index e90ca88efce..cfeee352288 100644 --- a/src/inc/til/color.h +++ b/src/inc/til/color.h @@ -9,7 +9,8 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" // a number of other color types. #pragma warning(push) // we can't depend on GSL here, so we use static_cast for explicit narrowing -#pragma warning(disable : 26472) +#pragma warning(disable : 26472) // Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1). +#pragma warning(disable : 26495) // Variable 'til::color::::abgr' is uninitialized. Always initialize a member variable (type.6). struct color { // Clang (10) has no trouble optimizing the COLORREF conversion operator, below, to a diff --git a/src/inc/til/small_vector.h b/src/inc/til/small_vector.h index 127795e131d..4a1fe4eab90 100644 --- a/src/inc/til/small_vector.h +++ b/src/inc/til/small_vector.h @@ -16,6 +16,8 @@ #pragma warning(disable : 26459) // You called an STL function '...' with a raw pointer parameter at position '...' that may be unsafe ... (stl.1). // small_vector::_data references potentially uninitialized data and so we can't pass it regular iterators which reference initialized data. #pragma warning(disable : 26481) // Don't use pointer arithmetic. Use span instead (bounds.1). +// small_vector::_buffer is explicitly uninitialized, because we manage its initialization manually. +#pragma warning(disable : 26495) // Variable '...' is uninitialized. Always initialize a member variable (type.6). namespace til {