Skip to content

Commit 8a84414

Browse files
committed
core: add new macros
1 parent 088a756 commit 8a84414

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

include/eigenpy/fwd.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,45 @@
55
#ifndef __eigenpy_fwd_hpp__
66
#define __eigenpy_fwd_hpp__
77

8+
#if defined(__clang__)
9+
#define EIGENPY_CLANG_COMPILER
10+
#elif defined(__GNUC__)
11+
#define EIGENPY_GCC_COMPILER
12+
#elif defined(_MSC_VER)
13+
#define EIGENPY_MSVC_COMPILER
14+
#endif
15+
16+
#define EIGENPY_STRING_LITERAL(string) #string
17+
18+
// For more details, visit
19+
// https://stackoverflow.com/questions/171435/portability-of-warning-preprocessor-directive
20+
#if defined(EIGENPY_CLANG_COMPILER) || defined(EIGENPY_GCC_COMPILER)
21+
#define EIGENPY_PRAGMA(x) _Pragma(#x)
22+
#define EIGENPY_PRAGMA_MESSAGE(the_message) \
23+
EIGENPY_PRAGMA(GCC message #the_message)
24+
#define EIGENPY_PRAGMA_WARNING(the_message) \
25+
EIGENPY_PRAGMA(GCC warning #the_message)
26+
#define EIGENPY_PRAGMA_DEPRECATED(the_message) \
27+
EIGENPY_PRAGMA_WARNING(Deprecated : #the_message)
28+
#define EIGENPY_PRAGMA_DEPRECATED_HEADER(old_header, new_header) \
29+
EIGENPY_PRAGMA_WARNING( \
30+
Deprecated header file \
31+
: #old_header has been replaced \
32+
by #new_header.\n Please use #new_header instead of #old_header.)
33+
#elif defined(WIN32)
34+
#define EIGENPY_PRAGMA(x) __pragma(#x)
35+
#define EIGENPY_PRAGMA_MESSAGE(the_message) \
36+
EIGENPY_PRAGMA(message(#the_message))
37+
#define EIGENPY_PRAGMA_WARNING(the_message) \
38+
EIGENPY_PRAGMA(message("WARNING: " #the_message))
39+
#endif
40+
41+
#define EIGENPY_DEPRECATED_MACRO(macro, the_message) \
42+
EIGENPY_PRAGMA_WARNING("this macro is deprecated: " the_message)
43+
#define EIGENPY_DEPRECATED_FILE(the_message) \
44+
EIGENPY_PRAGMA_WARNING(EIGENPY_STRING_LITERAL("this file is deprecated: ") \
45+
the_message)
46+
847
#include "eigenpy/config.hpp"
948

1049
// Silence a warning about a deprecated use of boost bind by boost python

0 commit comments

Comments
 (0)