warning level adjustments and some related fixes

This commit is contained in:
Marc Zinnschlag 2012-03-15 16:01:41 +01:00
parent 311c0b04e2
commit 5b378e820d
7 changed files with 31 additions and 38 deletions

View file

@ -272,8 +272,7 @@ endif (APPLE)
# Compiler settings # Compiler settings
if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCC)
#add_definitions (-Wall -Werror) add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-reorder)
add_definitions (-Wall)
endif (CMAKE_COMPILER_IS_GNUCC) endif (CMAKE_COMPILER_IS_GNUCC)
if(DPKG_PROGRAM) if(DPKG_PROGRAM)
@ -435,17 +434,13 @@ if (WIN32)
# OpenMW specific warnings # OpenMW specific warnings
4099 # Type mismatch, declared class or struct is defined with other type 4099 # Type mismatch, declared class or struct is defined with other type
4100 # Unreferenced formal parameter (-Wunused-parameter) 4100 # Unreferenced formal parameter (-Wunused-parameter)
4101 # Unreferenced local variable
4127 # Conditional expression is constant 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 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) 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) 4305 # Truncating value (double to float, for example)
4309 # Variable overflow, trying to store 128 in a signed char for example 4309 # Variable overflow, trying to store 128 in a signed char for example
4355 # Using 'this' in member initialization list 4355 # Using 'this' in member initialization list
4701 # Potentially uninitialized local variable used 4701 # Potentially uninitialized local variable used
4702 # Unreachable code
) )
foreach(d ${WARNINGS_DISABLE}) foreach(d ${WARNINGS_DISABLE})

View file

@ -50,7 +50,7 @@ namespace MWGui
return isGood(); return isGood();
} }
catch (const Compiler::SourceException& error) catch (const Compiler::SourceException&)
{ {
// error has already been reported via error handler // error has already been reported via error handler
} }
@ -342,7 +342,7 @@ namespace MWGui
if( ( matches.front().find(' ') != string::npos ) ) { if( ( matches.front().find(' ') != string::npos ) ) {
if( !has_front_quote ) if( !has_front_quote )
output.append(string("\"")); output.append(string("\""));
return output.append(matches.front() + string("\" ")); return output.append(matches.front() + string("\" "));
} }
else if( has_front_quote ) { else if( has_front_quote ) {
return output.append(matches.front() + string("\" ")); return output.append(matches.front() + string("\" "));
@ -361,7 +361,7 @@ namespace MWGui
/* Append the longest match to the end of the output string*/ /* Append the longest match to the end of the output string*/
output.append(matches.front().substr( 0, i)); output.append(matches.front().substr( 0, i));
return output; return output;
} }
} }
} }

View file

@ -111,7 +111,6 @@ namespace MWRender{
Nif::NiTriShapeCopy& copy = *allshapesiter; Nif::NiTriShapeCopy& copy = *allshapesiter;
std::vector<Ogre::Vector3>* allvertices = &copy.vertices; std::vector<Ogre::Vector3>* allvertices = &copy.vertices;
std::vector<Ogre::Vector3>* allnormals = &copy.normals;
@ -182,7 +181,6 @@ namespace MWRender{
std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second; std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second;
int verIndex = iter->first; int verIndex = iter->first;
Ogre::Vector3 currentVertex = (*allvertices)[verIndex]; Ogre::Vector3 currentVertex = (*allvertices)[verIndex];
Ogre::Vector3 currentNormal = (*allnormals)[verIndex];
Nif::NiSkinData::BoneInfoCopy* boneinfocopy = &(allshapesiter->boneinfo[inds[0].boneinfocopyindex]); Nif::NiSkinData::BoneInfoCopy* boneinfocopy = &(allshapesiter->boneinfo[inds[0].boneinfocopyindex]);
Ogre::Bone *bonePtr = 0; Ogre::Bone *bonePtr = 0;
@ -276,7 +274,7 @@ namespace MWRender{
rotmult = bonePtr->getOrientation(); rotmult = bonePtr->getOrientation();
scale = bonePtr->getScale().x; scale = bonePtr->getScale().x;
boneSequenceIter++; boneSequenceIter++;
for(; boneSequenceIter != boneSequence.end(); boneSequenceIter++) for(; boneSequenceIter != boneSequence.end(); boneSequenceIter++)
{ {
if(creaturemodel->getSkeleton()->hasBone(*boneSequenceIter)){ if(creaturemodel->getSkeleton()->hasBone(*boneSequenceIter)){
@ -390,7 +388,7 @@ namespace MWRender{
void Animation::handleAnimationTransforms(){ void Animation::handleAnimationTransforms(){
Ogre::SkeletonInstance* skel = base->getSkeleton(); Ogre::SkeletonInstance* skel = base->getSkeleton();
@ -430,11 +428,11 @@ namespace MWRender{
const std::vector<Ogre::Quaternion> & quats = iter->getQuat(); const std::vector<Ogre::Quaternion> & quats = iter->getQuat();
const std::vector<float> & ttime = iter->gettTime(); const std::vector<float> & ttime = iter->gettTime();
const std::vector<float> & rtime = iter->getrTime(); const std::vector<float> & rtime = iter->getrTime();
int rindexJ = rindexI[slot]; int rindexJ = rindexI[slot];
timeIndex(time, rtime, rindexI[slot], rindexJ, x2); timeIndex(time, rtime, rindexI[slot], rindexJ, x2);
int tindexJ = tindexI[slot]; int tindexJ = tindexI[slot];
@ -447,10 +445,10 @@ namespace MWRender{
Ogre::Quaternion r; Ogre::Quaternion r;
bool bTrans = translist1.size() > 0; bool bTrans = translist1.size() > 0;
bool bQuats = quats.size() > 0; bool bQuats = quats.size() > 0;
if(skel->hasBone(iter->getBonename())){ if(skel->hasBone(iter->getBonename())){
Ogre::Bone* bone = skel->getBone(iter->getBonename()); Ogre::Bone* bone = skel->getBone(iter->getBonename());
if(bTrans){ if(bTrans){
@ -467,10 +465,10 @@ namespace MWRender{
} }
slot++; slot++;
} }

View file

@ -161,9 +161,9 @@ namespace MWWorld
{ {
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine(); mPhysEngine = mPhysics->getEngine();
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment); mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
mWeatherManager = new MWWorld::WeatherManager(mRendering, &environment); mWeatherManager = new MWWorld::WeatherManager(mRendering, &environment);
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
@ -381,7 +381,7 @@ namespace MWWorld
mGlobalVariables->setFloat ("gamehour", hour); mGlobalVariables->setFloat ("gamehour", hour);
mRendering->skySetHour (hour); mRendering->skySetHour (hour);
mWeatherManager->setHour (hour); mWeatherManager->setHour (hour);
if (days>0) if (days>0)
@ -418,10 +418,10 @@ namespace MWWorld
mGlobalVariables->setInt ("month", month); mGlobalVariables->setInt ("month", month);
mRendering->skySetDate (day, month); mRendering->skySetDate (day, month);
mWeatherManager->setDate (day, month); mWeatherManager->setDate (day, month);
} }
void World::setMonth (int month) void World::setMonth (int month)
@ -702,9 +702,9 @@ namespace MWWorld
void World::update (float duration) void World::update (float duration)
{ {
mWorldScene->update (duration); mWorldScene->update (duration);
mWeatherManager->update (duration); mWeatherManager->update (duration);
// cast a ray from player to sun to detect if the sun is visible // 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 // this is temporary until we find a better place to put this code
// currently its here because we need to access the physics system // 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); sun = Vector3(sun.x, -sun.z, sun.y);
mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun)); mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun));
} }
bool World::isCellExterior() const bool World::isCellExterior() const
{ {
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
@ -726,7 +726,7 @@ namespace MWWorld
} }
return false; return false;
} }
bool World::isCellQuasiExterior() const bool World::isCellQuasiExterior() const
{ {
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
@ -739,17 +739,17 @@ namespace MWWorld
} }
return false; return false;
} }
int World::getCurrentWeather() const int World::getCurrentWeather() const
{ {
return mWeatherManager->getWeatherID(); return mWeatherManager->getWeatherID();
} }
void World::changeWeather(const std::string& region, const unsigned int id) void World::changeWeather(const std::string& region, const unsigned int id)
{ {
mWeatherManager->changeWeather(region, id); mWeatherManager->changeWeather(region, id);
} }
OEngine::Render::Fader* World::getFader() OEngine::Render::Fader* World::getFader()
{ {
return mRendering->getFader(); return mRendering->getFader();

View file

@ -95,8 +95,6 @@ namespace Compiler
return true; return true;
} }
return false;
} }
bool ControlParser::parseWhileBody (int keyword, const TokenLoc& loc, Scanner& scanner) bool ControlParser::parseWhileBody (int keyword, const TokenLoc& loc, Scanner& scanner)
@ -108,7 +106,7 @@ namespace Compiler
Codes expr; Codes expr;
mExprParser.append (expr); mExprParser.append (expr);
Generator::jump (loop, -mCodeBlock.size()-expr.size()); Generator::jump (loop, -static_cast<int> (mCodeBlock.size()-expr.size()));
std::copy (expr.begin(), expr.end(), std::back_inserter (mCode)); std::copy (expr.begin(), expr.end(), std::back_inserter (mCode));
@ -122,7 +120,7 @@ namespace Compiler
Codes loop2; Codes loop2;
Generator::jump (loop2, -mCodeBlock.size()-expr.size()-skip.size()); Generator::jump (loop2, -static_cast<int> (mCodeBlock.size()-expr.size()-skip.size()));
if (loop.size()!=loop2.size()) if (loop.size()!=loop2.size())
throw std::logic_error ( throw std::logic_error (
@ -153,8 +151,6 @@ namespace Compiler
return true; return true;
} }
return false;
} }
ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals, ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals,

View file

@ -177,6 +177,8 @@ void NIFFile::parse()
records[i]->post(this); records[i]->post(this);
} }
/// \todo move to the write cpp file
void NiSkinInstance::post(NIFFile *nif) void NiSkinInstance::post(NIFFile *nif)
{ {
int bnum = bones.length(); int bnum = bones.length();

View file

@ -100,6 +100,8 @@ struct Record
/// Does post-processing, after the entire tree is loaded /// Does post-processing, after the entire tree is loaded
virtual void post(NIFFile *nif) {} virtual void post(NIFFile *nif) {}
virtual ~Record() {}
/* /*
Use these later if you want custom allocation of all NIF objects Use these later if you want custom allocation of all NIF objects