diff --git a/CMakeLists.txt b/CMakeLists.txt index d52f6a3fd..6dbd27a68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,8 +272,7 @@ endif (APPLE) # Compiler settings if (CMAKE_COMPILER_IS_GNUCC) - #add_definitions (-Wall -Werror) - add_definitions (-Wall) + add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-reorder) endif (CMAKE_COMPILER_IS_GNUCC) if(DPKG_PROGRAM) @@ -435,17 +434,13 @@ if (WIN32) # 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 4127 # Conditional expression is constant - 4146 # Unary minus on unsigned type, result still unsigned 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) - 4265 # Class has virtual functions but no virtual destructor (-Wnon-virtual-dtor) 4305 # Truncating value (double to float, for example) 4309 # Variable overflow, trying to store 128 in a signed char for example 4355 # Using 'this' in member initialization list 4701 # Potentially uninitialized local variable used - 4702 # Unreachable code ) foreach(d ${WARNINGS_DISABLE}) diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 0e2e692d3..3fd6e7892 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -50,7 +50,7 @@ namespace MWGui return isGood(); } - catch (const Compiler::SourceException& error) + catch (const Compiler::SourceException&) { // error has already been reported via error handler } @@ -342,7 +342,7 @@ namespace MWGui if( ( matches.front().find(' ') != string::npos ) ) { if( !has_front_quote ) output.append(string("\"")); - return output.append(matches.front() + string("\" ")); + return output.append(matches.front() + string("\" ")); } else if( has_front_quote ) { return output.append(matches.front() + string("\" ")); @@ -361,7 +361,7 @@ namespace MWGui /* Append the longest match to the end of the output string*/ output.append(matches.front().substr( 0, i)); return output; - } + } } } diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 9df987dc1..7b0d7015c 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -111,7 +111,6 @@ namespace MWRender{ Nif::NiTriShapeCopy& copy = *allshapesiter; std::vector* allvertices = ©.vertices; - std::vector* allnormals = ©.normals; @@ -182,7 +181,6 @@ namespace MWRender{ std::vector inds = iter->second; int verIndex = iter->first; Ogre::Vector3 currentVertex = (*allvertices)[verIndex]; - Ogre::Vector3 currentNormal = (*allnormals)[verIndex]; Nif::NiSkinData::BoneInfoCopy* boneinfocopy = &(allshapesiter->boneinfo[inds[0].boneinfocopyindex]); Ogre::Bone *bonePtr = 0; @@ -276,7 +274,7 @@ namespace MWRender{ rotmult = bonePtr->getOrientation(); scale = bonePtr->getScale().x; boneSequenceIter++; - + for(; boneSequenceIter != boneSequence.end(); boneSequenceIter++) { if(creaturemodel->getSkeleton()->hasBone(*boneSequenceIter)){ @@ -390,7 +388,7 @@ namespace MWRender{ void Animation::handleAnimationTransforms(){ - + Ogre::SkeletonInstance* skel = base->getSkeleton(); @@ -430,11 +428,11 @@ namespace MWRender{ const std::vector & quats = iter->getQuat(); const std::vector & ttime = iter->gettTime(); - + const std::vector & rtime = iter->getrTime(); int rindexJ = rindexI[slot]; - + timeIndex(time, rtime, rindexI[slot], rindexJ, x2); int tindexJ = tindexI[slot]; @@ -447,10 +445,10 @@ namespace MWRender{ Ogre::Quaternion r; bool bTrans = translist1.size() > 0; - + bool bQuats = quats.size() > 0; - + if(skel->hasBone(iter->getBonename())){ Ogre::Bone* bone = skel->getBone(iter->getBonename()); if(bTrans){ @@ -467,10 +465,10 @@ namespace MWRender{ - + } - + slot++; } diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 1a69f4d7b..1c47e3c71 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -161,9 +161,9 @@ namespace MWWorld { mPhysics = new PhysicsSystem(renderer); mPhysEngine = mPhysics->getEngine(); - + mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment); - + mWeatherManager = new MWWorld::WeatherManager(mRendering, &environment); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); @@ -381,7 +381,7 @@ namespace MWWorld mGlobalVariables->setFloat ("gamehour", hour); mRendering->skySetHour (hour); - + mWeatherManager->setHour (hour); if (days>0) @@ -418,10 +418,10 @@ namespace MWWorld mGlobalVariables->setInt ("month", month); mRendering->skySetDate (day, month); - + mWeatherManager->setDate (day, month); - - + + } void World::setMonth (int month) @@ -702,9 +702,9 @@ namespace MWWorld void World::update (float duration) { mWorldScene->update (duration); - + mWeatherManager->update (duration); - + // cast a ray from player to sun to detect if the sun is visible // this is temporary until we find a better place to put this code // currently its here because we need to access the physics system @@ -713,7 +713,7 @@ namespace MWWorld sun = Vector3(sun.x, -sun.z, sun.y); mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun)); } - + bool World::isCellExterior() const { Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); @@ -726,7 +726,7 @@ namespace MWWorld } return false; } - + bool World::isCellQuasiExterior() const { Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); @@ -739,17 +739,17 @@ namespace MWWorld } return false; } - + int World::getCurrentWeather() const { return mWeatherManager->getWeatherID(); } - + void World::changeWeather(const std::string& region, const unsigned int id) { mWeatherManager->changeWeather(region, id); } - + OEngine::Render::Fader* World::getFader() { return mRendering->getFader(); diff --git a/components/compiler/controlparser.cpp b/components/compiler/controlparser.cpp index c255154b5..5d74ee9d4 100644 --- a/components/compiler/controlparser.cpp +++ b/components/compiler/controlparser.cpp @@ -95,8 +95,6 @@ namespace Compiler return true; } - - return false; } bool ControlParser::parseWhileBody (int keyword, const TokenLoc& loc, Scanner& scanner) @@ -108,7 +106,7 @@ namespace Compiler Codes expr; mExprParser.append (expr); - Generator::jump (loop, -mCodeBlock.size()-expr.size()); + Generator::jump (loop, -static_cast (mCodeBlock.size()-expr.size())); std::copy (expr.begin(), expr.end(), std::back_inserter (mCode)); @@ -122,7 +120,7 @@ namespace Compiler Codes loop2; - Generator::jump (loop2, -mCodeBlock.size()-expr.size()-skip.size()); + Generator::jump (loop2, -static_cast (mCodeBlock.size()-expr.size()-skip.size())); if (loop.size()!=loop2.size()) throw std::logic_error ( @@ -153,8 +151,6 @@ namespace Compiler return true; } - - return false; } ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals, diff --git a/components/nif/nif_file.cpp b/components/nif/nif_file.cpp index 361e5f6e9..52a37ba5c 100644 --- a/components/nif/nif_file.cpp +++ b/components/nif/nif_file.cpp @@ -177,6 +177,8 @@ void NIFFile::parse() records[i]->post(this); } +/// \todo move to the write cpp file + void NiSkinInstance::post(NIFFile *nif) { int bnum = bones.length(); diff --git a/components/nif/record.hpp b/components/nif/record.hpp index e94e3d0d3..40f91f84f 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -100,6 +100,8 @@ struct Record /// Does post-processing, after the entire tree is loaded virtual void post(NIFFile *nif) {} + virtual ~Record() {} + /* Use these later if you want custom allocation of all NIF objects