Micro template library A library for building device drivers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

100 lines
2.5 KiB

  1. /*!
  2. * \file utl/core/version.h
  3. * \brief utl version and cpp version checks
  4. */
  5. #ifndef __utl_core_version_h__
  6. #define __utl_core_version_h__
  7. //!\addtogroup core
  8. //! @{
  9. //! \defgroup version Version
  10. //! Definitions of the utl version and compiler features
  11. //!@{
  12. //! utl version as string
  13. #define UTL_VERSION "0.1.0"
  14. #define UTL_VERSION_MAJOR 0
  15. #define UTL_VERSION_MINOR 1
  16. #define UTL_VERSION_PATCH 0
  17. //! utl version as integer
  18. //!
  19. //! This can be used in the user files to check for uTL versions.
  20. //! The version number is constructed using:\n
  21. //! \f$ ver = (Maj*10000 + Min*100 + Patch) \f$
  22. #define UTL_VERSION_VALUE ( (UTL_VERSION_MAJOR * 10000) \
  23. + (UTL_VERSION_MINOR * 100) \
  24. + UTL_VERSION_PATCH)
  25. //!@}
  26. //! \name Compiler and feature checks
  27. //! These checks are used inside uTL, but the user is free to use the as well.
  28. //! @{
  29. #define CXX_VER __cplusplus //!< Current compiler's version
  30. #define CXX_VER_STD_11 201103L //!< C++11
  31. #define CXX_VER_STD_14 201402L //!< C++14
  32. #define CXX_VER_STD_17 201703L //!< C++17
  33. //! \def CXX_VARIABLE_TEMPLATES
  34. //! Check for variable templates (Non-zero if available)
  35. #ifndef CXX_VARIABLE_TEMPLATES
  36. #ifdef __cpp_variable_templates
  37. #define CXX_VARIABLE_TEMPLATES __cpp_variable_templates
  38. #else
  39. #define CXX_VARIABLE_TEMPLATES (CXX_VER >= CXX_VER_STD_14)
  40. #endif
  41. #endif
  42. //! \def CXX_CONCEPTS
  43. //! Check for concepts (Non-zero if available)
  44. #ifndef CXX_CONCEPTS
  45. #ifdef __cpp_concepts
  46. #define CXX_CONCEPTS __cpp_concepts
  47. #else
  48. #define CXX_CONCEPTS 0
  49. #endif
  50. #endif
  51. //! \def CXX_INLINE_VARIABLES
  52. //! Check for inline variables (Non-zero if available)
  53. #ifndef CXX_INLINE_VARIABLES
  54. #ifdef __cpp_inline_variables
  55. #define CXX_INLINE_VARIABLES __cpp_inline_variables
  56. #else
  57. #define CXX_INLINE_VARIABLES (CXX_VER >= CXX_VER_STD_17)
  58. #endif
  59. #endif
  60. //! \def CXX_FOLD_EXPRESSIONS
  61. //! Check for fold expressions (Non-zero if available)
  62. #ifndef CXX_FOLD_EXPRESSIONS
  63. #ifdef __cpp_fold_expressions
  64. #define CXX_FOLD_EXPRESSIONS __cpp_fold_expressions
  65. #else
  66. #define CXX_FOLD_EXPRESSIONS (CXX_VER >= CXX_VER_STD_17)
  67. #endif
  68. #endif
  69. //! @}
  70. //! \name Workaround inspections
  71. //! @{
  72. #if defined(__GNUC__) && (__GNUC__ < 5)
  73. // https://wg21.link/cwg1558
  74. #define UTL_WORKAROUND_CWG_1558
  75. #endif
  76. //! Base library requirement
  77. #if CXX_VER < CXX_VER_STD_14
  78. #error "uTL requires C++14"
  79. #endif
  80. //! @}
  81. //! @}
  82. #endif /* #ifndef __utl_core_version_h__ */