Enable more compiler warnings and treat them as errors.

This commit is contained in:
Brian Phlipot
2022-11-08 06:59:56 -07:00
committed by teejusb
parent f8f6f12999
commit 4a6b1a743c
141 changed files with 625 additions and 757 deletions
+13 -6
View File
@@ -53,7 +53,17 @@ int FindClosestEntry( T value, const U *mapping, unsigned cnt )
for( unsigned i = 0; i < cnt; ++i )
{
const U val = mapping[i];
// Need to use if constexpr here so the compiler doesn't even
// attempt to parse the else branch for enums
const T val = [&]{
if constexpr (std::is_enum<U>::value) {
return Enum::to_integral(mapping[i]);
}
else {
return mapping[i];
}
}();
float dist = value < val? (float)(val-value):(float)(value-val);
if( have_best && best_dist < dist )
continue;
@@ -64,10 +74,7 @@ int FindClosestEntry( T value, const U *mapping, unsigned cnt )
iBestIndex = i;
}
if( have_best )
return iBestIndex;
else
return 0;
return iBestIndex;
}
template <class T>
@@ -845,7 +852,7 @@ static void InitializeConfOptions()
ADD(ConfOption("CustomSongsMaxCount", CustomSongsCount, "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "1000"));
ADD(ConfOption("CustomSongsLoadTimeout", CustomSongsLoadTimeout, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
ADD(ConfOption("CustomSongsMaxSeconds", CustomSongsMaxSeconds, "60", "90", "120", "150", "180", "210", "240", "10000"));
ADD(ConfOption("CustomSongsMaxMegabytes", CustomSongsLoadTimeout, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
ADD(ConfOption("CustomSongsMaxMegabytes", CustomSongsMaxMegabytes, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
// Machine options
ADD( ConfOption( "MenuTimer", MovePref<bool>, "Off","On" ) );