Proper C++ version detection

This commit is contained in:
Pavel Kirienko
2014-03-17 20:38:02 +04:00
parent 06603ad237
commit 093328e386
4 changed files with 39 additions and 5 deletions
@@ -16,6 +16,21 @@
namespace uavcan
{
/**
* UAVCAN can be compiled in C++11 mode.
* This macro allows to detect which version of the C++ standard is being used.
*/
#define UAVCAN_CPP11 2011
#define UAVCAN_CPP03 2003
#if __cplusplus > 201200
# error Unsupported C++ standard
#elif (__cplusplus > 201100) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define UAVCAN_CPP_VERSION UAVCAN_CPP11
#else
# define UAVCAN_CPP_VERSION UAVCAN_CPP03
#endif
/**
* UAVCAN can be explicitly told to ignore exceptions, or it can be detected automatically.
*/