From c035a1c2b788a0a75d2d7954878cb068c6294686 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 20 Jun 2012 17:12:11 +0000 Subject: [PATCH] core: fix a few build warnings and remove useless operators from the "half" class. The build is now 3% faster. --- src/entity.cpp | 2 ++ src/layer.cpp | 2 +- src/lol/math/half.h | 6 ++---- src/ticker.cpp | 12 ++++++------ test/tutorial/01_triangle.cpp | 4 ---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/entity.cpp b/src/entity.cpp index 2498e36f..917e200f 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -52,6 +52,7 @@ char const *Entity::GetName() void Entity::TickGame(float seconds) { + (void)seconds; #if !LOL_RELEASE if (m_tickstate != STATE_PRETICK_GAME) Log::Error("invalid entity game tick\n"); @@ -61,6 +62,7 @@ void Entity::TickGame(float seconds) void Entity::TickDraw(float seconds) { + (void)seconds; #if !LOL_RELEASE if (m_tickstate != STATE_PRETICK_DRAW) Log::Error("invalid entity draw tick\n"); diff --git a/src/layer.cpp b/src/layer.cpp index 67828f04..d744ac68 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -45,7 +45,7 @@ Layer::~Layer() free(data); } -void Layer::Render(int x, int y, int z) +void Layer::Render(int /* x */, int /* y */, int /* z */) { static int error = 1; if (error && !(error = 0)) diff --git a/src/lol/math/half.h b/src/lol/math/half.h index 172c4f13..886a1f9b 100644 --- a/src/lol/math/half.h +++ b/src/lol/math/half.h @@ -156,10 +156,8 @@ static inline half clamp(half x, half a, half b) #define DECLARE_COERCE_FROM_HALF_OPS(type) \ DECLARE_COERCE_HALF_OPS(type, type, x, (type)h) -DECLARE_COERCE_TO_HALF_OPS(int8_t) -DECLARE_COERCE_TO_HALF_OPS(uint8_t) -DECLARE_COERCE_TO_HALF_OPS(int16_t) -DECLARE_COERCE_TO_HALF_OPS(uint16_t) +/* Only provide coercion rules above int32_t, since the standard says + * all smaller base types are coerced to int. */ DECLARE_COERCE_TO_HALF_OPS(int32_t) DECLARE_COERCE_TO_HALF_OPS(uint32_t) DECLARE_COERCE_TO_HALF_OPS(int64_t) diff --git a/src/ticker.cpp b/src/ticker.cpp index b5c7e340..fa02381b 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -151,7 +151,7 @@ int Ticker::Unref(Entity *entity) return --entity->m_ref; } -void *TickerData::GameThreadMain(void *p) +void *TickerData::GameThreadMain(void * /* p */) { for (;;) { @@ -296,7 +296,7 @@ void *TickerData::GameThreadMain(void *p) return NULL; } -void *TickerData::DrawThreadMain(void *p) +void *TickerData::DrawThreadMain(void * /* p */) { for (;;) { @@ -310,18 +310,18 @@ void *TickerData::DrawThreadMain(void *p) return NULL; } -void *TickerData::DiskThreadMain(void *p) +void *TickerData::DiskThreadMain(void * /* p */) { return NULL; } -void Ticker::SetState(Entity *entity, uint32_t state) +void Ticker::SetState(Entity * /* entity */, uint32_t /* state */) { } -void Ticker::SetStateWhenMatch(Entity *entity, uint32_t state, - Entity *other_entity, uint32_t other_state) +void Ticker::SetStateWhenMatch(Entity * /* entity */, uint32_t /* state */, + Entity * /* other_entity */, uint32_t /* other_state */) { } diff --git a/test/tutorial/01_triangle.cpp b/test/tutorial/01_triangle.cpp index be11ca95..80c08105 100644 --- a/test/tutorial/01_triangle.cpp +++ b/test/tutorial/01_triangle.cpp @@ -22,10 +22,6 @@ using namespace lol; # include #endif -#if defined __native_client__ -# define main old_main -#endif - #if defined _WIN32 # undef main /* FIXME: still needed? */ # include