diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b7d6ad84..6f930772a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -490,10 +490,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.6) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter") endif() - - if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") - endif() endif (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) # Extern @@ -584,63 +580,16 @@ if (WIN32) # Play a bit with the warning levels - set(WARNINGS "/Wall") # Since windows can only disable specific warnings, not enable them + set(WARNINGS "/W4") set(WARNINGS_DISABLE - # Warnings that aren't enabled normally and don't need to be enabled - # They're unneeded and sometimes completely retarded warnings that /Wall enables - # Not going to bother commenting them as they tend to warn on every standard library file - 4061 4263 4264 4266 4350 4371 4435 4514 4548 4571 4582 4583 4610 4619 4623 4625 - 4626 4628 4640 4668 4710 4711 4768 4820 4826 4917 4946 5032 5039 5045 5219 5220 - - # Warnings that are thrown on standard libraries and not OpenMW - 4347 # Non-template function with same name and parameter count as template function - 4365 # Variable signed/unsigned mismatch - 4510 4512 # Unable to generate copy constructor/assignment operator as it's not public in the base - 4706 # Assignment in conditional expression - 4738 # Storing 32-bit float result in memory, possible loss of performance - 4774 # Format string expected in argument is not a string literal - 4986 # Undocumented warning that occurs in the crtdbg.h file - 4987 # nonstandard extension used (triggered by setjmp.h) - 4996 # Function was declared deprecated - - # caused by OSG - 4589 # Constructor of abstract class 'osg::Operation' ignores initializer for virtual base class 'osg::Referenced' (False warning) - - # caused by boost - 4191 # 'type cast' : unsafe conversion (1.56, thread_primitives.hpp, normally off) - 4643 # Forward declaring 'X' in namespace std is not permitted by the C++ Standard. (in *_std_fwd.h files) - 5204 # Class has virtual functions, but its trivial destructor is not virtual - - # caused by MyGUI - 4297 # function assumed not to throw an exception but does - # OpenMW specific warnings - 4099 # Type mismatch, declared class or struct is defined with other type 4100 # Unreferenced formal parameter (-Wunused-parameter) - 4101 # Unreferenced local variable (-Wunused-variable) 4127 # Conditional expression is constant - 4242 # Storing value in a variable of a smaller type, possible loss of data 4244 # Storing value of one type in variable of another (size_t in int, for example) - 4245 # Signed/unsigned mismatch 4267 # Conversion from 'size_t' to 'int', possible loss of data - 4305 # Truncating value (double to float, for example) - 4309 # Variable overflow, trying to store 128 in a signed char for example - 4351 # New behavior: elements of array 'array' will be default initialized (desired behavior) - 4355 # Using 'this' in member initialization list - 4464 # relative include path contains '..' - 4505 # Unreferenced local function has been removed - 4701 # Potentially uninitialized local variable used - 4702 # Unreachable code - 4714 # function 'QString QString::trimmed(void) &&' marked as __forceinline not inlined - 4800 # Boolean optimization warning, e.g. myBool = (myInt != 0) instead of myBool = myInt - ) - - if (MSVC_VERSION GREATER 1800) - set(WARNINGS_DISABLE ${WARNINGS_DISABLE} 5026 5027 - 5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file (config_begin.hpp, config_end.hpp) + 4996 # Function was declared deprecated ) - endif() if( "${MyGUI_VERSION}" VERSION_LESS_EQUAL "3.4.0" ) set(WARNINGS_DISABLE ${WARNINGS_DISABLE} diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index f0e876470..67b24d60a 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1315,7 +1315,8 @@ public: while (callback) { - if ((composite = dynamic_cast(callback))) + composite = dynamic_cast(callback); + if (composite) break; callback = callback->getNestedCallback(); diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index 0f3a26e15..09a05d2f5 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -35,7 +35,16 @@ #include #include -#include + +#if defined(_MSC_VER) + #pragma warning (push) + #pragma warning (disable : 4706) + #include + #pragma warning (pop) +#else + #include +#endif + #include #include diff --git a/components/interpreter/defines.cpp b/components/interpreter/defines.cpp index 0ceed80d5..d2e7067c6 100644 --- a/components/interpreter/defines.cpp +++ b/components/interpreter/defines.cpp @@ -176,7 +176,8 @@ namespace Interpreter{ transform(temp.begin(), temp.end(), temp.begin(), ::tolower); } - if((found = check(temp, globals[j], &i, &start))){ + found = check(temp, globals[j], &i, &start); + if(found){ char type = context.getGlobalType(globals[j]); switch(type){ diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index d72cef194..72c740af3 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -126,8 +126,7 @@ osg::ref_ptr BulletNifLoader::load(const Nif::File& nif) { Nif::Record* r = nif.getRoot(i); assert(r != nullptr); - Nif::Node* node = nullptr; - if ((node = dynamic_cast(r))) + if (Nif::Node* node = dynamic_cast(r)) roots.emplace_back(node); } const std::string filename = nif.getFilename(); diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 5f083f925..49d52074a 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -312,8 +312,7 @@ namespace NifOsg for (size_t i = 0; i < numRoots; ++i) { const Nif::Record* r = nif->getRoot(i); - const Nif::Node* nifNode = nullptr; - if ((nifNode = dynamic_cast(r))) + if (const Nif::Node* nifNode = dynamic_cast(r)) roots.emplace_back(nifNode); } if (roots.empty()) @@ -609,7 +608,8 @@ namespace NifOsg bool hasVisController = false; for (Nif::ControllerPtr ctrl = nifNode->controller; !ctrl.empty(); ctrl = ctrl->next) { - if ((hasVisController |= (ctrl->recType == Nif::RC_NiVisController))) + hasVisController |= (ctrl->recType == Nif::RC_NiVisController); + if (hasVisController) break; } diff --git a/components/sceneutil/shadowsbin.cpp b/components/sceneutil/shadowsbin.cpp index 5a4096f5c..abc1fa8b4 100644 --- a/components/sceneutil/shadowsbin.cpp +++ b/components/sceneutil/shadowsbin.cpp @@ -194,8 +194,9 @@ void ShadowsBin::sortImplementation() // noTestRoot is now a stategraph with useDiffuseMapForShadowAlpha disabled but minimal other state bool cullFaceOverridden = false; - while ((root = root->_parent)) + while (root->_parent) { + root = root->_parent; if (!root->getStateSet()) continue; unsigned int cullFaceFlags = root->getStateSet()->getMode(GL_CULL_FACE);