From 01b3bf40389152830ff53d22a4d6a1a1255e8a5a Mon Sep 17 00:00:00 2001 From: Carl Morgan Date: Thu, 11 Aug 2016 14:23:26 +1200 Subject: [PATCH 1/4] boost::spirit assign_a fixes to use non-literials --- wrap/Module.cpp | 2 +- wrap/tests/testSpirit.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/wrap/Module.cpp b/wrap/Module.cpp index a115c5e10..61d2a29e0 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -152,7 +152,7 @@ void Module::parseMarkup(const std::string& data) { // parse forward declaration ForwardDeclaration fwDec0, fwDec; Rule forward_declaration_p = - !(str_p("virtual")[assign_a(fwDec.isVirtual, true)]) + !(str_p("virtual")[assign_a(fwDec.isVirtual, T)]) >> str_p("class") >> (*(basic.namespace_p >> str_p("::")) >> basic.className_p)[assign_a(fwDec.name)] >> ch_p(';') diff --git a/wrap/tests/testSpirit.cpp b/wrap/tests/testSpirit.cpp index 2a525e08e..27c9be6d6 100644 --- a/wrap/tests/testSpirit.cpp +++ b/wrap/tests/testSpirit.cpp @@ -102,9 +102,19 @@ TEST( spirit, constMethod_p ) { EXPECT(parse("double norm() const;", constMethod_p, space_p).full); } + /* ************************************************************************* */ +/* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56665 + GCC compiler issues with -O2 and -fno-strict-aliasing results in undefined + behaviour when spirit uses assign_a with a literal. + GCC versions 4.7.2 -> 5.4 inclusive */ + TEST( spirit, return_value_p ) { - bool isEigen = true; + static const bool T = true; + static const bool F = false; + + bool isEigen = T; + string actual_return_type; string actual_function_name; @@ -119,9 +129,9 @@ TEST( spirit, return_value_p ) { Rule funcName_p = lexeme_d[lower_p >> *(alnum_p | '_')]; Rule returnType_p = - (basisType_p[assign_a(actual_return_type)][assign_a(isEigen, true)]) | - (className_p[assign_a(actual_return_type)][assign_a(isEigen,false)]) | - (eigenType_p[assign_a(actual_return_type)][assign_a(isEigen, true)]); + (basisType_p[assign_a(actual_return_type)][assign_a(isEigen, T)]) | + (className_p[assign_a(actual_return_type)][assign_a(isEigen, F)]) | + (eigenType_p[assign_a(actual_return_type)][assign_a(isEigen, T)]); Rule testFunc_p = returnType_p >> funcName_p[assign_a(actual_function_name)] >> str_p("();"); From d1cdafa3f57a74c5dfb9baa21dbb505f0cce6001 Mon Sep 17 00:00:00 2001 From: Ryan Estep Date: Mon, 29 Aug 2016 09:07:03 +1200 Subject: [PATCH 2/4] Removed the boost::regex include (not used) from the matlab wrapper & removed any linking to boost::regex --- CMakeLists.txt | 6 +++--- cmake/GtsamMatlabWrap.cmake | 3 +-- wrap/Argument.cpp | 1 - wrap/CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c93264f3..77434d135 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,11 +116,11 @@ if(MSVC) endif() endif() -find_package(Boost 1.43 COMPONENTS serialization system filesystem thread program_options date_time regex timer chrono) +find_package(Boost 1.43 COMPONENTS serialization system filesystem thread program_options date_time timer chrono) # Required components if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR - NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY OR NOT Boost_REGEX_LIBRARY) + NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") endif() @@ -128,7 +128,7 @@ option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) set(GTSAM_BOOST_LIBRARIES ${Boost_SERIALIZATION_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} - ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_REGEX_LIBRARY}) + ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) if (GTSAM_DISABLE_NEW_TIMERS) message("WARNING: GTSAM timing instrumentation manually disabled") add_definitions(-DGTSAM_DISABLE_NEW_TIMERS) diff --git a/cmake/GtsamMatlabWrap.cmake b/cmake/GtsamMatlabWrap.cmake index d1d3d93dd..a9e04a01a 100644 --- a/cmake/GtsamMatlabWrap.cmake +++ b/cmake/GtsamMatlabWrap.cmake @@ -128,8 +128,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex ## This needs to be fixed!! if(UNIX AND NOT APPLE) list(APPEND automaticDependencies ${Boost_SERIALIZATION_LIBRARY_RELEASE} ${Boost_FILESYSTEM_LIBRARY_RELEASE} - ${Boost_SYSTEM_LIBRARY_RELEASE} ${Boost_THREAD_LIBRARY_RELEASE} ${Boost_DATE_TIME_LIBRARY_RELEASE} - ${Boost_REGEX_LIBRARY_RELEASE}) + ${Boost_SYSTEM_LIBRARY_RELEASE} ${Boost_THREAD_LIBRARY_RELEASE} ${Boost_DATE_TIME_LIBRARY_RELEASE}) if(Boost_TIMER_LIBRARY_RELEASE AND NOT GTSAM_DISABLE_NEW_TIMERS) # Only present in Boost >= 1.48.0 list(APPEND automaticDependencies ${Boost_TIMER_LIBRARY_RELEASE} ${Boost_CHRONO_LIBRARY_RELEASE}) if(GTSAM_MEX_BUILD_STATIC_MODULE) diff --git a/wrap/Argument.cpp b/wrap/Argument.cpp index cde04afe0..52d9ca0b5 100644 --- a/wrap/Argument.cpp +++ b/wrap/Argument.cpp @@ -18,7 +18,6 @@ #include "Argument.h" -#include #include #include diff --git a/wrap/CMakeLists.txt b/wrap/CMakeLists.txt index 03915a662..04d471b39 100644 --- a/wrap/CMakeLists.txt +++ b/wrap/CMakeLists.txt @@ -1,6 +1,6 @@ # Build/install Wrap -set(WRAP_BOOST_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY}) +set(WRAP_BOOST_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) # Allow for disabling serialization to handle errors related to Clang's linker option(GTSAM_WRAP_SERIALIZATION "If enabled, allows for wrapped objects to be saved via boost.serialization" ON) From a7fbce3e4c3b0fba45a64ab87ab14a8c5df734d3 Mon Sep 17 00:00:00 2001 From: Jing Dong Date: Mon, 26 Sep 2016 17:01:41 -0400 Subject: [PATCH 3/4] fix dogleg compile issue in CMake Timing mode --- gtsam/nonlinear/DoglegOptimizerImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/nonlinear/DoglegOptimizerImpl.h b/gtsam/nonlinear/DoglegOptimizerImpl.h index cead7f9db..9a7067878 100644 --- a/gtsam/nonlinear/DoglegOptimizerImpl.h +++ b/gtsam/nonlinear/DoglegOptimizerImpl.h @@ -243,7 +243,7 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate( stay = false; } } - gttoc(adjust_Delta); + gttoc(adjust_delta); } // dx_d and f_error have already been filled in during the loop From f9de023caff5e7dab0daf94acd06a389b1a46629 Mon Sep 17 00:00:00 2001 From: chrisbeall Date: Thu, 6 Oct 2016 14:25:40 -0700 Subject: [PATCH 4/4] Only add custom all.tests target when GTSAM_BUILD_TESTS is true --- cmake/GtsamTesting.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/GtsamTesting.cmake b/cmake/GtsamTesting.cmake index 62a129010..15d4219e6 100644 --- a/cmake/GtsamTesting.cmake +++ b/cmake/GtsamTesting.cmake @@ -101,6 +101,9 @@ mark_as_advanced(GTSAM_SINGLE_TEST_EXE) # Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) if(GTSAM_BUILD_TESTS) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $ --output-on-failure) + + # Add target to build tests without running + add_custom_target(all.tests) endif() # Add examples target @@ -109,8 +112,6 @@ add_custom_target(examples) # Add timing target add_custom_target(timing) -# Add target to build tests without running -add_custom_target(all.tests) # Implementations of this file's macros: