diff --git a/doc/samples/benchmark/half.cpp b/doc/samples/benchmark/half.cpp index 9cb7349a..ef8ccd97 100644 --- a/doc/samples/benchmark/half.cpp +++ b/doc/samples/benchmark/half.cpp @@ -1,7 +1,7 @@ // // Lol Engine — Benchmark program // -// Copyright © 2005—2018 Sam Hocevar +// Copyright © 2005—2020 Sam Hocevar // // This program is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -17,6 +17,7 @@ #include #include +#include using namespace lol; diff --git a/doc/samples/benchmark/real.cpp b/doc/samples/benchmark/real.cpp index 4d1943bb..28b47f62 100644 --- a/doc/samples/benchmark/real.cpp +++ b/doc/samples/benchmark/real.cpp @@ -17,6 +17,7 @@ #include #include +#include #include using namespace lol; diff --git a/doc/samples/benchmark/vector.cpp b/doc/samples/benchmark/vector.cpp index 54478531..a8c2b2b0 100644 --- a/doc/samples/benchmark/vector.cpp +++ b/doc/samples/benchmark/vector.cpp @@ -1,7 +1,7 @@ // // Lol Engine — Benchmark program // -// Copyright © 2005—2018 Sam Hocevar +// Copyright © 2005—2020 Sam Hocevar // // This program is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -17,6 +17,7 @@ #include #include +#include using namespace lol; diff --git a/doc/samples/benchsuite.cpp b/doc/samples/benchsuite.cpp index 78ed105c..60acb614 100644 --- a/doc/samples/benchsuite.cpp +++ b/doc/samples/benchsuite.cpp @@ -1,7 +1,7 @@ // // Lol Engine — Benchmark program // -// Copyright © 2005—2015 Sam Hocevar +// Copyright © 2005—2020 Sam Hocevar // // This program is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -17,6 +17,7 @@ #include #include +#include using namespace lol; @@ -24,10 +25,8 @@ void bench_real(int mode); void bench_matrix(int mode); void bench_half(int mode); -int main(int argc, char **argv) +int main(int, char **) { - UNUSED(argc, argv); - msg::info("-----------------------\n"); msg::info(" High precision floats\n"); msg::info("-----------------------\n"); diff --git a/doc/samples/bluenoise.cpp b/doc/samples/bluenoise.cpp index 238bc05b..34a1d825 100644 --- a/doc/samples/bluenoise.cpp +++ b/doc/samples/bluenoise.cpp @@ -1,7 +1,7 @@ // // bluenoise — create a N×N blue noise kernel // -// Copyright © 2016—2017 Sam Hocevar +// Copyright © 2016—2020 Sam Hocevar // // This program is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -18,10 +18,8 @@ using namespace lol; -int main(int argc, char **argv) +int main(int, char **) { - UNUSED(argc, argv); - ivec2 const size(64); auto const &kernel = image::kernel::blue_noise(size, ivec2(8)); diff --git a/doc/samples/math/pi.cpp b/doc/samples/math/pi.cpp index 6f149d40..6e522661 100644 --- a/doc/samples/math/pi.cpp +++ b/doc/samples/math/pi.cpp @@ -22,10 +22,8 @@ using lol::real; -int main(int argc, char **argv) +int main(int, char **) { - UNUSED(argc, argv); - std::cout << std::setprecision(150); std::cout << " 0: " << real::R_0() << '\n'; std::cout << " 1: " << real::R_1() << '\n'; diff --git a/doc/samples/physics/lolphysics.h b/doc/samples/physics/lolphysics.h index c2d72e67..e08cd14c 100644 --- a/doc/samples/physics/lolphysics.h +++ b/doc/samples/physics/lolphysics.h @@ -14,6 +14,7 @@ #pragma once #include +#include #include #include @@ -152,10 +153,8 @@ public: { } - virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) + virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &, bool) { - UNUSED(rayResult); - UNUSED(normalInWorldSpace); return .0f; } }; @@ -194,7 +193,7 @@ public: } default: { - ASSERT(0, "Raycast not handled"); + assert(false); // Raycast not handled } } @@ -226,7 +225,7 @@ public: } default: { - ASSERT(0, "Raycast not handled"); + assert(false); // Raycast not handled } } } @@ -264,10 +263,8 @@ private: m_dynamics_world->setGravity(LOL2BT_VEC3(NewGravity * LOL2BT_UNIT)); } - void CustomSetWorldLimit(vec3 const &NewWorldMin, vec3 const &NewWorldMax) + void CustomSetWorldLimit(vec3 const &, vec3 const &) { - UNUSED(NewWorldMin); - UNUSED(NewWorldMax); } void CustomSetTimestep(float NewTimestep) { } @@ -371,7 +368,7 @@ private: } default: { - ASSERT(0, "Physic type does not exist."); + assert(false); // Physic type does not exist } } diff --git a/doc/samples/simplex.cpp b/doc/samples/simplex.cpp index e300c99f..d195d249 100644 --- a/doc/samples/simplex.cpp +++ b/doc/samples/simplex.cpp @@ -25,10 +25,8 @@ ivec2 const size(1280 * 1, 720 * 1); float const zoom = 0.03f / 1; int const octaves = 1; -int main(int argc, char **argv) +int main(int, char **) { - UNUSED(argc, argv); - srand(time(nullptr)); /* Create an image */ diff --git a/doc/tutorial/16_movie.cpp b/doc/tutorial/16_movie.cpp index 26f9f937..5415cf5f 100644 --- a/doc/tutorial/16_movie.cpp +++ b/doc/tutorial/16_movie.cpp @@ -15,14 +15,13 @@ #endif #include +#include #include #include #include -int main(int argc, char **argv) +int main(int, char **) { - UNUSED(argc, argv); - lol::ivec2 size(256, 256); lol::movie movie(size); diff --git a/doc/tutorial/17_net.cpp b/doc/tutorial/17_net.cpp index 477376bc..1eeebbed 100644 --- a/doc/tutorial/17_net.cpp +++ b/doc/tutorial/17_net.cpp @@ -15,6 +15,7 @@ #endif #include +#include class demo : public lol::entity { diff --git a/src/application/application.cpp b/src/application/application.cpp index 44d31e02..edba6ce3 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #if HAVE_EMSCRIPTEN_H # include diff --git a/src/application/egl-app.cpp b/src/application/egl-app.cpp index b5ddda18..5934d3ff 100644 --- a/src/application/egl-app.cpp +++ b/src/application/egl-app.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2016 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #if defined LOL_USE_EGL && !defined __ANDROID__ # if defined HAVE_BCM_HOST_H diff --git a/src/application/sdl-app.cpp b/src/application/sdl-app.cpp index eb6ce43b..ea934896 100644 --- a/src/application/sdl-app.cpp +++ b/src/application/sdl-app.cpp @@ -11,6 +11,7 @@ // #include +#include #if LOL_USE_SDL # if HAVE_SDL2_SDL_H @@ -155,7 +156,7 @@ const char* SceneDisplay::GetPhysicalName(int index) */ sdl::app::app(char const *title, ivec2 res, float fps) { - UNUSED(title); + (void)title; #if LOL_USE_SDL ivec2 window_size = res; ivec2 screen_size = res; diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index a1d4dc0b..5bc799b6 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #include #include diff --git a/src/audio/sample.cpp b/src/audio/sample.cpp index df5e411d..a3f99aa1 100644 --- a/src/audio/sample.cpp +++ b/src/audio/sample.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #include #include diff --git a/src/base/assert.cpp b/src/base/assert.cpp index 14650425..efcbd21a 100644 --- a/src/base/assert.cpp +++ b/src/base/assert.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #if HAVE_CXXABI_H # include diff --git a/src/easymesh/easymeshbuild.h b/src/easymesh/easymeshbuild.h index d30cfbdb..d9239a54 100644 --- a/src/easymesh/easymeshbuild.h +++ b/src/easymesh/easymeshbuild.h @@ -338,7 +338,8 @@ public: { /* unused for now, but will be if new BuildType are added. */ TexCoordBuildType tcbt = GetTexCoordBuildType(mt); - UNUSED(tcbt); + (void)tcbt; + if (mt == MeshType::Quad) { // There's nothin' else than QuadDefault @@ -428,7 +429,8 @@ public: else { TexCoordBuildType tcbt = GetTexCoordBuildType2(mt); - UNUSED(tcbt); + (void)tcbt; + if (mt == MeshType::Quad) { // There's nothin' else than QuadDefault diff --git a/src/easymesh/easymeshinternal.cpp b/src/easymesh/easymeshinternal.cpp index f79ae72d..0f9d252a 100644 --- a/src/easymesh/easymeshinternal.cpp +++ b/src/easymesh/easymeshinternal.cpp @@ -280,7 +280,7 @@ void EasyMesh::VerticesSeparate() //----------------------------------------------------------------------------- void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset) { - UNUSED(uv_scale, uv_offset); + (void)uv_scale; (void)uv_offset; #if 0 VertexDictionnary vert_dict; easy_array tri_list; diff --git a/src/easymesh/easymeshprimitive.cpp b/src/easymesh/easymeshprimitive.cpp index ae700340..d11d5a2a 100644 --- a/src/easymesh/easymeshprimitive.cpp +++ b/src/easymesh/easymeshprimitive.cpp @@ -922,7 +922,7 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20, j, j, j, j, \ k, j, j, k \ }; \ - UNUSED(q); + (void)q; int m[] = { /* The top and bottom faces */ 0, 2, 3, 1, 7, 9, 8, 6, diff --git a/src/easymesh/easymeshrender.cpp b/src/easymesh/easymeshrender.cpp index 41e24774..171f87f8 100644 --- a/src/easymesh/easymeshrender.cpp +++ b/src/easymesh/easymeshrender.cpp @@ -13,6 +13,7 @@ // #include +#include <../legacy/lol/base/assert.h> namespace lol { @@ -179,7 +180,8 @@ void DefaultShaderData::StoreUniformNames() //----------------------------------------------------------------------------- void DefaultShaderData::SetupDefaultData(bool with_UV) { - UNUSED(with_UV); + (void)with_UV; + for (int i = 0; i < 7; i++) AddUniform(DefaultUniforms[i]); } diff --git a/src/easymesh/easymeshrender.h b/src/easymesh/easymeshrender.h index d809e2dd..0b6ff326 100644 --- a/src/easymesh/easymeshrender.h +++ b/src/easymesh/easymeshrender.h @@ -87,7 +87,7 @@ public: ShaderUniform const *GetUniform(std::string const &uniform); ShaderAttrib const *GetAttribute(VertexUsage usage, int index); //-- - virtual void SetupShaderDatas(mat4 const &model) { UNUSED(model); } + virtual void SetupShaderDatas(mat4 const &) { } //-- protected: diff --git a/src/engine/entity.cpp b/src/engine/entity.cpp index fe5897ef..3fba33ed 100644 --- a/src/engine/entity.cpp +++ b/src/engine/entity.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #include @@ -46,9 +47,8 @@ std::string entity::GetName() const return ""; } -void entity::tick_game(float seconds) +void entity::tick_game(float) { - UNUSED(seconds); #if !LOL_BUILD_RELEASE if (m_tickstate != tickable::state::pre_game) msg::error("invalid entity game tick\n"); @@ -56,9 +56,8 @@ void entity::tick_game(float seconds) #endif } -void entity::tick_draw(float seconds, Scene &scene) +void entity::tick_draw(float, Scene &) { - UNUSED(seconds, scene); #if !LOL_BUILD_RELEASE if (m_tickstate != tickable::state::pre_draw) msg::error("invalid entity draw tick\n"); @@ -66,5 +65,5 @@ void entity::tick_draw(float seconds, Scene &scene) #endif } -} /* namespace lol */ +} // namespace lol diff --git a/src/engine/ticker.cpp b/src/engine/ticker.cpp index a6f5c31f..058a5e61 100644 --- a/src/engine/ticker.cpp +++ b/src/engine/ticker.cpp @@ -11,6 +11,8 @@ // #include +#include +#include <../legacy/lol/base/assert.h> #include // std::unordered_set #include diff --git a/src/gpu/debug.cpp b/src/gpu/debug.cpp index 7d8cbd92..f5da43c8 100644 --- a/src/gpu/debug.cpp +++ b/src/gpu/debug.cpp @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include "lolgl.h" diff --git a/src/gpu/framebuffer.cpp b/src/gpu/framebuffer.cpp index c0a81013..e99d2124 100644 --- a/src/gpu/framebuffer.cpp +++ b/src/gpu/framebuffer.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> // FIXME: fine-tune this define #if defined LOL_USE_GLEW || defined HAVE_GL_2X || defined HAVE_GLES_2X diff --git a/src/gpu/indexbuffer.cpp b/src/gpu/indexbuffer.cpp index 2468f1e5..61d2ac42 100644 --- a/src/gpu/indexbuffer.cpp +++ b/src/gpu/indexbuffer.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2017 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -69,7 +69,7 @@ void *IndexBuffer::lock(size_t offset, size_t size) if (!m_data->m_size) return nullptr; - UNUSED(size); + (void)size; return m_data->m_memory + offset; } diff --git a/src/gpu/lolfx.cpp b/src/gpu/lolfx.cpp index 9ef6290e..a7613e4b 100644 --- a/src/gpu/lolfx.cpp +++ b/src/gpu/lolfx.cpp @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2020 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // // @@ -29,10 +31,8 @@ LolFx::LolFx() ; } -bool LolFx::Compile(char const *command) +bool LolFx::Compile(char const *) { - UNUSED(command); - return false; } diff --git a/src/gpu/renderer.cpp b/src/gpu/renderer.cpp index 5c5f3175..4ced246a 100644 --- a/src/gpu/renderer.cpp +++ b/src/gpu/renderer.cpp @@ -11,6 +11,7 @@ // #include +#include #include diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 47563318..7f9c43dc 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -11,7 +11,9 @@ // #include +#include #include +#include <../legacy/lol/base/assert.h> #include #include diff --git a/src/gpu/vertexbuffer.cpp b/src/gpu/vertexbuffer.cpp index e50e35b5..bb38a88d 100644 --- a/src/gpu/vertexbuffer.cpp +++ b/src/gpu/vertexbuffer.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #include "lolgl.h" @@ -382,7 +383,7 @@ void *VertexBuffer::lock(size_t offset, size_t size) return nullptr; /* FIXME: is there a way to use "size"? */ - UNUSED(size); + (void)size; return m_data->m_memory + offset; } diff --git a/src/image/codec/dummy-image.cpp b/src/image/codec/dummy-image.cpp index 7885b390..6550f29d 100644 --- a/src/image/codec/dummy-image.cpp +++ b/src/image/codec/dummy-image.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include @@ -60,10 +61,8 @@ ResourceCodecData* DummyImageCodec::Load(std::string const &path) return data; } -bool DummyImageCodec::Save(std::string const &path, ResourceCodecData* data) +bool DummyImageCodec::Save(std::string const &, ResourceCodecData *) { - UNUSED(path, data); - return false; } diff --git a/src/image/codec/imlib2-image.cpp b/src/image/codec/imlib2-image.cpp index 33544b62..e8f6e4f5 100644 --- a/src/image/codec/imlib2-image.cpp +++ b/src/image/codec/imlib2-image.cpp @@ -11,6 +11,7 @@ // #include +#include #if defined LOL_USE_IMLIB2 diff --git a/src/image/codec/sdl-image.cpp b/src/image/codec/sdl-image.cpp index ef3327aa..9ff28d1d 100644 --- a/src/image/codec/sdl-image.cpp +++ b/src/image/codec/sdl-image.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2019 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include #if LOL_USE_SDL_IMAGE diff --git a/src/image/combine.cpp b/src/image/combine.cpp index b59e7514..f7271f11 100644 --- a/src/image/combine.cpp +++ b/src/image/combine.cpp @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> /* * Image merge operations: merge, min/max, overlay, screen, multiply, diff --git a/src/image/image.cpp b/src/image/image.cpp index 8aa613bb..e24fe22c 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include "image-private.h" diff --git a/src/image/movie.cpp b/src/image/movie.cpp index afdabf4c..3f4e9757 100644 --- a/src/image/movie.cpp +++ b/src/image/movie.cpp @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include #if LOL_USE_FFMPEG diff --git a/src/image/pixel.cpp b/src/image/pixel.cpp index 0e000cb5..3cd31e10 100644 --- a/src/image/pixel.cpp +++ b/src/image/pixel.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2004—2019 Sam Hocevar +// Copyright © 2004—2020 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include "image-private.h" diff --git a/src/image/resource.cpp b/src/image/resource.cpp index 3bd782bc..a7d1572e 100644 --- a/src/image/resource.cpp +++ b/src/image/resource.cpp @@ -2,7 +2,7 @@ // Lol Engine // // Copyright © 2010—2020 Sam Hocevar -// Copyright © 2016—2017 Benjamin “Touky” Huet +// © 2016—2017 Benjamin “Touky” Huet // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -12,6 +12,7 @@ // #include +#include #include "resource-private.h" diff --git a/src/lol/base/all.h b/src/lol/base/all.h index c2256619..448e2073 100644 --- a/src/lol/base/all.h +++ b/src/lol/base/all.h @@ -13,10 +13,8 @@ #pragma once #include -#include #include <../legacy/lol/base/types.h> -#include <../legacy/lol/base/assert.h> #include <../legacy/lol/base/avl_tree.h> #include diff --git a/src/lol/gpu/vertexbuffer.h b/src/lol/gpu/vertexbuffer.h index a736d302..b9af8676 100644 --- a/src/lol/gpu/vertexbuffer.h +++ b/src/lol/gpu/vertexbuffer.h @@ -129,7 +129,7 @@ public: protected: #define __T(T) \ - static uint8_t GetType(T *x) { UNUSED(x); return Type##T; } + static uint8_t GetType(T *) { return Type##T; } __T(void) __T(half) __T(f16vec2) __T(f16vec3) __T(f16vec4) @@ -158,11 +158,10 @@ private: static VertexStreamBase const Empty; }; -/* Specialise this template for "void" to act as a NOP */ +// Specialise this template for "void" to act as a NOP template<> -inline void VertexStreamBase::AddStream(int n, VertexUsage usage) +inline void VertexStreamBase::AddStream(int n, VertexUsage) { - UNUSED(usage); m_streams[n].size = 0; } diff --git a/src/lolua/baselua.h b/src/lolua/baselua.h index a44528c0..ef917dc3 100644 --- a/src/lolua/baselua.h +++ b/src/lolua/baselua.h @@ -19,6 +19,8 @@ extern "C" { #include "3rdparty/lua/lauxlib.h" } +#include <../legacy/lol/base/assert.h> + #include // std::vector #include // std::string #include // tolower @@ -111,10 +113,8 @@ public: public: Object() { } virtual ~Object() { } - static Object* New(lua_State* l, int arg_nb) + static Object* New(lua_State*, int) { - UNUSED(l); - UNUSED(arg_nb); ASSERT(false); return nullptr; } @@ -243,17 +243,17 @@ protected: template static int Store(lua_State * l); template static int Del(lua_State * l); //------------------------------------------------------------------------- - template static int ToString(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpAdd(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpSubstract(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpMultiply(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpDivide(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpModulo(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpUnaryNeg(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int OpConcat(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int CmpEqual(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int CmpLessThan(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } - template static int CmpLessEqual(lua_State* l) { UNUSED(l); ASSERT(false); return 0; } + template static int ToString(lua_State*) { ASSERT(false); return 0; } + template static int OpAdd(lua_State*) { ASSERT(false); return 0; } + template static int OpSubstract(lua_State*) { ASSERT(false); return 0; } + template static int OpMultiply(lua_State*) { ASSERT(false); return 0; } + template static int OpDivide(lua_State*) { ASSERT(false); return 0; } + template static int OpModulo(lua_State*) { ASSERT(false); return 0; } + template static int OpUnaryNeg(lua_State*) { ASSERT(false); return 0; } + template static int OpConcat(lua_State*) { ASSERT(false); return 0; } + template static int CmpEqual(lua_State*) { ASSERT(false); return 0; } + template static int CmpLessThan(lua_State*) { ASSERT(false); return 0; } + template static int CmpLessEqual(lua_State*) { ASSERT(false); return 0; } }; //----------------------------------------------------------------------------- @@ -385,8 +385,8 @@ protected: #define INNER_ERROR "Your type is not implemented. For pointers, use LuaPtr()" template T InnerDefault() { return T(0); } template bool InnerIsValid() { ASSERT(false, INNER_ERROR); return false; } - template T InnerGet(T value) { UNUSED(value); ASSERT(false, INNER_ERROR); return InnerDefault(); } - template int InnerPush(T value) { UNUSED(value); ASSERT(false, INNER_ERROR); return 0; } + template T InnerGet(T) { ASSERT(false, INNER_ERROR); return InnerDefault(); } + template int InnerPush(T) { ASSERT(false, INNER_ERROR); return 0; } #ifndef INNER_SAFE_ENUM // Gets the value for the given enum type. @@ -505,16 +505,16 @@ private: #ifndef REGION_STACK_VAR #ifndef STACK_BOOL -template<> inline bool Stack::InnerIsValid() { return lua_isboolean(m_state, m_index); } -template<> inline bool Stack::InnerGet(bool value) { UNUSED(value); return !!lua_toboolean(m_state, m_index++); } +template<> inline bool Stack::InnerIsValid() { return lua_isboolean(m_state, m_index); } +template<> inline bool Stack::InnerGet(bool) { return !!lua_toboolean(m_state, m_index++); } template<> inline int Stack::InnerPush(bool value) { lua_pushboolean(m_state, value); return 1; } #endif // STACK_BOOL //----------------------------------------------------------------------------- #ifndef STACK_CHAR_CONST -template<> inline bool Stack::InnerIsValid() { return !!lua_isstring(m_state, m_index); } -template<> inline char const* Stack::InnerGet(char const* value) { UNUSED(value); return lua_tostring(m_state, m_index++); } -template<> inline int Stack::InnerPush(char const* value) { lua_pushstring(m_state, value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isstring(m_state, m_index); } +template<> inline char const* Stack::InnerGet(char const *) { return lua_tostring(m_state, m_index++); } +template<> inline int Stack::InnerPush(char const* value) { lua_pushstring(m_state, value); return 1; } #endif // STACK_CHAR_CONST //----------------------------------------------------------------------------- @@ -527,9 +527,9 @@ template<> inline int Stack::InnerPush(std::string value) { //----------------------------------------------------------------------------- #ifndef STACK_STRING -template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } -template<> inline double Stack::InnerGet(double value) { UNUSED(value); return lua_tonumber(m_state, m_index++); } -template<> inline int Stack::InnerPush(double value) { lua_pushnumber(m_state, value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } +template<> inline double Stack::InnerGet(double) { return lua_tonumber(m_state, m_index++); } +template<> inline int Stack::InnerPush(double value) { lua_pushnumber(m_state, value); return 1; } #endif //STACK_STRING //----------------------------------------------------------------------------- @@ -541,30 +541,30 @@ template<> inline int Stack::InnerPush(float value) { return InnerPush inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } -template<> inline int64_t Stack::InnerGet(int64_t value) { UNUSED(value); return lua_tointeger(m_state, m_index++); } -template<> inline int Stack::InnerPush(int64_t value) { lua_pushinteger(m_state, value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } +template<> inline int64_t Stack::InnerGet(int64_t) { return lua_tointeger(m_state, m_index++); } +template<> inline int Stack::InnerPush(int64_t value) { lua_pushinteger(m_state, value); return 1; } #endif //STACK_INT64 //----------------------------------------------------------------------------- #ifndef STACK_UINT64 -template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } -template<> inline uint64_t Stack::InnerGet(uint64_t value) { UNUSED(value); return (uint64_t)lua_tointeger(m_state, m_index++); } -template<> inline int Stack::InnerPush(uint64_t value) { lua_pushinteger(m_state, (lua_Unsigned)value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } +template<> inline uint64_t Stack::InnerGet(uint64_t) { return (uint64_t)lua_tointeger(m_state, m_index++); } +template<> inline int Stack::InnerPush(uint64_t value) { lua_pushinteger(m_state, (lua_Unsigned)value); return 1; } #endif //STACK_UINT64 //----------------------------------------------------------------------------- #ifndef STACK_INT32 -template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } -template<> inline int32_t Stack::InnerGet(int32_t value) { UNUSED(value); return (int32_t)lua_tointeger(m_state, m_index++); } -template<> inline int Stack::InnerPush(int32_t value) { lua_pushinteger(m_state, (lua_Integer)value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } +template<> inline int32_t Stack::InnerGet(int32_t) { return (int32_t)lua_tointeger(m_state, m_index++); } +template<> inline int Stack::InnerPush(int32_t value) { lua_pushinteger(m_state, (lua_Integer)value); return 1; } #endif // STACK_INT32 //----------------------------------------------------------------------------- #ifndef STACK_UINT32 -template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } -template<> inline uint32_t Stack::InnerGet(uint32_t value) { UNUSED(value); return (uint32_t)(lua_Unsigned)lua_tointeger(m_state, m_index++); } -template<> inline int Stack::InnerPush(uint32_t value) { lua_pushinteger(m_state, (lua_Unsigned)value); return 1; } +template<> inline bool Stack::InnerIsValid() { return !!lua_isnumber(m_state, m_index); } +template<> inline uint32_t Stack::InnerGet(uint32_t) { return (uint32_t)(lua_Unsigned)lua_tointeger(m_state, m_index++); } +template<> inline int Stack::InnerPush(uint32_t value) { lua_pushinteger(m_state, (lua_Unsigned)value); return 1; } #endif //STACK_UINT32 //----------------------------------------------------------------------------- @@ -625,7 +625,7 @@ protected: static void Release(lua_State* l, Loader* loader); static void StoreObject(lua_State* l, Object* obj); //Virtual Store lua object ------------------------------------------------ - virtual void Store(Object* obj) { UNUSED(obj); } + virtual void Store(Object*) { } private: lua_State* m_lua_state; diff --git a/src/mesh/mesh.cpp b/src/mesh/mesh.cpp index e7e36198..45c8d6e5 100644 --- a/src/mesh/mesh.cpp +++ b/src/mesh/mesh.cpp @@ -11,6 +11,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include // std::shared_ptr #include // std::make_tuple diff --git a/src/mesh/primitivemesh.cpp b/src/mesh/primitivemesh.cpp index 6cbc4415..387acce1 100644 --- a/src/mesh/primitivemesh.cpp +++ b/src/mesh/primitivemesh.cpp @@ -43,7 +43,7 @@ void PrimitiveMesh::Render(Scene& scene, std::shared_ptr primit ShaderAttrib a_pos, a_tex; /* FIXME: ignored for now */ - UNUSED(primitive); + (void)primitive; { /* If this primitive uses a new shader, update attributes */ diff --git a/src/net/http.cpp b/src/net/http.cpp index fdcd2874..2270168b 100644 --- a/src/net/http.cpp +++ b/src/net/http.cpp @@ -11,6 +11,7 @@ // #include +#include #if LOL_USE_OPENSSL # define CPPHTTPLIB_OPENSSL_SUPPORT 1 diff --git a/src/scene.cpp b/src/scene.cpp index fccc1c25..824bdd49 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -12,6 +12,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include #include @@ -50,7 +51,7 @@ static inline void gpu_marker(char const *message) if (GLEW_GREMEDY_string_marker) glStringMarkerGREMEDY(0, message); #else - UNUSED(message); + (void)message; #endif } @@ -94,12 +95,12 @@ void SceneDisplay::Disable() * Primitive implementation class */ -void PrimitiveSource::Render(Scene& scene) { UNUSED(scene); } +void PrimitiveSource::Render(Scene &) +{ +} -void PrimitiveRenderer::Render(Scene& scene, std::shared_ptr primitive) +void PrimitiveRenderer::Render(Scene &, std::shared_ptr) { - UNUSED(scene); - UNUSED(primitive); } /* @@ -713,8 +714,10 @@ void Scene::render_lines(float seconds) std::vector> buff; buff.resize(linecount); int real_linecount = 0; + mat4 const inv_view_proj = inverse(GetCamera()->GetProjection() * GetCamera()->GetView()); - UNUSED(inv_view_proj); + (void)inv_view_proj; + for (size_t i = 0; i < linecount; i++) { if (m_line_api.m_lines[i].mask & m_line_api.m_debug_mask) diff --git a/src/scene.h b/src/scene.h index 3971fda4..0619174a 100644 --- a/src/scene.h +++ b/src/scene.h @@ -81,10 +81,10 @@ public: virtual ~SceneDisplay() { } /* pos/size/... methods */ - virtual void set_resolution(ivec2 resolution) { UNUSED(resolution); } + virtual void set_resolution(ivec2) { } virtual ivec2 resolution() const { return ivec2(0); } - virtual void SetPosition(ivec2 position) { UNUSED(position); } + virtual void SetPosition(ivec2) { } /* TODO: Should that be there or in Video ? */ static void Add(SceneDisplay* display); @@ -152,7 +152,6 @@ public: template int HasPrimitiveSource(T* key) { - ASSERT(key); return HasPrimitiveSource(_KEY_IDX); } /* Add a primitive sources linked to the given entity @@ -160,7 +159,6 @@ public: template int AddPrimitiveSource(T* key, std::shared_ptr source) { - ASSERT(key); return AddPrimitiveSource(_KEY_IDX, source); } /* Update the primitive source at index linked to the given entity @@ -169,21 +167,18 @@ public: template void SetPrimitiveSource(int index, T* key, std::shared_ptr source) { - ASSERT(key); SetPrimitiveSource(index, _KEY_IDX, source); } /* Remove primitive source at index set to the given entity */ template void ReleasePrimitiveSource(int index, T* key) { - ASSERT(key); ReleasePrimitiveSource(index, _KEY_IDX); } /* Remove all primitive source set to the given entity */ template void ReleaseAllPrimitiveSources(T* key) { - ASSERT(key); ReleaseAllPrimitiveSources(_KEY_IDX); } @@ -200,7 +195,6 @@ public: template int HasPrimitiveRenderer(T* key) { - ASSERT(key); return HasPrimitiveRenderer(_KEY_IDX); } /* Add a primitive renderer linked to the given entity @@ -209,7 +203,6 @@ public: template void AddPrimitiveRenderer(T* key, std::shared_ptr renderer) { - ASSERT(key); AddPrimitiveRenderer(_KEY_IDX, renderer); } /* Update the primitive renderer linked to the given entity @@ -218,21 +211,18 @@ public: template void SetPrimitiveRenderer(int index, T* key, std::shared_ptr renderer) { - ASSERT(key && renderer); SetPrimitiveRenderer(index, _KEY_IDX, renderer); } /* Remove primitive renderer at index set to the given entity */ template void ReleasePrimitiveRenderer(int index, T* key) { - ASSERT(key); ReleasePrimitiveRenderer(index, _KEY_IDX); } /* Remove all primitive renderer set to the given entity */ template void ReleaseAllPrimitiveRenderers(T* key) { - ASSERT(key); ReleaseAllPrimitiveRenderers(_KEY_IDX); } /* ============================== */ diff --git a/src/sys/file.cpp b/src/sys/file.cpp index 6938f248..43d1efcc 100644 --- a/src/sys/file.cpp +++ b/src/sys/file.cpp @@ -350,7 +350,7 @@ class DirectoryData void Open(std::string const &directory, FileAccess mode) { - UNUSED(mode); /* FIXME */ + (void)mode; /* FIXME */ m_type = StreamType::File; #if __ANDROID__ @@ -541,8 +541,9 @@ bool Directory::GetContent(std::vector* files, std::vector* directories) { std::vector sfiles, sdirectories; + bool found_some = m_data->GetContentList(&sfiles, &sdirectories); - UNUSED(found_some); + (void)found_some; if (directories) for (auto const &sdir : sdirectories) diff --git a/src/sys/init.cpp b/src/sys/init.cpp index 43d19c33..137e1c8e 100644 --- a/src/sys/init.cpp +++ b/src/sys/init.cpp @@ -11,6 +11,7 @@ // #include +#include #include // std::vector #include // std::string diff --git a/src/ui/gui.cpp b/src/ui/gui.cpp index f7e54bdf..98b6d2ad 100644 --- a/src/ui/gui.cpp +++ b/src/ui/gui.cpp @@ -12,6 +12,7 @@ // #include +#include <../legacy/lol/base/assert.h> #include #include @@ -292,7 +293,7 @@ bool gui::release_draw() void gui::primitive::Render(Scene& scene, std::shared_ptr prim) { - UNUSED(scene, prim); + (void)scene; (void)prim; ImGui::Render(); ImGui::EndFrame(); diff --git a/src/ui/sdl-input.cpp b/src/ui/sdl-input.cpp index c468e458..ce4ef03d 100644 --- a/src/ui/sdl-input.cpp +++ b/src/ui/sdl-input.cpp @@ -140,7 +140,7 @@ void SdlInput::tick(float seconds) { #if LOL_USE_SDL /* FIXME: maybe we should make use of this? */ - UNUSED(seconds); + (void)seconds; auto keyboard = input::keyboard(); auto mouse = input::mouse(); @@ -313,7 +313,7 @@ void SdlInput::tick(float seconds) m_prev_mouse_pos = mouse_pos; #else - UNUSED(seconds); + (void)seconds; #endif //LOL_USE_SDL }