From 945914f1d601f16fe1d40cae03d9e4fe4b5b80c4 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 22 Mar 2015 18:49:21 +0000 Subject: [PATCH] Enable -Wuninitialized, -Wempty-body, -Wignored-qualifiers, -Wunused --- SConstruct | 2 +- d1x-rebirth/main/hostage.cpp | 5 ----- similar/main/render.cpp | 6 +++++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/SConstruct b/SConstruct index a64f1cbc1..7bd1c03f4 100644 --- a/SConstruct +++ b/SConstruct @@ -1446,7 +1446,7 @@ class DXXCommon(LazyObjectConstructor): # gcc 4.5 silently ignores -Werror=undef. On gcc 4.5, misuse # produces a warning. On gcc 4.7, misuse produces an error. Werror = get_Werror_string(self.user_settings.CXXFLAGS) - self.env.Append(CCFLAGS = ['-Wall', Werror + 'missing-declarations', Werror + 'pointer-arith', Werror + 'undef', Werror + 'type-limits', '-funsigned-char', Werror + 'format-security']) + self.env.Append(CCFLAGS = ['-Wall', Werror + 'missing-declarations', Werror + 'pointer-arith', Werror + 'undef', Werror + 'type-limits', Werror + 'uninitialized', Werror + 'empty-body', Werror + 'ignored-qualifiers', Werror + 'unused', '-funsigned-char', Werror + 'format-security']) self.env.Append(CPPPATH = ['common/include', 'common/main', '.', self.user_settings.builddir]) self.env.Append(CPPFLAGS = SCons.Util.CLVar('-Wno-sign-compare')) if (self.user_settings.editor == 1): diff --git a/d1x-rebirth/main/hostage.cpp b/d1x-rebirth/main/hostage.cpp index fd3f25a79..449780f31 100644 --- a/d1x-rebirth/main/hostage.cpp +++ b/d1x-rebirth/main/hostage.cpp @@ -110,10 +110,5 @@ void hostage_compress_all() { } } } - - for (int i=0; itype == OBJ_WEAPON || (obj_a->type == OBJ_FIREBALL && obj_a->id != VCLIP_AFTERBURNER_BLOB)) + { if (!(obj_b->type == OBJ_WEAPON || obj_b->type == OBJ_FIREBALL)) return true; //a is weapon, b is not, so say a is closer - else; //both are weapons + //both are weapons + } else + { if (obj_b->type == OBJ_WEAPON || (obj_b->type == OBJ_FIREBALL && obj_b->id != VCLIP_AFTERBURNER_BLOB)) return false; //b is weapon, a is not, so say a is farther + } //no special case, fall through to normal return }