From 45d1cb1225e61ccd74bc5bf308289ebccd5c4bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Jul 2012 16:48:29 +0200 Subject: [PATCH] Anonymized unused function parameters. --- src/Contexts/GlutContext.h | 11 ++++-- src/Contexts/Sdl2Context.cpp | 2 +- src/Contexts/Sdl2Context.h | 17 +++++--- src/Math/Math.h | 2 +- src/Math/Matrix.h | 6 +-- src/Math/Vector.h | 4 +- src/MeshTools/Interleave.h | 2 +- src/MeshTools/Test/CleanTest.h | 4 +- src/MeshTools/Test/SubdivideTest.h | 4 +- src/Object.h | 11 ++++-- src/Scene.h | 2 +- src/Trade/AbstractImporter.cpp | 4 +- src/Trade/AbstractImporter.h | 62 ++++++++++++++++++++---------- 13 files changed, 84 insertions(+), 47 deletions(-) diff --git a/src/Contexts/GlutContext.h b/src/Contexts/GlutContext.h index 9b9c84595..454bd5b0a 100644 --- a/src/Contexts/GlutContext.h +++ b/src/Contexts/GlutContext.h @@ -127,7 +127,7 @@ class GlutContext: public AbstractContext { * * Called when an key is pressed. Default implementation does nothing. */ - virtual inline void keyEvent(Key key, const Math::Vector2& position) {} + virtual void keyEvent(Key key, const Math::Vector2& position); /*@}*/ @@ -182,7 +182,7 @@ class GlutContext: public AbstractContext { * Called when mouse button is pressed or released. Default * implementation does nothing. */ - virtual inline void mouseEvent(MouseButton button, MouseState state, const Math::Vector2& position) {} + virtual void mouseEvent(MouseButton button, MouseState state, const Math::Vector2& position); /** * @brief Mouse motion event @@ -192,7 +192,7 @@ class GlutContext: public AbstractContext { * * @see setMouseTracking() */ - virtual inline void mouseMotionEvent(const Math::Vector2& position) {} + virtual void mouseMotionEvent(const Math::Vector2& position); /*@}*/ @@ -223,6 +223,11 @@ class GlutContext: public AbstractContext { char** argv; }; +/* Implementations for inline functions with unused parameters */ +inline void GlutContext::keyEvent(GlutContext::Key, const Math::Vector2&) {} +inline void GlutContext::mouseEvent(GlutContext::MouseButton, GlutContext::MouseState, const Math::Vector2&) {} +inline void GlutContext::mouseMotionEvent(const Math::Vector2&) {} + }} #endif diff --git a/src/Contexts/Sdl2Context.cpp b/src/Contexts/Sdl2Context.cpp index 3959db0ee..472b9fc95 100644 --- a/src/Contexts/Sdl2Context.cpp +++ b/src/Contexts/Sdl2Context.cpp @@ -17,7 +17,7 @@ namespace Magnum { namespace Contexts { -Sdl2Context::Sdl2Context(int argc, char** argv, const std::string& name, const Math::Vector2& size): _redraw(true) { +Sdl2Context::Sdl2Context(int, char**, const std::string& name, const Math::Vector2& size): _redraw(true) { if(SDL_Init(SDL_INIT_VIDEO) < 0) { Error() << "Cannot initialize SDL."; exit(1); diff --git a/src/Contexts/Sdl2Context.h b/src/Contexts/Sdl2Context.h index b441f44da..906daf49a 100644 --- a/src/Contexts/Sdl2Context.h +++ b/src/Contexts/Sdl2Context.h @@ -96,13 +96,13 @@ class Sdl2Context: public AbstractContext { * @param key Key pressed * @param repeat Non-zero if this is a key repeat */ - inline virtual void keyPressEvent(Key key, Uint8 repeat) {} + virtual void keyPressEvent(Key key, Uint8 repeat); /** * @brief Key release event * @param key Key release */ - inline virtual void keyReleaseEvent(Key key) {} + virtual void keyReleaseEvent(Key key); /*@}*/ @@ -138,7 +138,7 @@ class Sdl2Context: public AbstractContext { * Called when mouse button is pressed or released. Default * implementation does nothing. */ - virtual inline void mouseEvent(MouseButton button, MouseState state, const Math::Vector2& position) {} + virtual void mouseEvent(MouseButton button, MouseState state, const Math::Vector2& position); /** * @brief Mouse wheel event @@ -148,7 +148,7 @@ class Sdl2Context: public AbstractContext { * Called when mouse wheel is rotated. Default implementation does * nothing. */ - virtual inline void mouseWheelEvent(const Math::Vector2& direction) {} + virtual void mouseWheelEvent(const Math::Vector2& direction); /** * @brief Mouse motion event @@ -157,7 +157,7 @@ class Sdl2Context: public AbstractContext { * * Called when mouse is moved. Default implementation does nothing. */ - virtual inline void mouseMotionEvent(const Math::Vector2& position, const Math::Vector2& delta) {} + virtual void mouseMotionEvent(const Math::Vector2& position, const Math::Vector2& delta); /*@}*/ @@ -168,6 +168,13 @@ class Sdl2Context: public AbstractContext { bool _redraw; }; +/* Implementations for inline functions with unused parameters */ +inline void Sdl2Context::keyPressEvent(Sdl2Context::Key, Uint8) {} +inline void Sdl2Context::keyReleaseEvent(Sdl2Context::Key) {} +inline void Sdl2Context::mouseEvent(Sdl2Context::MouseButton, Sdl2Context::MouseState, const Math::Vector2&) {} +inline void Sdl2Context::mouseWheelEvent(const Math::Vector2&) {} +inline void Sdl2Context::mouseMotionEvent(const Math::Vector2&, const Math::Vector2&) {} + }} #endif diff --git a/src/Math/Math.h b/src/Math/Math.h index e6e7e24b5..7b56d7f5a 100644 --- a/src/Math/Math.h +++ b/src/Math/Math.h @@ -64,7 +64,7 @@ namespace Implementation { } }; template<> struct Pow<0> { - template inline constexpr T operator()(T base) const { return 1; } + template inline constexpr T operator()(T) const { return 1; } }; } #endif diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 24dee3c7d..47d6c41ee 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -117,10 +117,10 @@ template class Matrix { #endif /** @brief Copy constructor */ - inline constexpr Matrix(const Matrix& other) = default; + inline constexpr Matrix(const Matrix&) = default; /** @brief Assignment operator */ - inline Matrix& operator=(const Matrix& other) = default; + inline Matrix& operator=(const Matrix&) = default; /** * @brief Raw data @@ -244,7 +244,7 @@ template class Matrix { return from(s, next..., first[sequence]...); } - template inline constexpr static Matrix from(Implementation::Sequence s, T first, U... next) { + template inline constexpr static Matrix from(Implementation::Sequence, T first, U... next) { return Matrix(first, next...); } diff --git a/src/Math/Vector.h b/src/Math/Vector.h index d2321292c..3b1dc7057 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -109,10 +109,10 @@ template class Vector { } /** @brief Copy constructor */ - inline constexpr Vector(const Vector& other) = default; + inline constexpr Vector(const Vector&) = default; /** @brief Assignment operator */ - inline Vector& operator=(const Vector& other) = default; + inline Vector& operator=(const Vector&) = default; /** * @brief Raw data diff --git a/src/MeshTools/Interleave.h b/src/MeshTools/Interleave.h index faf0506cd..8376b1ae7 100644 --- a/src/MeshTools/Interleave.h +++ b/src/MeshTools/Interleave.h @@ -69,7 +69,7 @@ class Interleave { return first.size(); } - template inline static size_t stride(const T& first, const U&... next) { + template inline static size_t stride(const T&, const U&... next) { return sizeof(typename T::value_type) + stride(next...); } diff --git a/src/MeshTools/Test/CleanTest.h b/src/MeshTools/Test/CleanTest.h index fa28c6a11..98362d2e5 100644 --- a/src/MeshTools/Test/CleanTest.h +++ b/src/MeshTools/Test/CleanTest.h @@ -33,8 +33,8 @@ class CleanTest: public QObject { Vector1(): data(0) {} Vector1(int i): data(i) {} - int operator[](size_t i) const { return data; } - int& operator[](size_t i) { return data; } + int operator[](size_t) const { return data; } + int& operator[](size_t) { return data; } bool operator==(Vector1 i) const { return i.data == data; } Vector1 operator-(Vector1 i) const { return data-i.data; } diff --git a/src/MeshTools/Test/SubdivideTest.h b/src/MeshTools/Test/SubdivideTest.h index 2f5da2656..28ade77a0 100644 --- a/src/MeshTools/Test/SubdivideTest.h +++ b/src/MeshTools/Test/SubdivideTest.h @@ -34,8 +34,8 @@ class SubdivideTest: public QObject { Vector1(): data(0) {} Vector1(int i): data(i) {} - int operator[](size_t i) const { return data; } - int& operator[](size_t i) { return data; } + int operator[](size_t) const { return data; } + int& operator[](size_t) { return data; } bool operator==(Vector1 i) const { return i.data == data; } Vector1 operator-(Vector1 i) const { return data-i.data; } diff --git a/src/Object.h b/src/Object.h index 4c6494c0d..d4df67530 100644 --- a/src/Object.h +++ b/src/Object.h @@ -178,7 +178,7 @@ class MAGNUM_EXPORT Object { * * Default implementation does nothing. */ - virtual void draw(const Matrix4& transformationMatrix, Camera* camera) {} + virtual void draw(const Matrix4& transformationMatrix, Camera* camera); /** @{ @name Caching helpers * @@ -253,9 +253,7 @@ class MAGNUM_EXPORT Object { * } * @endcode */ - virtual inline void clean(const Matrix4& absoluteTransformation) { - dirty = false; - } + virtual void clean(const Matrix4& absoluteTransformation); /*@}*/ @@ -266,6 +264,11 @@ class MAGNUM_EXPORT Object { bool dirty; }; +/* Implementations for inline functions with unused parameters */ +inline void Object::draw(const Matrix4&, Camera*) {} +inline void Object::clean(const Matrix4&) { dirty = false; } + + } #endif diff --git a/src/Scene.h b/src/Scene.h index 744d81262..076e6f4ef 100644 --- a/src/Scene.h +++ b/src/Scene.h @@ -39,7 +39,7 @@ class MAGNUM_EXPORT Scene: public Object { void rotate(GLfloat angle, Vector3 vec, Transformation type = Transformation::Global) = delete; private: - inline virtual void draw(const Magnum::Matrix4& transformationMatrix, Camera* camera) {} + inline void draw(const Magnum::Matrix4&, Camera*) {} }; } diff --git a/src/Trade/AbstractImporter.cpp b/src/Trade/AbstractImporter.cpp index 271d5be44..cfd07c7a3 100644 --- a/src/Trade/AbstractImporter.cpp +++ b/src/Trade/AbstractImporter.cpp @@ -19,12 +19,12 @@ using namespace std; namespace Magnum { namespace Trade { -bool AbstractImporter::open(const std::string& filename) { +bool AbstractImporter::open(const std::string&) { Error() << plugin() << "doesn't support opening files"; return false; } -bool AbstractImporter::open(std::istream& in) { +bool AbstractImporter::open(std::istream&) { Error() << plugin() << "doesn't support opening input streams"; return false; } diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index c0bdba48f..5faa77607 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -121,7 +121,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no scene for given name exists, returns -1. * @see SceneData::name() */ - virtual inline int sceneForName(const std::string& name) { return -1; } + virtual int sceneForName(const std::string& name); /** * @brief %Scene @@ -129,7 +129,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given scene or nullptr, if no such scene exists. */ - virtual inline SceneData* scene(unsigned int id) { return nullptr; } + virtual SceneData* scene(unsigned int id); /** @brief %Light count */ virtual inline unsigned int lightCount() const { return 0; } @@ -140,7 +140,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no light for given name exists, returns -1. * @see LightData::name() */ - virtual inline int lightForName(const std::string& name) { return -1; } + virtual int lightForName(const std::string& name); /** * @brief %Light @@ -148,7 +148,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given light or nullptr, if no such light exists. */ - virtual inline LightData* light(unsigned int id) { return nullptr; } + virtual LightData* light(unsigned int id); /** @brief %Camera count */ virtual inline unsigned int cameraCount() const { return 0; } @@ -159,7 +159,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no camera for given name exists, returns -1. * @see CameraData::name() */ - virtual inline int cameraForName(const std::string& name) { return -1; } + virtual int cameraForName(const std::string& name); /** * @brief %Camera @@ -168,7 +168,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * Returns pointer to given camera or nullptr, if no such camera * exists. */ - virtual inline CameraData* camera(unsigned int id) { return nullptr; } + virtual CameraData* camera(unsigned int id); /** @brief %Object count */ virtual inline unsigned int objectCount() const { return 0; } @@ -179,7 +179,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no scene for given name exists, returns -1. * @see ObjectData::name() */ - virtual inline int objectForName(const std::string& name) { return -1; } + virtual int objectForName(const std::string& name); /** * @brief %Object @@ -188,7 +188,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * Returns pointer to given object or nullptr, if no such object * exists. */ - virtual inline ObjectData* object(unsigned int id) { return nullptr; } + virtual ObjectData* object(unsigned int id); /** @brief %Mesh count */ virtual inline unsigned int meshCount() const { return 0; } @@ -199,7 +199,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no mesh for given name exists, returns -1. * @see MeshData::name() */ - virtual inline int meshForName(const std::string& name) { return -1; } + virtual int meshForName(const std::string& name); /** * @brief %Mesh @@ -207,7 +207,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given mesh or nullptr, if no such mesh exists. */ - virtual inline MeshData* mesh(unsigned int id) { return nullptr; } + virtual MeshData* mesh(unsigned int id); /** @brief Material count */ virtual inline unsigned int materialCount() const { return 0; } @@ -218,7 +218,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no material for given name exists, returns -1. * @see AbstractMaterialData::name() */ - virtual inline int materialForName(const std::string& name) { return -1; } + virtual int materialForName(const std::string& name); /** * @brief Material @@ -227,7 +227,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * Returns pointer to given material or nullptr, if no such material * exists. */ - virtual inline AbstractMaterialData* material(unsigned int id) { return nullptr; } + virtual AbstractMaterialData* material(unsigned int id); /** @brief %Texture count */ virtual inline unsigned int textureCount() const { return 0; } @@ -238,7 +238,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no texture for given name exists, returns -1. * @see TextureData::name() */ - virtual inline int textureForName(const std::string& name) { return -1; } + virtual int textureForName(const std::string& name); /** * @brief %Texture @@ -247,7 +247,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * Returns pointer to given texture or nullptr, if no such texture * exists. */ - virtual inline TextureData* texture(unsigned int id) { return nullptr; } + virtual TextureData* texture(unsigned int id); /** @brief One-dimensional image count */ virtual inline unsigned int image1DCount() const { return 0; } @@ -258,7 +258,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no image for given name exists, returns -1. * @see ImageData1D::name() */ - virtual inline int image1DForName(const std::string& name) { return -1; } + virtual int image1DForName(const std::string& name); /** * @brief One-dimensional image @@ -266,7 +266,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given image or nullptr, if no such image exists. */ - virtual inline ImageData1D* image1D(unsigned int id) { return nullptr; } + virtual ImageData1D* image1D(unsigned int id); /** @brief Two-dimensional image count */ virtual inline unsigned int image2DCount() const { return 0; } @@ -277,7 +277,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no image for given name exists, returns -1. * @see ImageData2D::name() */ - virtual inline int image2DForName(const std::string& name) { return -1; } + virtual int image2DForName(const std::string& name); /** * @brief Two-dimensional image @@ -285,7 +285,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given image or nullptr, if no such image exists. */ - virtual inline ImageData2D* image2D(unsigned int id) { return nullptr; } + virtual ImageData2D* image2D(unsigned int id); /** @brief Three-dimensional image count */ virtual inline unsigned int image3DCount() const { return 0; } @@ -296,7 +296,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * If no image for given name exists, returns -1. * @see ImageData3D::name() */ - virtual inline int image3DForName(const std::string& name) { return -1; } + virtual int image3DForName(const std::string& name); /** * @brief Three-dimensional image @@ -304,13 +304,35 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { * * Returns pointer to given image or nullptr, if no such image exists. */ - virtual inline ImageData3D* image3D(unsigned int id) { return nullptr; } + virtual ImageData3D* image3D(unsigned int id); /*@}*/ }; SET_OPERATORS(AbstractImporter::Features) +/* Implementations for inline functions with unused parameters */ +inline int AbstractImporter::sceneForName(const std::string&) { return -1; } +inline SceneData* AbstractImporter::scene(unsigned int) { return nullptr; } +inline int AbstractImporter::lightForName(const std::string&) { return -1; } +inline LightData* AbstractImporter::light(unsigned int) { return nullptr; } +inline int AbstractImporter::cameraForName(const std::string&) { return -1; } +inline CameraData* AbstractImporter::camera(unsigned int) { return nullptr; } +inline int AbstractImporter::objectForName(const std::string&) { return -1; } +inline ObjectData* AbstractImporter::object(unsigned int) { return nullptr; } +inline int AbstractImporter::meshForName(const std::string&) { return -1; } +inline MeshData* AbstractImporter::mesh(unsigned int) { return nullptr; } +inline int AbstractImporter::materialForName(const std::string&) { return -1; } +inline AbstractMaterialData* AbstractImporter::material(unsigned int) { return nullptr; } +inline int AbstractImporter::textureForName(const std::string&) { return -1; } +inline TextureData* AbstractImporter::texture(unsigned int) { return nullptr; } +inline int AbstractImporter::image1DForName(const std::string&) { return -1; } +inline ImageData1D* AbstractImporter::image1D(unsigned int) { return nullptr; } +inline int AbstractImporter::image2DForName(const std::string&) { return -1; } +inline ImageData2D* AbstractImporter::image2D(unsigned int) { return nullptr; } +inline int AbstractImporter::image3DForName(const std::string&) { return -1; } +inline ImageData3D* AbstractImporter::image3D(unsigned int) { return nullptr; } + }} #endif