Some cleanups to Visual Studio project for warnings.

Disable all warnings from httplib.h, since we don't control that code.
Fix a few warnings recommended by VS, and disable the rest.
This commit is contained in:
Stephen Anthony 2021-12-18 18:26:10 -03:30
parent d901b987aa
commit c6c9cc957e
6 changed files with 40 additions and 21 deletions

View File

@ -135,7 +135,7 @@ namespace BSPF
#endif #endif
// Get next power of two greater than or equal to the given value // Get next power of two greater than or equal to the given value
inline size_t nextPowerOfTwo(size_t size) { inline constexpr size_t nextPowerOfTwo(size_t size) {
if(size < 2) return 1; if(size < 2) return 1;
size_t power2 = 1; size_t power2 = 1;
while(power2 < size) while(power2 < size)
@ -145,7 +145,7 @@ namespace BSPF
// Get next multiple of the given value // Get next multiple of the given value
// Note that this only works when multiple is a power of two // Note that this only works when multiple is a power of two
inline size_t nextMultipleOf(size_t size, size_t multiple) { inline constexpr size_t nextMultipleOf(size_t size, size_t multiple) {
return (size + multiple - 1) & ~(multiple - 1); return (size + multiple - 1) & ~(multiple - 1);
} }
@ -244,7 +244,7 @@ namespace BSPF
{ {
auto pos = std::search(s1.cbegin()+startpos, s1.cend(), auto pos = std::search(s1.cbegin()+startpos, s1.cend(),
s2.cbegin(), s2.cend(), [](char ch1, char ch2) { s2.cbegin(), s2.cend(), [](char ch1, char ch2) {
return toupper(uInt8(ch1)) == toupper(uInt8(ch2)); return toupper(static_cast<uInt8>(ch1)) == toupper(static_cast<uInt8>(ch2));
}); });
return pos == s1.cend() ? string::npos : pos - (s1.cbegin()+startpos); return pos == s1.cend() ? string::npos : pos - (s1.cbegin()+startpos);
} }
@ -265,7 +265,7 @@ namespace BSPF
size_t pos = 1; size_t pos = 1;
for(uInt32 j = 1; j < s2.size(); ++j) for(uInt32 j = 1; j < s2.size(); ++j)
{ {
size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos); const size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos);
if(found == string::npos) if(found == string::npos)
return false; return false;
pos += found + 1; pos += found + 1;
@ -282,7 +282,7 @@ namespace BSPF
inline bool matchesCamelCase(const string_view s1, const string_view s2) inline bool matchesCamelCase(const string_view s1, const string_view s2)
{ {
// skip leading '_' for matching // skip leading '_' for matching
uInt32 ofs = (s1[0] == '_' && s2[0] == '_') ? 1 : 0; const uInt32 ofs = (s1[0] == '_' && s2[0] == '_') ? 1 : 0;
if(startsWithIgnoreCase(s1.substr(ofs), s2.substr(ofs, 1))) if(startsWithIgnoreCase(s1.substr(ofs), s2.substr(ofs, 1)))
{ {
@ -292,7 +292,7 @@ namespace BSPF
{ {
if(std::isupper(s2[j])) if(std::isupper(s2[j]))
{ {
size_t found = s1.find_first_of(s2[j], pos + ofs); const size_t found = s1.find_first_of(s2[j], pos + ofs);
if(found == string::npos) if(found == string::npos)
return false; return false;
@ -306,7 +306,7 @@ namespace BSPF
} }
else else
{ {
size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos + ofs); const size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos + ofs);
if(found == string::npos) if(found == string::npos)
return false; return false;
@ -335,7 +335,7 @@ namespace BSPF
// Trim leading and trailing whitespace from a string // Trim leading and trailing whitespace from a string
inline string trim(const string& str) inline string trim(const string& str)
{ {
string::size_type first = str.find_first_not_of(' '); const string::size_type first = str.find_first_not_of(' ');
return (first == string::npos) ? EmptyString : return (first == string::npos) ? EmptyString :
str.substr(first, str.find_last_not_of(' ')-first+1); str.substr(first, str.find_last_not_of(' ')-first+1);
} }

View File

@ -152,7 +152,7 @@ class PlusROM : public Serializable
string myPath; string myPath;
std::array<uInt8, 256> myRxBuffer, myTxBuffer; std::array<uInt8, 256> myRxBuffer, myTxBuffer;
uInt8 myRxReadPos, myRxWritePos, myTxPos; uInt8 myRxReadPos{0}, myRxWritePos{0}, myTxPos{0};
std::deque<shared_ptr<PlusROMRequest>> myPendingRequests; std::deque<shared_ptr<PlusROMRequest>> myPendingRequests;

View File

@ -22,11 +22,15 @@
* We can't control the quality of code from outside projects, so for now * We can't control the quality of code from outside projects, so for now
* just disable warnings for it. * just disable warnings for it.
*/ */
#ifdef __clang__ #if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything" #pragma clang diagnostic ignored "-Weverything"
#include "httplib.h" #include "httplib.h"
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(BSPF_WINDOWS)
#pragma warning(push, 0)
#include "httplib.h"
#pragma warning(pop)
#else #else
#include "httplib.h" #include "httplib.h"
#endif #endif

View File

@ -24,11 +24,15 @@
* We can't control the quality of code from outside projects, so for now * We can't control the quality of code from outside projects, so for now
* just disable warnings for it. * just disable warnings for it.
*/ */
#ifdef __clang__ #if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything" #pragma clang diagnostic ignored "-Weverything"
#include "source/sqlite3.h" #include "source/sqlite3.h"
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(BSPF_WINDOWS)
#pragma warning(push, 0)
#include "source/sqlite3.h"
#pragma warning(pop)
#else #else
#include "source/sqlite3.h" #include "source/sqlite3.h"
#endif #endif

View File

@ -262,7 +262,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -296,7 +296,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -332,7 +332,7 @@
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName> <ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -368,7 +368,7 @@
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName> <ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -402,7 +402,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -437,7 +437,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -472,7 +472,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -510,7 +510,7 @@
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName> <ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -549,7 +549,7 @@
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName> <ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput> <AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -588,7 +588,7 @@
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName> <ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4100;4127;4146;4244;26440;26446;26472;26455;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>All</AssemblerOutput> <AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)asm\windows\%(RelativeDir)</AssemblerListingLocation>
@ -2144,6 +2144,8 @@
<ClInclude Include="..\gui\ToolTip.hxx" /> <ClInclude Include="..\gui\ToolTip.hxx" />
<ClInclude Include="..\gui\UndoHandler.hxx" /> <ClInclude Include="..\gui\UndoHandler.hxx" />
<ClInclude Include="..\gui\WhatsNewDialog.hxx" /> <ClInclude Include="..\gui\WhatsNewDialog.hxx" />
<ClInclude Include="..\httplib\httplib.h" />
<ClInclude Include="..\httplib\http_lib.hxx" />
<ClInclude Include="..\json\json.hxx" /> <ClInclude Include="..\json\json.hxx" />
<ClInclude Include="..\json\json_lib.hxx" /> <ClInclude Include="..\json\json_lib.hxx" />
<ClInclude Include="..\libpng\pngdebug.h" /> <ClInclude Include="..\libpng\pngdebug.h" />

View File

@ -91,6 +91,9 @@
<Filter Include="Source Files\sqlite\source"> <Filter Include="Source Files\sqlite\source">
<UniqueIdentifier>{ea737878-f4b5-4334-a356-353c6b68bdcd}</UniqueIdentifier> <UniqueIdentifier>{ea737878-f4b5-4334-a356-353c6b68bdcd}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\httplib">
<UniqueIdentifier>{e216a718-4078-4a08-b134-4987ec071e31}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\common\FBBackendSDL2.cxx"> <ClCompile Include="..\common\FBBackendSDL2.cxx">
@ -2324,6 +2327,12 @@
<ClInclude Include="..\gui\NavigationWidget.hxx"> <ClInclude Include="..\gui\NavigationWidget.hxx">
<Filter>Header Files\gui</Filter> <Filter>Header Files\gui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\httplib\http_lib.hxx">
<Filter>Header Files\httplib</Filter>
</ClInclude>
<ClInclude Include="..\httplib\httplib.h">
<Filter>Header Files\httplib</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="stella.ico"> <None Include="stella.ico">