From 3c7933b0378889e4df25c6fa4ea34c06c8a4aae3 Mon Sep 17 00:00:00 2001 From: Denis Romanchuk Date: Fri, 3 Feb 2017 21:36:31 +0200 Subject: [PATCH] fix missed mandatory -std=c++11 flag (#181) collada_parser,kdl_parser,urdf: add c++11 flag, collada_parser: replace typeof with ansi __typeof__ builded/tested on gentoo Thanks den4ix for the contribution! --- collada_parser/CMakeLists.txt | 2 ++ collada_parser/src/collada_parser.cpp | 6 ++++++ kdl_parser/CMakeLists.txt | 2 ++ urdf/CMakeLists.txt | 2 ++ urdf/test/test_robot_model_parser.cpp | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/collada_parser/CMakeLists.txt b/collada_parser/CMakeLists.txt index e35694e..961ac9c 100644 --- a/collada_parser/CMakeLists.txt +++ b/collada_parser/CMakeLists.txt @@ -6,6 +6,8 @@ find_package(Boost REQUIRED system) find_package(catkin REQUIRED COMPONENTS urdf_parser_plugin roscpp class_loader urdf) find_package(urdfdom_headers REQUIRED) +add_compile_options(-std=c++11) + catkin_package( LIBRARIES ${PROJECT_NAME} INCLUDE_DIRS include diff --git a/collada_parser/src/collada_parser.cpp b/collada_parser/src/collada_parser.cpp index e67f15b..ef5fde1 100644 --- a/collada_parser/src/collada_parser.cpp +++ b/collada_parser/src/collada_parser.cpp @@ -42,8 +42,13 @@ #include #include +/* disable deprecated auto_ptr warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #include +#pragma GCC diagnostic pop + #include #include #include @@ -67,6 +72,7 @@ #include #endif +#define typeof __typeof__ #define FOREACH(it, v) for(typeof((v).begin())it = (v).begin(); it != (v).end(); (it)++) #define FOREACHC FOREACH diff --git a/kdl_parser/CMakeLists.txt b/kdl_parser/CMakeLists.txt index 43b96b7..70124c1 100644 --- a/kdl_parser/CMakeLists.txt +++ b/kdl_parser/CMakeLists.txt @@ -19,6 +19,8 @@ link_directories(${Boost_LIBRARY_DIRS}) find_library(KDL_LIBRARY REQUIRED NAMES orocos-kdl HINTS ${orocos_kdl_LIBRARY_DIRS}) +add_compile_options(-std=c++11) + catkin_package( LIBRARIES ${PROJECT_NAME} ${KDL_LIBRARY} INCLUDE_DIRS include diff --git a/urdf/CMakeLists.txt b/urdf/CMakeLists.txt index eeed0bd..6d706bc 100644 --- a/urdf/CMakeLists.txt +++ b/urdf/CMakeLists.txt @@ -21,6 +21,8 @@ set(generated_compat_header "${CATKIN_DEVEL_PREFIX}/include/${PROJECT_NAME}/urdf include_directories("${CATKIN_DEVEL_PREFIX}/include") configure_file(urdfdom_compatibility.h.in "${generated_compat_header}" @ONLY) +add_compile_options(-std=c++11) + catkin_package( LIBRARIES ${PROJECT_NAME} INCLUDE_DIRS include ${TinyXML_INLCLUDE_DIRS} ${CATKIN_DEVEL_PREFIX}/include diff --git a/urdf/test/test_robot_model_parser.cpp b/urdf/test/test_robot_model_parser.cpp index 81f90af..a730eb5 100644 --- a/urdf/test/test_robot_model_parser.cpp +++ b/urdf/test/test_robot_model_parser.cpp @@ -94,7 +94,7 @@ protected: double roll,pitch,yaw; (*child)->parent_joint->parent_to_joint_origin_transform.rotation.getRPY(roll,pitch,yaw); - if (isnan(roll) || isnan(pitch) || isnan(yaw)) + if (std::isnan(roll) || std::isnan(pitch) || std::isnan(yaw)) { ROS_ERROR("getRPY() returned nan!"); return false;