proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
fwd.hpp
Go to the documentation of this file.
1//
2// Copyright (c) 2022 INRIA
3//
4
5#ifndef __proxsuite_fwd_hpp__
6#define __proxsuite_fwd_hpp__
7
8#if __cplusplus >= 201703L
9#define PROXSUITE_WITH_CPP_17
10#endif
11#if __cplusplus >= 201402L
12#define PROXSUITE_WITH_CPP_14
13#endif
14
15#if defined(PROXSUITE_WITH_CPP_17)
16#define PROXSUITE_MAYBE_UNUSED [[maybe_unused]]
17#elif defined(_MSC_VER) && !defined(__clang__)
18#define PROXSUITE_MAYBE_UNUSED
19#else
20#define PROXSUITE_MAYBE_UNUSED __attribute__((__unused__))
21#endif
22
23// Same logic as in Pinocchio to check eigen malloc
24#ifdef PROXSUITE_EIGEN_CHECK_MALLOC
25#ifndef EIGEN_RUNTIME_NO_MALLOC
26#define EIGEN_RUNTIME_NO_MALLOC_WAS_NOT_DEFINED
27#define EIGEN_RUNTIME_NO_MALLOC
28#endif
29#endif
30
31#include <Eigen/Core>
32#include <cassert>
33
34#ifdef PROXSUITE_EIGEN_CHECK_MALLOC
35#ifdef EIGEN_RUNTIME_NO_MALLOC_WAS_NOT_DEFINED
36#undef EIGEN_RUNTIME_NO_MALLOC
37#undef EIGEN_RUNTIME_NO_MALLOC_WAS_NOT_DEFINED
38#endif
39#endif
40
41// Check memory allocation for Eigen
42#ifdef PROXSUITE_EIGEN_CHECK_MALLOC
43#define PROXSUITE_EIGEN_MALLOC(allowed) \
44 ::Eigen::internal::set_is_malloc_allowed(allowed)
45#define PROXSUITE_EIGEN_MALLOC_ALLOWED() PROXSUITE_EIGEN_MALLOC(true)
46#define PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED() PROXSUITE_EIGEN_MALLOC(false)
47#else
48#define PROXSUITE_EIGEN_MALLOC(allowed)
49#define PROXSUITE_EIGEN_MALLOC_ALLOWED()
50#define PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED()
51#endif
52
53#endif // #ifndef __proxsuite_fwd_hpp__