From 7ce44f9775c520fd1723e5ef96d61e4831c62e9a Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Mon, 17 Aug 2015 06:44:26 +0200 Subject: [PATCH] Fix warnings --- CMakeLists.txt | 4 ++++ src/collision/CollisionDetection.cpp | 4 ++-- src/constraint/ContactPoint.h | 8 ++++---- src/constraint/Joint.h | 8 ++++---- src/engine/EventListener.h | 2 +- src/engine/OverlappingPair.h | 8 ++++---- test/Test.cpp | 2 +- test/tests/collision/TestPointInside.h | 2 -- testbed/CMakeLists.txt | 4 +--- testbed/common/Dumbbell.cpp | 2 -- testbed/scenes/cubes/CubesScene.cpp | 3 --- testbed/scenes/raycast/RaycastScene.h | 5 +---- 12 files changed, 22 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d052d6f..fa156a9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,10 @@ OPTION(COMPILE_TESTS "Select this if you want to build the tests" OFF) OPTION(PROFILING_ENABLED "Select this if you want to compile with enabled profiling" OFF) OPTION(DOUBLE_PRECISION_ENABLED "Select this if you want to compile using double precision floating values" OFF) + +# Compiler flags +set(CMAKE_CXX_FLAGS "-Wall") + # Headers INCLUDE_DIRECTORIES(src) diff --git a/src/collision/CollisionDetection.cpp b/src/collision/CollisionDetection.cpp index 22ab2e6d..1de5779c 100644 --- a/src/collision/CollisionDetection.cpp +++ b/src/collision/CollisionDetection.cpp @@ -92,8 +92,8 @@ void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* callbac OverlappingPair* pair = it->second; - ProxyShape* shape1 = pair->getShape1(); - ProxyShape* shape2 = pair->getShape2(); + const ProxyShape* shape1 = pair->getShape1(); + const ProxyShape* shape2 = pair->getShape2(); assert(shape1->mBroadPhaseID != shape2->mBroadPhaseID); diff --git a/src/constraint/ContactPoint.h b/src/constraint/ContactPoint.h index 9a1e1870..5f0d3aab 100644 --- a/src/constraint/ContactPoint.h +++ b/src/constraint/ContactPoint.h @@ -158,10 +158,10 @@ class ContactPoint { ~ContactPoint(); /// Return the reference to the body 1 - CollisionBody* const getBody1() const; + CollisionBody* getBody1() const; /// Return the reference to the body 2 - CollisionBody* const getBody2() const; + CollisionBody* getBody2() const; /// Return the normal vector of the contact Vector3 getNormal() const; @@ -231,12 +231,12 @@ class ContactPoint { }; // Return the reference to the body 1 -inline CollisionBody* const ContactPoint::getBody1() const { +inline CollisionBody* ContactPoint::getBody1() const { return mBody1; } // Return the reference to the body 2 -inline CollisionBody* const ContactPoint::getBody2() const { +inline CollisionBody* ContactPoint::getBody2() const { return mBody2; } diff --git a/src/constraint/Joint.h b/src/constraint/Joint.h index bbca0168..c6600a82 100644 --- a/src/constraint/Joint.h +++ b/src/constraint/Joint.h @@ -181,10 +181,10 @@ class Joint { virtual ~Joint(); /// Return the reference to the body 1 - RigidBody* const getBody1() const; + RigidBody* getBody1() const; /// Return the reference to the body 2 - RigidBody* const getBody2() const; + RigidBody* getBody2() const; /// Return true if the constraint is active bool isActive() const; @@ -206,7 +206,7 @@ class Joint { /** * @return The first body involved in the joint */ -inline RigidBody* const Joint::getBody1() const { +inline RigidBody* Joint::getBody1() const { return mBody1; } @@ -214,7 +214,7 @@ inline RigidBody* const Joint::getBody1() const { /** * @return The second body involved in the joint */ -inline RigidBody* const Joint::getBody2() const { +inline RigidBody* Joint::getBody2() const { return mBody2; } diff --git a/src/engine/EventListener.h b/src/engine/EventListener.h index aba5c63d..b9e6052d 100644 --- a/src/engine/EventListener.h +++ b/src/engine/EventListener.h @@ -53,7 +53,7 @@ class EventListener { /** * @param contact Information about the contact */ - virtual void beginContact(const ContactPointInfo& contact) {} + virtual void beginContact(const ContactPointInfo& contact) {}; /// Called when a new contact point is found between two bodies /** diff --git a/src/engine/OverlappingPair.h b/src/engine/OverlappingPair.h index c701bd5f..da16d6e4 100644 --- a/src/engine/OverlappingPair.h +++ b/src/engine/OverlappingPair.h @@ -82,10 +82,10 @@ class OverlappingPair { ~OverlappingPair(); /// Return the pointer to first proxy collision shape - ProxyShape* const getShape1() const; + ProxyShape* getShape1() const; /// Return the pointer to second body - ProxyShape* const getShape2() const; + ProxyShape* getShape2() const; /// Add a contact to the contact cache void addContact(ContactPoint* contact); @@ -120,12 +120,12 @@ class OverlappingPair { }; // Return the pointer to first body -inline ProxyShape* const OverlappingPair::getShape1() const { +inline ProxyShape* OverlappingPair::getShape1() const { return mShape1; } // Return the pointer to second body -inline ProxyShape* const OverlappingPair::getShape2() const { +inline ProxyShape* OverlappingPair::getShape2() const { return mShape2; } diff --git a/test/Test.cpp b/test/Test.cpp index 45adea73..ef7a404d 100644 --- a/test/Test.cpp +++ b/test/Test.cpp @@ -32,7 +32,7 @@ using namespace reactphysics3d; /// Constructor Test::Test(const std::string& name, std::ostream* stream) - : mName(name), mOutputStream(stream), mNbPassedTests(0), mNbFailedTests(0) { + : mName(name), mNbPassedTests(0), mNbFailedTests(0), mOutputStream(stream) { } diff --git a/test/tests/collision/TestPointInside.h b/test/tests/collision/TestPointInside.h index f8e8359b..bea06999 100644 --- a/test/tests/collision/TestPointInside.h +++ b/test/tests/collision/TestPointInside.h @@ -470,8 +470,6 @@ class TestPointInside : public Test { // ----- Tests without using edges information ----- // - bool value = mConvexMeshBody->testPointInside(Vector3(0, 0, 0)); - // Tests with CollisionBody test(mConvexMeshBody->testPointInside(mLocalShapeToWorld * Vector3(0, 0, 0))); test(mConvexMeshBody->testPointInside(mLocalShapeToWorld * Vector3(-1.9, 0, 0))); diff --git a/testbed/CMakeLists.txt b/testbed/CMakeLists.txt index cd66c695..b81a6fec 100644 --- a/testbed/CMakeLists.txt +++ b/testbed/CMakeLists.txt @@ -23,9 +23,7 @@ FILE(COPY "meshes/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/meshes/") FILE(COPY "imgui/DroidSans.ttf" DESTINATION "${EXECUTABLE_OUTPUT_PATH}") # Enable C++11 features -SET(CMAKE_CXX_FLAGS "-std=c++0x") - -#ADD_DEFINITIONS(-DGL3) +SET(CMAKE_CXX_FLAGS "-Wall -std=c++0x") # Headers INCLUDE_DIRECTORIES(${GLEW_INCLUDE_PATH} "src/" "opengl-framework/src/" "glfw/include/" "common/" "scenes/" "imgui/") diff --git a/testbed/common/Dumbbell.cpp b/testbed/common/Dumbbell.cpp index 12bf37e7..c97daf03 100644 --- a/testbed/common/Dumbbell.cpp +++ b/testbed/common/Dumbbell.cpp @@ -123,7 +123,6 @@ Dumbbell::Dumbbell(const openglframework::Vector3 &position, // ReactPhysics3D will clone this object to create an internal one. Therefore, // it is OK if this object is destroyed right after calling RigidBody::addCollisionShape() const rp3d::decimal radiusSphere = rp3d::decimal(1.5); - const rp3d::decimal massSphere = rp3d::decimal(2.0); const rp3d::SphereShape sphereCollisionShape(radiusSphere); // Create a cylinder collision shape for the middle of the dumbbell @@ -131,7 +130,6 @@ Dumbbell::Dumbbell(const openglframework::Vector3 &position, // it is OK if this object is destroyed right after calling RigidBody::addCollisionShape() const rp3d::decimal radiusCylinder = rp3d::decimal(0.5); const rp3d::decimal heightCylinder = rp3d::decimal(8.0); - const rp3d::decimal massCylinder = rp3d::decimal(1.0); const rp3d::CylinderShape cylinderCollisionShape(radiusCylinder, heightCylinder); // Initial position and orientation of the rigid body diff --git a/testbed/scenes/cubes/CubesScene.cpp b/testbed/scenes/cubes/CubesScene.cpp index c4652972..7d98a8a0 100644 --- a/testbed/scenes/cubes/CubesScene.cpp +++ b/testbed/scenes/cubes/CubesScene.cpp @@ -43,9 +43,6 @@ CubesScene::CubesScene(const std::string& name) // Gravity vector in the dynamics world rp3d::Vector3 gravity(0, rp3d::decimal(-9.81), 0); - // Time step for the physics simulation - rp3d::decimal timeStep = 1.0f / 60.0f; - // Create the dynamics world for the physics simulation mDynamicsWorld = new rp3d::DynamicsWorld(gravity); diff --git a/testbed/scenes/raycast/RaycastScene.h b/testbed/scenes/raycast/RaycastScene.h index 84cb0702..ed0209af 100644 --- a/testbed/scenes/raycast/RaycastScene.h +++ b/testbed/scenes/raycast/RaycastScene.h @@ -71,9 +71,6 @@ class RaycastManager : public rp3d::RaycastCallback { /// All the normals at hit points std::vector mNormals; - /// Shader - openglframework::Shader& mShader; - /// Contact point mesh folder path std::string mMeshFolderPath; @@ -81,7 +78,7 @@ class RaycastManager : public rp3d::RaycastCallback { RaycastManager(openglframework::Shader& shader, const std::string& meshFolderPath) - : mShader(shader), mMeshFolderPath(meshFolderPath) { + : mMeshFolderPath(meshFolderPath) { }