Skip to content

Commit 9aa411a

Browse files
authored
break circular include (#237)
* include registration: add failing unit test * include registration: break circular include loop otherwise, when a user include directly this header without fwd.hpp, as in the include.cpp regression test: Dans le fichier inclus depuis ../include/eigenpy/fwd.hpp:35, depuis ../include/eigenpy/registration.hpp:9, depuis ../unittest/include.cpp:7: ../include/eigenpy/expose.hpp: Dans la fonction « void eigenpy::expose() »: ../include/eigenpy/expose.hpp:27:9: erreur: « register_symbolic_link_to_registered_type » n'a pas été déclaré dans cette portée 27 | if(!register_symbolic_link_to_registered_type<T>()) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/eigenpy/expose.hpp:27:52: erreur: expected primary-expression before « > » token 27 | if(!register_symbolic_link_to_registered_type<T>()) | ^ ../include/eigenpy/expose.hpp:27:50: attention: le non logique est toujours appliqué au membre de gauche de la comparaison [-Wlogical-not-parentheses] 27 | if(!register_symbolic_link_to_registered_type<T>()) | ^ ../include/eigenpy/expose.hpp:27:54: erreur: expected primary-expression before « ) » token 27 | if(!register_symbolic_link_to_registered_type<T>()) | ^
1 parent ecd138d commit 9aa411a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

include/eigenpy/registration.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright 2018-2019, INRIA
44
*/
55

6+
#include "eigenpy/fwd.hpp"
7+
68
#ifndef __eigenpy_registration_hpp__
79
#define __eigenpy_registration_hpp__
810

9-
#include "eigenpy/fwd.hpp"
10-
1111
namespace eigenpy
1212
{
1313
///

unittest/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ADD_LIB_UNIT_TEST(matrix)
2929
ADD_LIB_UNIT_TEST(geometry)
3030
ADD_LIB_UNIT_TEST(complex)
3131
ADD_LIB_UNIT_TEST(return_by_ref)
32+
ADD_LIB_UNIT_TEST(include)
3233
IF(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0")
3334
ADD_LIB_UNIT_TEST(eigen_ref)
3435
ENDIF()

unittest/include.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright 2021, CNRS
3+
*/
4+
5+
// Including this header should not raise a build error
6+
7+
#include "eigenpy/registration.hpp"
8+
9+
BOOST_PYTHON_MODULE(include) {}

0 commit comments

Comments
 (0)