From d7d77afd4579fc9de82e2f485cf44964e0b12e7a Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Date: Fri, 21 Feb 2014 20:18:47 +0100 Subject: [PATCH] Fixed potential var name crash in macro. --- libs/base/include/mrpt/utils/mrpt_macros.h | 12 ++++++------ .../mrpt/srba/impl/spantree_update_symbolic.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/base/include/mrpt/utils/mrpt_macros.h b/libs/base/include/mrpt/utils/mrpt_macros.h index 652014de38..8d26289b47 100644 --- a/libs/base/include/mrpt/utils/mrpt_macros.h +++ b/libs/base/include/mrpt/utils/mrpt_macros.h @@ -266,12 +266,12 @@ #endif /** Assert comparing two values, reporting their actual values upon failure */ - #define ASSERT_EQUAL_( __A, __B) { if (__A!=__B) { std::ostringstream s;s<<"ASSERT_EQUAL_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } - #define ASSERT_NOT_EQUAL_( __A, __B) { if (__A==__B) { std::ostringstream s;s<<"ASSERT_NOT_EQUAL_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } - #define ASSERT_BELOW_( __A, __B) { if (__A>=__B) { std::ostringstream s;s<<"ASSERT_BELOW_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } - #define ASSERT_ABOVE_( __A, __B) { if (__A<=__B) { std::ostringstream s;s<<"ASSERT_ABOVE_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } - #define ASSERT_BELOWEQ_( __A, __B) { if (__A>__B) { std::ostringstream s;s<<"ASSERT_BELOWEQ_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } - #define ASSERT_ABOVEEQ_( __A, __B) { if (__A<__B) { std::ostringstream s;s<<"ASSERT_ABOVEEQ_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(s.str()) } } + #define ASSERT_EQUAL_( __A, __B) { if (__A!=__B) { std::ostringstream __s__;__s__<<"ASSERT_EQUAL_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } + #define ASSERT_NOT_EQUAL_( __A, __B) { if (__A==__B) { std::ostringstream __s__;__s__<<"ASSERT_NOT_EQUAL_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } + #define ASSERT_BELOW_( __A, __B) { if (__A>=__B) { std::ostringstream __s__;__s__<<"ASSERT_BELOW_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } + #define ASSERT_ABOVE_( __A, __B) { if (__A<=__B) { std::ostringstream __s__;__s__<<"ASSERT_ABOVE_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } + #define ASSERT_BELOWEQ_( __A, __B) { if (__A>__B) { std::ostringstream __s__;__s__<<"ASSERT_BELOWEQ_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } + #define ASSERT_ABOVEEQ_( __A, __B) { if (__A<__B) { std::ostringstream __s__;__s__<<"ASSERT_ABOVEEQ_("<<#__A<<","<<#__B<<") failed with\n"<<#__A<<"=" <<__A <<"\n"<<#__B<<"="<<__B; THROW_EXCEPTION(__s__.str()) } } #define ASSERT_FILE_EXISTS_(FIL) ASSERTMSG_( mrpt::system::fileExists(FIL), std::string("Assert file existence failed: ") + ::std::string(FIL) ) #define ASSERT_DIRECTORY_EXISTS_(DIR) ASSERTMSG_( mrpt::system::directoryExists(DIR), std::string("Assert directory existence failed: ") + ::std::string(DIR) ) diff --git a/libs/srba/include/mrpt/srba/impl/spantree_update_symbolic.h b/libs/srba/include/mrpt/srba/impl/spantree_update_symbolic.h index 650e577d07..d93ae381a7 100644 --- a/libs/srba/include/mrpt/srba/impl/spantree_update_symbolic.h +++ b/libs/srba/include/mrpt/srba/impl/spantree_update_symbolic.h @@ -114,7 +114,7 @@ cout << "ST: Shorter path ST["< "<< TSpanTreeEntry &ste_r_inSTs = st_s[r]; ste_r_inSTs.distance = new_dist; ste_r_inSTs.next = ste_s2ik ? ste_s2ik->next : new_node_id; // Next node in the direction towards "ik" or to "n" if this is "ik" - ASSERT_NOT_EQUAL_(static_cast(s), static_cast(ste_r_inSTs.next)) // no self-loops! + ASSERT_NOT_EQUAL_(s,ste_r_inSTs.next) // no self-loops! // Mark nodes with their "next_node" modified: kfs_with_modified_next_edge.insert( make_pair(s,r) ); @@ -143,7 +143,7 @@ cout << "ST: New path ST["<next : ne TSpanTreeEntry &ste_r_inSTs = st_s[r]; // O(log N) ste_r_inSTs.distance = new_dist; ste_r_inSTs.next = ste_s2ik ? ste_s2ik->next : new_node_id; // Next node in the direction towards "ik" - ASSERT_NOT_EQUAL_(static_cast(s), static_cast(ste_r_inSTs.next)) // no self-loops! + ASSERT_NOT_EQUAL_(s, ste_r_inSTs.next) // no self-loops! // Mark nodes with their "next_node" modified: kfs_with_modified_next_edge.insert(make_pair(r,s));