Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused parameter warnings #205

Merged
merged 3 commits into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeModules/CompilerSettings.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# GCC
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++11 -W -Wall -Wextra -Wpedantic -Wno-unused-parameter)
add_definitions(-std=c++11 -W -Wall -Wextra -Wpedantic)
if(FCL_TREAT_WARNINGS_AS_ERRORS)
add_definitions(-Werror)
endif()
endif()

# Clang
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions(-std=c++11 -W -Wall -Wextra -Wno-unused-parameter)
add_definitions(-std=c++11 -W -Wall -Wextra)
if(FCL_TREAT_WARNINGS_AS_ERRORS)
add_definitions(-Werror)
endif()
Expand All @@ -20,7 +20,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
message(FATAL_ERROR "AppleClang version must be at least 6.1!")
endif()
add_definitions(-std=c++11 -W -Wall -Wextra -Wno-unused-parameter)
add_definitions(-std=c++11 -W -Wall -Wextra)
if(FCL_TREAT_WARNINGS_AS_ERRORS)
add_definitions(-Werror)
endif()
Expand Down
8 changes: 7 additions & 1 deletion include/fcl/broadphase/broadphase_collision_manager-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
*/

/** @author Jia Pan */

Expand All @@ -40,6 +40,8 @@

#include "fcl/broadphase/broadphase_collision_manager.h"

#include "fcl/common/unused.h"

namespace fcl {

//==============================================================================
Expand Down Expand Up @@ -74,6 +76,8 @@ void BroadPhaseCollisionManager<S>::registerObjects(
template <typename S>
void BroadPhaseCollisionManager<S>::update(CollisionObject<S>* updated_obj)
{
FCL_UNUSED(updated_obj);

update();
}

Expand All @@ -82,6 +86,8 @@ template <typename S>
void BroadPhaseCollisionManager<S>::update(
const std::vector<CollisionObject<S>*>& updated_objs)
{
FCL_UNUSED(updated_objs);

update();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
*/

/** @author Jia Pan */

Expand All @@ -40,6 +40,8 @@

#include "fcl/broadphase/broadphase_continuous_collision_manager.h"

#include "fcl/common/unused.h"

namespace fcl {

//==============================================================================
Expand Down Expand Up @@ -74,6 +76,8 @@ template <typename S>
void BroadPhaseContinuousCollisionManager<S>::update(
ContinuousCollisionObject<S>* updated_obj)
{
FCL_UNUSED(updated_obj);

update();
}

Expand All @@ -82,6 +86,8 @@ template <typename S>
void BroadPhaseContinuousCollisionManager<S>::update(
const std::vector<ContinuousCollisionObject<S>*>& updated_objs)
{
FCL_UNUSED(updated_objs);

update();
}

Expand Down
18 changes: 18 additions & 0 deletions include/fcl/broadphase/detail/hierarchy_tree_array-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/broadphase/detail/hierarchy_tree_array.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -342,6 +344,10 @@ bool HierarchyTree<BV>::update(size_t leaf, const BV& bv)
template<typename BV>
bool HierarchyTree<BV>::update(size_t leaf, const BV& bv, const Vector3<S>& vel, S margin)
{
FCL_UNUSED(bv);
FCL_UNUSED(vel);
FCL_UNUSED(margin);

if(nodes[leaf].bv.contain(bv)) return false;
update_(leaf, bv);
return true;
Expand All @@ -351,6 +357,8 @@ bool HierarchyTree<BV>::update(size_t leaf, const BV& bv, const Vector3<S>& vel,
template<typename BV>
bool HierarchyTree<BV>::update(size_t leaf, const BV& bv, const Vector3<S>& vel)
{
FCL_UNUSED(vel);

if(nodes[leaf].bv.contain(bv)) return false;
update_(leaf, bv);
return true;
Expand Down Expand Up @@ -1071,11 +1079,21 @@ struct SelectImpl
{
static bool run(size_t query, size_t node1, size_t node2, NodeBase<BV>* nodes)
{
FCL_UNUSED(query);
FCL_UNUSED(node1);
FCL_UNUSED(node2);
FCL_UNUSED(nodes);

return 0;
}

static bool run(const BV& query, size_t node1, size_t node2, NodeBase<BV>* nodes)
{
FCL_UNUSED(query);
FCL_UNUSED(node1);
FCL_UNUSED(node2);
FCL_UNUSED(nodes);

return 0;
}
};
Expand Down
41 changes: 41 additions & 0 deletions include/fcl/common/unused.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2017, Open Source Robotics Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Open Source Robotics Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FCL_COMMON_UNUSED_H
#define FCL_COMMON_UNUSED_H

// Macro to suppress -Wunused-parameter and -Wunused-variable warnings.
#define FCL_UNUSED(x) do { (void)(x); } while (0)

#endif
6 changes: 6 additions & 0 deletions include/fcl/geometry/bvh/detail/BV_splitter-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/geometry/bvh/detail/BV_splitter.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -591,6 +593,8 @@ void computeSplitValue_mean(
const Vector3<S>& split_vector,
S& split_value)
{
FCL_UNUSED(bv);

S sum = 0.0;
if(type == BVH_MODEL_TRIANGLES)
{
Expand Down Expand Up @@ -634,6 +638,8 @@ void computeSplitValue_median(
const Vector3<S>& split_vector,
S& split_value)
{
FCL_UNUSED(bv);

std::vector<S> proj(num_primitives);

if(type == BVH_MODEL_TRIANGLES)
Expand Down
12 changes: 12 additions & 0 deletions include/fcl/geometry/shape/utility-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/geometry/shape/utility.h"

#include "fcl/common/unused.h"

#include "fcl/math/bv/utility.h"

#include "fcl/geometry/shape/capsule.h"
Expand Down Expand Up @@ -359,6 +361,9 @@ struct ComputeBVImpl<S, OBB<S>, Halfspace<S>>
{
static void run(const Halfspace<S>& s, const Transform3<S>& tf, OBB<S>& bv)
{
FCL_UNUSED(s);
FCL_UNUSED(tf);

/// Half space can only have very rough OBB
bv.axis.setIdentity();
bv.To.setZero();
Expand All @@ -372,6 +377,9 @@ struct ComputeBVImpl<S, RSS<S>, Halfspace<S>>
{
static void run(const Halfspace<S>& s, const Transform3<S>& tf, RSS<S>& bv)
{
FCL_UNUSED(s);
FCL_UNUSED(tf);

/// Half space can only have very rough RSS
bv.axis.setIdentity();
bv.To.setZero();
Expand Down Expand Up @@ -1137,6 +1145,8 @@ void constructBox(const AABB<S>& bv, const Transform3<S>& tf_bv, Box<S>& box, Tr
template <typename S>
void constructBox(const OBB<S>& bv, const Transform3<S>& tf_bv, Box<S>& box, Transform3<S>& tf)
{
FCL_UNUSED(tf_bv);

box = Box<S>(bv.extent * 2);
tf.linear() = bv.axis;
tf.translation() = bv.To;
Expand All @@ -1156,6 +1166,8 @@ void constructBox(const OBBRSS<S>& bv, const Transform3<S>& tf_bv, Box<S>& box,
template <typename S>
void constructBox(const kIOS<S>& bv, const Transform3<S>& tf_bv, Box<S>& box, Transform3<S>& tf)
{
FCL_UNUSED(tf_bv);

box = Box<S>(bv.obb.extent * 2);
tf.linear() = bv.obb.axis;
tf.translation() = bv.obb.To;
Expand Down
8 changes: 8 additions & 0 deletions include/fcl/math/bv/OBB-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/math/bv/OBB.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -110,6 +112,8 @@ bool OBB<S>::overlap(const OBB<S>& other) const
template <typename S>
bool OBB<S>::overlap(const OBB& other, OBB& overlap_part) const
{
FCL_UNUSED(overlap_part);

return overlap(other);
}

Expand Down Expand Up @@ -216,6 +220,10 @@ template <typename S>
S OBB<S>::distance(const OBB& other, Vector3<S>* P,
Vector3<S>* Q) const
{
FCL_UNUSED(other);
FCL_UNUSED(P);
FCL_UNUSED(Q);

std::cerr << "OBB distance not implemented!" << std::endl;
return 0.0;
}
Expand Down
6 changes: 6 additions & 0 deletions include/fcl/math/bv/kDOP-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/math/bv/kDOP.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -243,6 +245,10 @@ Vector3<S> KDOP<S, N>::center() const
template <typename S, std::size_t N>
S KDOP<S, N>::distance(const KDOP<S, N>& other, Vector3<S>* P, Vector3<S>* Q) const
{
FCL_UNUSED(other);
FCL_UNUSED(P);
FCL_UNUSED(Q);

std::cerr << "KDOP distance not implemented!" << std::endl;
return 0.0;
}
Expand Down
6 changes: 6 additions & 0 deletions include/fcl/math/bv/utility-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/math/bv/utility.h"

#include "fcl/common/unused.h"

#include "fcl/math/bv/AABB.h"
#include "fcl/math/bv/kDOP.h"
#include "fcl/math/bv/kIOS.h"
Expand Down Expand Up @@ -661,6 +663,10 @@ class ConvertBVImpl
private:
static void run(const BV1& bv1, const Transform3<S>& tf1, BV2& bv2)
{
FCL_UNUSED(bv1);
FCL_UNUSED(tf1);
FCL_UNUSED(bv2);

// should only use the specialized version, so it is private.
}
};
Expand Down
10 changes: 10 additions & 0 deletions include/fcl/math/motion/spline_motion-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/math/motion/spline_motion.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -93,6 +95,11 @@ SplineMotion<S>::SplineMotion(
const Matrix3<S>& R2, const Vector3<S>& T2)
: MotionBase<S>()
{
FCL_UNUSED(R1);
FCL_UNUSED(T1);
FCL_UNUSED(R2);
FCL_UNUSED(T2);

// TODO
}

Expand All @@ -102,6 +109,9 @@ SplineMotion<S>::SplineMotion(
const Transform3<S>& tf1, const Transform3<S>& tf2)
: MotionBase<S>()
{
FCL_UNUSED(tf1);
FCL_UNUSED(tf2);

// TODO
}

Expand Down
4 changes: 4 additions & 0 deletions include/fcl/math/motion/tbv_motion_bound_visitor-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "fcl/math/motion/tbv_motion_bound_visitor.h"

#include "fcl/common/unused.h"

namespace fcl
{

Expand Down Expand Up @@ -69,6 +71,8 @@ template<typename BV>
typename BV::S TBVMotionBoundVisitor<BV>::visit(
const MotionBase<S>& motion) const
{
FCL_UNUSED(motion);

return 0;
}

Expand Down
Loading