Micro template library A library for building device drivers
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

114 řádky
3.3 KiB

  1. /*!
  2. * \file utl/core/version.h
  3. * \brief utl version and cpp version checks
  4. *
  5. * \copyright
  6. * Copyright (C) 2018 Christos Choutouridis <christos@choutouridis.net>\n
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation, either version 3
  10. * of the License, or (at your option) any later version.\n
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.\n
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #ifndef __utl_core_version_h__
  20. #define __utl_core_version_h__
  21. //!\addtogroup core
  22. //! @{
  23. //! \defgroup version Version
  24. //! Definitions of the utl version and compiler features
  25. //!@{
  26. //! utl version as string
  27. #define UTL_VERSION "0.1.0"
  28. #define UTL_VERSION_MAJOR 0
  29. #define UTL_VERSION_MINOR 1
  30. #define UTL_VERSION_PATCH 0
  31. //! utl version as integer
  32. //!
  33. //! This can be used in the user files to check for uTL versions.
  34. //! The version number is constructed using:\n
  35. //! ver = (Maj*10000 + Min*100 + Patch)
  36. #define UTL_VERSION_VALUE ( (UTL_VERSION_MAJOR * 10000) \
  37. + (UTL_VERSION_MINOR * 100) \
  38. + UTL_VERSION_PATCH)
  39. //!@}
  40. //! \name Compiler and feature checks
  41. //! These checks are used inside uTL, but the user is free to use the as well.
  42. //! @{
  43. #define CXX_VER __cplusplus //!< Current compiler's version
  44. #define CXX_VER_STD_11 201103L //!< C++11
  45. #define CXX_VER_STD_14 201402L //!< C++14
  46. #define CXX_VER_STD_17 201703L //!< C++17
  47. //! \def CXX_VARIABLE_TEMPLATES
  48. //! Check for variable templates (Non-zero if available)
  49. #ifndef CXX_VARIABLE_TEMPLATES
  50. #ifdef __cpp_variable_templates
  51. #define CXX_VARIABLE_TEMPLATES __cpp_variable_templates
  52. #else
  53. #define CXX_VARIABLE_TEMPLATES (CXX_VER >= CXX_VER_STD_14)
  54. #endif
  55. #endif
  56. //! \def CXX_CONCEPTS
  57. //! Check for concepts (Non-zero if available)
  58. #ifndef CXX_CONCEPTS
  59. #ifdef __cpp_concepts
  60. #define CXX_CONCEPTS __cpp_concepts
  61. #else
  62. #define CXX_CONCEPTS 0
  63. #endif
  64. #endif
  65. //! \def CXX_INLINE_VARIABLES
  66. //! Check for inline variables (Non-zero if available)
  67. #ifndef CXX_INLINE_VARIABLES
  68. #ifdef __cpp_inline_variables
  69. #define CXX_INLINE_VARIABLES __cpp_inline_variables
  70. #else
  71. #define CXX_INLINE_VARIABLES (CXX_VER >= CXX_VER_STD_17)
  72. #endif
  73. #endif
  74. //! \def CXX_FOLD_EXPRESSIONS
  75. //! Check for fold expressions (Non-zero if available)
  76. #ifndef CXX_FOLD_EXPRESSIONS
  77. #ifdef __cpp_fold_expressions
  78. #define CXX_FOLD_EXPRESSIONS __cpp_fold_expressions
  79. #else
  80. #define CXX_FOLD_EXPRESSIONS (CXX_VER >= CXX_VER_STD_17)
  81. #endif
  82. #endif
  83. //! @}
  84. //! \name Workaround inspections
  85. //! @{
  86. #if defined(__GNUC__) && (__GNUC__ < 5)
  87. // https://wg21.link/cwg1558
  88. #define UTL_WORKAROUND_CWG_1558
  89. #endif
  90. //! Base library requirement
  91. #if CXX_VER < CXX_VER_STD_14
  92. #error "uTL requires C++14"
  93. #endif
  94. //! @}
  95. //! @}
  96. #endif /* #ifndef __utl_core_version_h__ */