Visual Studio: increased warning level to /W4 even for release builds

In particular, this enables C4100, the warning for unreferenced function
parameters.

I also fixed some /W4 warnings.

(cherry-picked from commit d4c9db9e35)
This commit is contained in:
Jyrki Vesterinen 2018-03-24 09:41:28 +02:00
parent d0c9a02189
commit ca150a9129
10 changed files with 55 additions and 59 deletions

View file

@ -43,12 +43,12 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WINXP;_SCL_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4244</DisableSpecificWarnings>
<DisableSpecificWarnings>4244;4127</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
@ -58,14 +58,14 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WINXP;_SCL_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4244</DisableSpecificWarnings>
<DisableSpecificWarnings>4244;4127</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>

View file

@ -127,7 +127,7 @@
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4239</TreatSpecificWarningsAsErrors>
@ -163,10 +163,10 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4503;4351;4250;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4239</TreatSpecificWarningsAsErrors>
</ClCompile>
@ -209,7 +209,7 @@
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;4512;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;4127;4512;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4239</TreatSpecificWarningsAsErrors>
@ -244,10 +244,10 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4503;4351;4250;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4239</TreatSpecificWarningsAsErrors>
</ClCompile>
@ -291,10 +291,10 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4503;4351;4250;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4250;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4239</TreatSpecificWarningsAsErrors>
</ClCompile>

View file

@ -91,7 +91,7 @@
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4503;4244;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4244;4127;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
@ -116,9 +116,9 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4503;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -144,9 +144,9 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4503;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
<Link>

View file

@ -77,7 +77,7 @@
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4503;4351;4244;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4244;4127;4127;4512;4003;4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
@ -97,10 +97,10 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4503;4351;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
<Lib>
@ -119,10 +119,10 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<OpenMPSupport>true</OpenMPSupport>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4503;4351;4244;</DisableSpecificWarnings>
<DisableSpecificWarnings>4503;4351;4244;4127;</DisableSpecificWarnings>
<ForcedIncludeFiles>boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
<Lib>

View file

@ -24,7 +24,7 @@ namespace tokenizer
namespace {
void raise_exception(iterator& i1, iterator i2, std::string str) {
[[noreturn]] void raise_exception(iterator& i1, iterator i2, std::string str) {
std::ostringstream expr;
while( (i1 != i2) && (*i1 != '\n') ) {
if( (*i1 != '\t') )
@ -283,8 +283,7 @@ token get_token(iterator& i1, const iterator i2) {
raise_exception(it, i2, std::string() );
}
}
raise_exception(it, i2, std::string() );
return token();
raise_exception(it, i2, std::string());
}
}

View file

@ -57,20 +57,13 @@ bool generic_event::detach_handler(observer* obs){
//make sure observers are not notified right now
if (!notify_active_){
change_handler_ = true;
try{
std::vector<observer*>::iterator it = std::find(observers_.begin(), observers_.end(), obs);
if (it == observers_.end()){
handler_detached = false;
}
else{
observers_.erase(it);
handler_detached = true;
}
auto it = std::find(observers_.begin(), observers_.end(), obs);
if (it == observers_.end()){
handler_detached = false;
}
catch (...){
change_handler_ = false;
throw;
else{
observers_.erase(it);
handler_detached = true;
}
change_handler_ = false;
}

View file

@ -508,12 +508,8 @@ halo_record::~halo_record()
std::shared_ptr<halo_impl> man = my_manager_.lock();
if (man) {
try {
man->remove(id_);
} catch (std::exception & e) {
std::cerr << "Caught an exception in halo::halo_record destructor: \n" << e.what() << std::endl;
} catch (...) {}
if(man) {
man->remove(id_);
}
}

View file

@ -301,8 +301,16 @@ static int impl_vconfig_pairs_collect(lua_State *L)
{
typedef config::const_attr_itors const_attr_itors;
void* p = lua_touserdata(L, 1);
// Triggers a false positive of C4189 with Visual Studio. Suppress.
#pragma warning(push)
#pragma warning(disable: 4189)
const_attr_itors* cai = static_cast<const_attr_itors*>(p);
cai->~const_attr_itors();
#pragma warning(pop)
return 0;
}

View file

@ -1916,15 +1916,15 @@ void put_pixel(const surface& surf, surface_lock& surf_lock, int x, int y, uint3
*reinterpret_cast<uint16_t*>(dst) = pixel;
break;
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
dst[0] = (pixel >> 16) & 0xff;
dst[1] = (pixel >> 8) & 0xff;
dst[2] = pixel & 0xff;
} else {
dst[0] = pixel & 0xff;
dst[1] = (pixel >> 8) & 0xff;
dst[2] = (pixel >> 16) & 0xff;
}
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
dst[0] = (pixel >> 16) & 0xff;
dst[1] = (pixel >> 8) & 0xff;
dst[2] = pixel & 0xff;
#else
dst[0] = pixel & 0xff;
dst[1] = (pixel >> 8) & 0xff;
dst[2] = (pixel >> 16) & 0xff;
#endif
break;
case 4:
*reinterpret_cast<uint32_t*>(dst) = pixel;
@ -1945,11 +1945,11 @@ uint32_t get_pixel(const surface& surf, const const_surface_lock& surf_lock, int
case 2:
return *reinterpret_cast<const uint16_t*>(src);
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
return src[0] << 16 | src[1] << 8 | src[2];
else
return src[0] | src[1] << 8 | src[2] << 16;
break;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
return src[0] << 16 | src[1] << 8 | src[2];
#else
return src[0] | src[1] << 8 | src[2] << 16;
#endif
case 4:
return *reinterpret_cast<const uint32_t*>(src);
}

View file

@ -182,7 +182,7 @@ struct sendfile_op
bool pending_;
std::shared_ptr<handle_doc<Handler, ErrorHandler>> handle_send_doc_;
void operator()(boost::system::error_code ec, std::size_t)
void operator()(boost::system::error_code, std::size_t)
{
bool failed = false;
if (!pending_)