From 7fe3e13489044399c41d99adbeadaff163fd9385 Mon Sep 17 00:00:00 2001 From: tpoole Date: Thu, 6 Jul 2017 16:09:08 +0100 Subject: [PATCH] UnitTestRunner: Fixed some build warnings on Windows --- .../UnitTestRunner_ConsoleApp.vcxproj | 3 ++- .../UnitTestRunner_ConsoleApp.vcxproj | 3 ++- extras/UnitTestRunner/Source/Main.cpp | 14 +++++++++----- extras/UnitTestRunner/UnitTestRunner.jucer | 12 ++++++++---- .../littlefoot/juce_LittleFootCompiler.h | 9 +++++++++ .../topology/juce_PhysicalTopologySource.cpp | 4 ++-- 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/extras/UnitTestRunner/Builds/VisualStudio2015/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2015/UnitTestRunner_ConsoleApp.vcxproj index 7f99820fd9..b0c8da31b8 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2015/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2015/UnitTestRunner_ConsoleApp.vcxproj @@ -30,7 +30,6 @@ Label="Configuration"> Application false - true v140 8.1 @@ -81,6 +80,7 @@ Level4 true true + true _DEBUG;%(PreprocessorDefinitions) @@ -122,6 +122,7 @@ Level4 true true + true NDEBUG;%(PreprocessorDefinitions) diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj index 9883fac5b9..8871a3a112 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj @@ -31,7 +31,6 @@ Label="Configuration"> Application false - true v141 v141 10.0.15063.0 @@ -83,6 +82,7 @@ Level4 true true + true _DEBUG;%(PreprocessorDefinitions) @@ -122,6 +122,7 @@ Level4 true true + true NDEBUG;%(PreprocessorDefinitions) diff --git a/extras/UnitTestRunner/Source/Main.cpp b/extras/UnitTestRunner/Source/Main.cpp index 4f25bf664c..52c20bb464 100644 --- a/extras/UnitTestRunner/Source/Main.cpp +++ b/extras/UnitTestRunner/Source/Main.cpp @@ -45,16 +45,20 @@ class ConsoleUnitTestRunner : public UnitTestRunner }; //============================================================================== -int main (int argc, char* argv[]) +int main() { - ignoreUnused (argc, argv); - - ScopedPointer logger; - Logger::setCurrentLogger (logger); + #if ! JUCE_DEBUG + ConsoleLogger logger; + Logger::setCurrentLogger (&logger); + #endif ConsoleUnitTestRunner runner; runner.runAllTests(); + #if ! JUCE_DEBUG + Logger::setCurrentLogger (nullptr); + #endif + for (int i = 0; i < runner.getNumResults(); ++i) if (runner.getResult(i)->failures > 0) return 1; diff --git a/extras/UnitTestRunner/UnitTestRunner.jucer b/extras/UnitTestRunner/UnitTestRunner.jucer index 25b97af75a..21b86ff3d8 100644 --- a/extras/UnitTestRunner/UnitTestRunner.jucer +++ b/extras/UnitTestRunner/UnitTestRunner.jucer @@ -69,9 +69,11 @@ + isDebug="1" optimisation="1" targetName="UnitTestRunner" warningsAreErrors="1" + wholeProgramOptimisation="1"/> + isDebug="0" optimisation="3" targetName="UnitTestRunner" wholeProgramOptimisation="1" + warningsAreErrors="1"/> @@ -96,9 +98,11 @@ + isDebug="1" optimisation="1" targetName="UnitTestRunner" warningsAreErrors="1" + wholeProgramOptimisation="1"/> + isDebug="0" optimisation="3" targetName="UnitTestRunner" warningsAreErrors="1" + wholeProgramOptimisation="1"/> diff --git a/modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h b/modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h index 7dea7f03c5..f62e07a54b 100644 --- a/modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h +++ b/modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h @@ -20,6 +20,11 @@ ============================================================================== */ +#if JUCE_MSVC + #pragma warning (push) + #pragma warning (disable: 4702) +#endif + namespace littlefoot { @@ -2172,3 +2177,7 @@ private: }; } + +#if JUCE_MSVC + #pragma warning (pop) +#endif diff --git a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp index dce701b0b3..71bd682026 100644 --- a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp +++ b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp @@ -1695,7 +1695,7 @@ struct PhysicalTopologySource::Internal } } - bool setName (const juce::String& name) override + bool setName (const juce::String& newName) override { auto index = getDeviceIndex(); @@ -1704,7 +1704,7 @@ struct PhysicalTopologySource::Internal BlocksProtocol::HostPacketBuilder<128> p; p.writePacketSysexHeaderBytes ((BlocksProtocol::TopologyIndex) index); - if (p.addSetBlockName (name)) + if (p.addSetBlockName (newName)) { p.writePacketSysexFooter();