Skip to content

Commit

Permalink
ENABLED stricter compiler settings for dev builds
Browse files Browse the repository at this point in the history
FIXED compiler warnings and a bug as well
  • Loading branch information
ksterker committed Feb 27, 2013
1 parent c2440b8 commit 2b9afba
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 28 deletions.
4 changes: 2 additions & 2 deletions configure.in
Expand Up @@ -41,7 +41,7 @@ OBJC="gcc"
AC_SUBST(OBJC)

if test x$ac_cv_cxx_compiler_gnu = xyes; then
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
CXXFLAGS="$CXXFLAGS -std=c++0x -fno-exceptions -fno-strict-aliasing"
fi

case "$target" in
Expand Down Expand Up @@ -339,7 +339,7 @@ dnl ****************************************************************************
dnl If this is a developer build, turn on debug symbols and check for gtest and gmock
dnl *********************************************************************************
if test x$devbuild = xyes; then
CXXFLAGS="$CXXFLAGS -g"
CXXFLAGS="$CXXFLAGS -g -Wall -pedantic"

test "x$GTEST_DIR" = "x" && GTEST_DIR="/usr/src/gtest"
test "x$GMOCK_DIR" = "x" && GMOCK_DIR="/usr/src/gmock"
Expand Down
5 changes: 3 additions & 2 deletions src/audio/sound.h
Expand Up @@ -47,7 +47,8 @@ namespace audio {
/**
* Constuctors
*/
sound () {}
sound () : m_filename(""), m_sample(NULL), m_channel(-1), m_forcedhalt(false)
{ }

sound (const std::string &filename);

Expand Down Expand Up @@ -133,7 +134,7 @@ namespace audio {
void * m_sample;
/// the channel the sound is playing on
int m_channel;
/// Was this sound stoped by the user
/// Was this sound stopped by the user
bool m_forcedhalt;

//Functions from the audio backend
Expand Down
19 changes: 19 additions & 0 deletions src/base/diskwriter_xml.cc
Expand Up @@ -44,17 +44,35 @@ const char *disk_writer_xml::Bin2Hex = "0123456789ABCDEF";
#define XML_ROOT_NODE "Data"

// definitions for error checking when parsing ints and uints
#ifndef INT8_MAX
#define INT8_MAX 127
#endif
#ifndef INT16_MAX
#define INT16_MAX 32767
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647
#endif

#ifndef INT8_MIN
#define INT8_MIN (-INT8_MAX-1)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-INT16_MAX-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-INT32_MAX-1)
#endif

#ifndef UINT8_MAX
#define UINT8_MAX 0xFF
#endif
#ifndef UINT16_MAX
#define UINT16_MAX 0xFFFF
#endif
#ifndef UINT32_MAX
#define UINT32_MAX 0xFFFFFFFFU
#endif

/**
* Context for the sax parser
Expand All @@ -67,6 +85,7 @@ struct data_sax_context
*/
data_sax_context (base::flat *record)
{
Type = flat::T_UNKNOWN;
Id = "Root";
Record = record;
State = disk_writer_xml::UNDEF;
Expand Down
2 changes: 1 addition & 1 deletion src/base/savegame.h
Expand Up @@ -145,7 +145,7 @@ namespace base
NEW_SAVE = -4,
INITIAL_SAVE = -3,
AUTO_SAVE = -2,
QUICK_SAVE = -1,
QUICK_SAVE = -1
};

/**
Expand Down
7 changes: 5 additions & 2 deletions src/gfx/sdl2/surface_sdl.cc
Expand Up @@ -212,13 +212,14 @@ namespace gfx
{
lock(&dstrect);

u_int32 src[dstrect.w * dstrect.h];
u_int32 *src = new u_int32[dstrect.w * dstrect.h];
std::fill_n(src, dstrect.w * dstrect.h, col);

SDL_ConvertPixels (dstrect.w, dstrect.h,
SDL_PIXELFORMAT_ARGB8888, (void*) src, dstrect.w*4,
SDL_PIXELFORMAT_ARGB8888, (const void*) src, dstrect.w*4,
Info->Format, Info->Pixels, Info->Pitch);

delete[] src;
unlock();
}
}
Expand Down Expand Up @@ -348,6 +349,7 @@ namespace gfx
break;
default:
LOG(FATAL) << "*** sdl::put_pix: Unsupported format " << SDL_GetPixelFormatName(Info->Format);
break;
}
}

Expand Down Expand Up @@ -415,6 +417,7 @@ namespace gfx
break;
default:
LOG(FATAL) << "sdl::get_pix: Unsupported format " << SDL_GetPixelFormatName(Info->Format);
break;
}

#ifdef __BIG_ENDIAN__
Expand Down
2 changes: 1 addition & 1 deletion src/gfx/surface_ext.h
Expand Up @@ -87,7 +87,7 @@ class surface_ext : public surface
//@}

#ifndef SWIG
GET_TYPE_NAME_VIRTUAL(gfx::surface_ext)
GET_TYPE_NAME_VIRTUAL(gfx::surface_ext);
#endif // SWIG

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/button.cpp
Expand Up @@ -114,4 +114,4 @@ namespace gui
return false;
}
// */
};
}
6 changes: 3 additions & 3 deletions src/gui/button.h
Expand Up @@ -51,7 +51,7 @@ namespace gui
* @param height the height of the button.
*/
button(const u_int16 & width, const u_int16 & height)
: label (width, height), Clicked(false)
: label (width, height), Clicked(false), DownKey(input::keyboard_event::UNKNOWN_KEY)
{
set_center (true, true);
}
Expand All @@ -62,7 +62,7 @@ namespace gui
* @param style filename of widget decoration.
*/
button(const std::string & style)
: label (style), Clicked(false)
: label (style), Clicked(false), DownKey(input::keyboard_event::UNKNOWN_KEY)
{
set_center (true, true);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace gui
/// the key that caused the button to be pressed
input::keyboard_event::key_type DownKey;
};
};
}


#endif//GUI_BUTTON_H
2 changes: 1 addition & 1 deletion src/gui/conversation.cc
Expand Up @@ -161,4 +161,4 @@ namespace gui

return layout::keyup(k);
}
};
}
2 changes: 1 addition & 1 deletion src/gui/conversation.h
Expand Up @@ -40,6 +40,6 @@ namespace gui

virtual bool keyup(input::keyboard_event &k);
};
};
}

#endif
2 changes: 1 addition & 1 deletion src/gui/font.cpp
Expand Up @@ -362,5 +362,5 @@ namespace gui

h += drop;
}
};
}

2 changes: 1 addition & 1 deletion src/gui/label.cpp
Expand Up @@ -116,4 +116,4 @@ namespace gui
set_size (length(), newheight);
}
}
};
}
2 changes: 1 addition & 1 deletion src/gui/label.h
Expand Up @@ -216,7 +216,7 @@ namespace gui
/// text draw offset y
u_int32 Oy;
};
};
}


#endif//GUI_LABEL_H
2 changes: 1 addition & 1 deletion src/gui/layout.h
Expand Up @@ -333,6 +333,6 @@ namespace gui
// void dofade(int x, int y, const SDL_Surface* s);
// bool mousestate[3];
};
};
}

#endif//GUI_BASE_H
2 changes: 1 addition & 1 deletion src/gui/option.cpp
Expand Up @@ -88,4 +88,4 @@ namespace gui
return false;
}
// */
};
}
2 changes: 1 addition & 1 deletion src/gui/option.h
Expand Up @@ -130,7 +130,7 @@ namespace gui
/// state of option widget (selected or not)
bool State;
};
};
}


#endif//GUI_LABEL_H
2 changes: 1 addition & 1 deletion src/gui/textbox.cpp
Expand Up @@ -217,4 +217,4 @@ namespace gui
}
#endif

};
}
2 changes: 1 addition & 1 deletion src/gui/textbox.h
Expand Up @@ -173,6 +173,6 @@ namespace gui
/// the cursor for text input
cursor *Cursor;
};
};
}

#endif//GUI_TEXTBOX_H
2 changes: 1 addition & 1 deletion src/gui/widget.cpp
Expand Up @@ -31,4 +31,4 @@ namespace gui
{
Look->draw (x, y, da, target);
}
};
}
2 changes: 1 addition & 1 deletion src/gui/widget.h
Expand Up @@ -218,7 +218,7 @@ namespace gui
/// forbid copy construction
widget (const widget &);
};
};
}

#endif//GUI_WIDGET_H

4 changes: 4 additions & 0 deletions src/main/adonthell.cc
Expand Up @@ -58,6 +58,10 @@ app::app ()
{
google::InstallFailureSignalHandler();
theApp = this;
Argc = 0;
Argv = NULL;
IsRunning = false;
Modules = 0;
}

// dtor
Expand Down
2 changes: 1 addition & 1 deletion src/py-runtime/Makefile.am
Expand Up @@ -6,7 +6,7 @@ CLEANFILES = $(top_srcdir)/src/py-runtime/py_runtime.cc
lib_LTLIBRARIES = libadonthell_py_runtime.la

## the swig runtime code
py_runtime.cc: py_runtime.i Makefile.am
py_runtime.cc: py_runtime.i $(top_srcdir)/src/py-runtime/Makefile.am
$(SWIG) -c++ -noexcept -nocontract -python -modern -module py_runtime -o $(srcdir)/$@ $<

## Rules to build libadonthell_py_runtime
Expand Down
2 changes: 1 addition & 1 deletion src/py-wrappers/adonthell/Makefile.am
Expand Up @@ -172,5 +172,5 @@ __init__.py:
## The .pyc are generated so the Python modules are accessible even if
## we are using a separate builddir.
%.pyc: %.py
$(PYTHON) -c "import py_compile; py_compile.compile(\"$(srcdir)/$<\", \"./$@\");"
$(PYTHON) -c "import py_compile; py_compile.compile(\"$(srcdir)/$(<F)\", \"./$@\");"

2 changes: 1 addition & 1 deletion src/world/chunk.cc
Expand Up @@ -398,7 +398,7 @@ void chunk::objects_in_bbox (const vector3<s_int32> & min, const vector3<s_int32
std::list<chunk_info *>::const_iterator i;
for (i = Objects.begin (); i != Objects.end(); i++)
{
if (type & (*i)->get_object()->type() && in_bbox (min, max, (*i)->solid_min(), (*i)->solid_max()))
if ((type & (*i)->get_object()->type()) && in_bbox (min, max, (*i)->solid_min(), (*i)->solid_max()))
{
result.push_back (*i);
}
Expand Down
2 changes: 1 addition & 1 deletion src/world/pathfinding.h
Expand Up @@ -158,6 +158,6 @@ namespace world
/// The open list
open_list m_openList;
};
};
}

#endif // WORLD_PATHFINDING_H

0 comments on commit 2b9afba

Please sign in to comment.