projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e974369
)
Use NDEBUG a bit less.
author
Mathnerd314
<man.is.allan@gmail.com>
Sun, 24 Jan 2010 20:04:45 +0000
(20:04 +0000)
committer
Mathnerd314
<man.is.allan@gmail.com>
Sun, 24 Jan 2010 20:04:45 +0000
(20:04 +0000)
SVN-Revision: 6270
src/audio/ogg_sound_file.cpp
patch
|
blob
|
history
src/audio/sound_manager.cpp
patch
|
blob
|
history
src/lisp/parser.cpp
patch
|
blob
|
history
src/object/anchor_point.cpp
patch
|
blob
|
history
src/sprite/sprite.cpp
patch
|
blob
|
history
src/supertux/main.cpp
patch
|
blob
|
history
src/util/log.cpp
patch
|
blob
|
history
src/util/log.hpp
patch
|
blob
|
history
src/video/gl/gl_texture.cpp
patch
|
blob
|
history
src/video/glutil.hpp
patch
|
blob
|
history
diff --git
a/src/audio/ogg_sound_file.cpp
b/src/audio/ogg_sound_file.cpp
index
182371c
..
fd7c7fc
100644
(file)
--- a/
src/audio/ogg_sound_file.cpp
+++ b/
src/audio/ogg_sound_file.cpp
@@
-135,11
+135,8
@@
OggSoundFile::cb_seek(void* source, ogg_int64_t offset, int whence)
return -1;
break;
default:
return -1;
break;
default:
-#ifndef NDEBUG
assert(false);
assert(false);
-#else
return -1;
return -1;
-#endif
}
return 0;
}
}
return 0;
}
diff --git
a/src/audio/sound_manager.cpp
b/src/audio/sound_manager.cpp
index
a65f38f
..
6bd2c31
100644
(file)
--- a/
src/audio/sound_manager.cpp
+++ b/
src/audio/sound_manager.cpp
@@
-27,16
+27,6
@@
#include "audio/stream_sound_source.hpp"
#include "util/log.hpp"
#include "audio/stream_sound_source.hpp"
#include "util/log.hpp"
-#ifdef NDEBUG
-/** Older openal versions often miss this function and it isn't that vital for
- * supertux...
- */
-#ifdef alcGetString
-# undef alcGetString
-#endif
-# define alcGetString(x,y) ""
-#endif
-
SoundManager::SoundManager() :
device(0),
context(0),
SoundManager::SoundManager() :
device(0),
context(0),
diff --git
a/src/lisp/parser.cpp
b/src/lisp/parser.cpp
index
86609a6
..
fad69a1
100644
(file)
--- a/
src/lisp/parser.cpp
+++ b/
src/lisp/parser.cpp
@@
-202,6
+202,7
@@
Parser::read()
default:
// this should never happen
default:
// this should never happen
+ result = NULL;
assert(false);
}
assert(false);
}
diff --git
a/src/object/anchor_point.cpp
b/src/object/anchor_point.cpp
index
0c05191
..
2499c9e
100644
(file)
--- a/
src/object/anchor_point.cpp
+++ b/
src/object/anchor_point.cpp
@@
-91,9
+91,6
@@
Vector get_anchor_pos(const Rectf& rect, AnchorPoint point)
result.x = rect.get_right();
break;
default:
result.x = rect.get_right();
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.x = rect.get_left();
break;
log_warning << "Invalid anchor point found" << std::endl;
result.x = rect.get_left();
break;
@@
-110,9
+107,6
@@
Vector get_anchor_pos(const Rectf& rect, AnchorPoint point)
result.y = rect.get_bottom();
break;
default:
result.y = rect.get_bottom();
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.y = rect.get_top();
break;
log_warning << "Invalid anchor point found" << std::endl;
result.y = rect.get_top();
break;
@@
-137,9
+131,6
@@
Vector get_anchor_pos(const Rectf& destrect, float width, float height,
result.x = destrect.get_right() - width;
break;
default:
result.x = destrect.get_right() - width;
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.x = destrect.get_left();
break;
log_warning << "Invalid anchor point found" << std::endl;
result.x = destrect.get_left();
break;
@@
-156,9
+147,6
@@
Vector get_anchor_pos(const Rectf& destrect, float width, float height,
result.y = destrect.get_bottom() - height;
break;
default:
result.y = destrect.get_bottom() - height;
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.y = destrect.get_top();
break;
log_warning << "Invalid anchor point found" << std::endl;
result.y = destrect.get_top();
break;
diff --git
a/src/sprite/sprite.cpp
b/src/sprite/sprite.cpp
index
2ee515a
..
01c41cf
100644
(file)
--- a/
src/sprite/sprite.cpp
+++ b/
src/sprite/sprite.cpp
@@
-149,11
+149,8
@@
Sprite::draw_part(DrawingContext& context, const Vector& source,
int frameidx = (int) frame;
if(frameidx >= get_frames() || frameidx < 0) {
int frameidx = (int) frame;
if(frameidx >= get_frames() || frameidx < 0) {
-#ifdef NDEBUG
// in optimized mode we get some small rounding errors in floating point
// number sometimes...
// in optimized mode we get some small rounding errors in floating point
// number sometimes...
- log_warning << "frame out of range: " << frameidx << "/" << get_frames() << " at sprite: " << get_name() << "/" << get_action() << std::endl;
-#endif
frameidx = get_frames() - 1;
}
frameidx = get_frames() - 1;
}
diff --git
a/src/supertux/main.cpp
b/src/supertux/main.cpp
index
0ffd43c
..
048ebab
100644
(file)
--- a/
src/supertux/main.cpp
+++ b/
src/supertux/main.cpp
@@
-432,11
+432,9
@@
Main::init_video()
SDL_WM_SetIcon(icon, 0);
SDL_FreeSurface(icon);
}
SDL_WM_SetIcon(icon, 0);
SDL_FreeSurface(icon);
}
-#ifndef NDEBUG
else {
log_warning << "Couldn't load icon '" << icon_fname << "'" << std::endl;
}
else {
log_warning << "Couldn't load icon '" << icon_fname << "'" << std::endl;
}
-#endif
SDL_ShowCursor(0);
SDL_ShowCursor(0);
@@
-505,7
+503,6
@@
Main::wait_for_event(float min_delay, float max_delay)
}
}
}
}
-#ifndef NDEBUG
static Uint32 last_timelog_ticks = 0;
static const char* last_timelog_component = 0;
static Uint32 last_timelog_ticks = 0;
static const char* last_timelog_component = 0;
@@
-520,11
+517,6
@@
static inline void timelog(const char* component)
last_timelog_ticks = current_ticks;
last_timelog_component = component;
}
last_timelog_ticks = current_ticks;
last_timelog_component = component;
}
-#else
-static inline void timelog(const char* )
-{
-}
-#endif
int
Main::run(int argc, char** argv)
int
Main::run(int argc, char** argv)
diff --git
a/src/util/log.cpp
b/src/util/log.cpp
index
eafc99b
..
7b0107b
100644
(file)
--- a/
src/util/log.cpp
+++ b/
src/util/log.cpp
@@
-39,22
+39,14
@@
std::ostream& log_warning_f(const char* file, int line)
return Console::output;
}
return Console::output;
}
+#endif
+
std::ostream& log_fatal_f(const char* file, int line)
{
Console::output << "[FATAL] " << file << ":" << line << " ";
return Console::output;
}
std::ostream& log_fatal_f(const char* file, int line)
{
Console::output << "[FATAL] " << file << ":" << line << " ";
return Console::output;
}
-#else
-
-std::ostream& log_fatal_f()
-{
- Console::output << "Fatal: ";
- return Console::output;
-}
-
-#endif
-
std::ostream& operator<<(std::ostream& out, const Vector& vector)
{
out << '[' << vector.x << ',' << vector.y << ']';
std::ostream& operator<<(std::ostream& out, const Vector& vector)
{
out << '[' << vector.x << ',' << vector.y << ']';
diff --git
a/src/util/log.hpp
b/src/util/log.hpp
index
54bcb78
..
b5219b2
100644
(file)
--- a/
src/util/log.hpp
+++ b/
src/util/log.hpp
@@
-18,34
+18,33
@@
#define HEADER_SUPERTUX_UTIL_LOG_HPP
#include <config.h>
#define HEADER_SUPERTUX_UTIL_LOG_HPP
#include <config.h>
+#include <ostream>
#ifndef NDEBUG
#ifndef NDEBUG
-#include <ostream>
-
std::ostream& log_debug_f(const char* file, int line);
std::ostream& log_debug_f(const char* file, int line);
-std::ostream& log_info_f(const char* file, int line);
-std::ostream& log_warning_f(const char* file, int line);
-std::ostream& log_fatal_f(const char* file, int line);
-
#define log_debug log_debug_f(__FILE__, __LINE__)
#define log_debug log_debug_f(__FILE__, __LINE__)
+
+std::ostream& log_info_f(const char* file, int line);
#define log_info log_info_f(__FILE__, __LINE__)
#define log_info log_info_f(__FILE__, __LINE__)
+
+std::ostream& log_warning_f(const char* file, int line);
#define log_warning log_warning_f(__FILE__, __LINE__)
#define log_warning log_warning_f(__FILE__, __LINE__)
-#define log_fatal log_fatal_f(__FILE__, __LINE__)
#else
#include <iostream>
#else
#include <iostream>
-std::ostream& log_fatal_f();
-
-#define log_debug if (0) std::cerr
+#define log_debug std::cout
#define log_info std::cout
#define log_warning std::cerr
#define log_info std::cout
#define log_warning std::cerr
-#define log_fatal log_fatal_f()
#endif
#endif
+std::ostream& log_fatal_f(const char* file, int line);
+
+#define log_fatal log_fatal_f(__FILE__, __LINE__)
+
class Vector;
std::ostream& operator<< (std::ostream& str, const Vector& vector);
class Rectf;
class Vector;
std::ostream& operator<< (std::ostream& str, const Vector& vector);
class Rectf;
diff --git
a/src/video/gl/gl_texture.cpp
b/src/video/gl/gl_texture.cpp
index
008e96f
..
9e2b70d
100644
(file)
--- a/
src/video/gl/gl_texture.cpp
+++ b/
src/video/gl/gl_texture.cpp
@@
-118,8
+118,10
@@
GLTexture::GLTexture(SDL_Surface* image) :
sdl_format = GL_RGB;
else if(convert->format->BytesPerPixel == 4)
sdl_format = GL_RGBA;
sdl_format = GL_RGB;
else if(convert->format->BytesPerPixel == 4)
sdl_format = GL_RGBA;
- else
+ else {
+ sdl_format = GL_RGBA;
assert(false);
assert(false);
+ }
glBindTexture(GL_TEXTURE_2D, handle);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, handle);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
diff --git
a/src/video/glutil.hpp
b/src/video/glutil.hpp
index
2b46f6d
..
e51240d
100644
(file)
--- a/
src/video/glutil.hpp
+++ b/
src/video/glutil.hpp
@@
-41,7
+41,6
@@
static inline void check_gl_error(const char* message)
{
static inline void check_gl_error(const char* message)
{
-#ifndef NDEBUG
GLenum error = glGetError();
if(error != GL_NO_ERROR) {
std::ostringstream msg;
GLenum error = glGetError();
if(error != GL_NO_ERROR) {
std::ostringstream msg;
@@
-79,18
+78,11
@@
static inline void check_gl_error(const char* message)
throw std::runtime_error(msg.str());
}
throw std::runtime_error(msg.str());
}
-#else
- (void) message;
-#endif
}
static inline void assert_gl(const char* message)
{
}
static inline void assert_gl(const char* message)
{
-#ifndef NDEBUG
check_gl_error(message);
check_gl_error(message);
-#else
- (void) message;
-#endif
}
#else
}
#else