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.
 
 
 
 

106 lines
2.8 KiB

  1. /*!
  2. * \file /utl/core/version.h
  3. * \brief version and cpp version checks
  4. *
  5. * Copyright (C) 2018 Christos Choutouridis
  6. *
  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.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #ifndef __utl_core_version_h__
  22. #define __utl_core_version_h__
  23. //!\defgroup version version
  24. //! Definitions of the utl version
  25. //!@{
  26. //! utl version
  27. #define UTL_VERSION "0.0.1"
  28. #define UTL_VERSION_MAJOR 0
  29. #define UTL_VERSION_MINOR 0
  30. #define UTL_VERSION_PATCH 1
  31. #define UTL_VERSION_VALUE ( (UTL_VERSION_MAJOR * 10000) \
  32. + (UTL_VERSION_MINOR * 100) \
  33. + UTL_VERSION_PATCH)
  34. //! C++ versions
  35. #define CXX_VER __cplusplus
  36. #define CXX_VER_STD_11 201103L
  37. #define CXX_VER_STD_14 201402L
  38. #define CXX_VER_STD_17 201703L
  39. //#include <type_traits>
  40. //! Check for variable templates
  41. #ifndef CXX_VARIABLE_TEMPLATES
  42. #ifdef __cpp_variable_templates
  43. #define CXX_VARIABLE_TEMPLATES __cpp_variable_templates
  44. #else
  45. #define CXX_VARIABLE_TEMPLATES (CXX_VER >= CXX_VER_STD_14)
  46. #endif
  47. #endif
  48. //! Check integer sequence
  49. #ifndef CXX_INTEGER_SEQUENCE
  50. #ifdef __cpp_lib_integer_sequence
  51. #define CXX_INTEGER_SEQUENCE __cpp_lib_integer_sequence
  52. #else
  53. #define CXX_INTEGER_SEQUENCE (CXX_VER >= CXX_VER_STD_14)
  54. #endif
  55. #endif
  56. //! Check concepts
  57. #ifndef CXX_CONCEPTS
  58. #ifdef __cpp_concepts
  59. #define CXX_CONCEPTS __cpp_concepts
  60. #else
  61. #define CXX_CONCEPTS 0
  62. #endif
  63. #endif
  64. //! Check for inline variables
  65. #ifndef CXX_INLINE_VARIABLES
  66. #ifdef __cpp_inline_variables
  67. #define CXX_INLINE_VARIABLES __cpp_inline_variables
  68. #else
  69. #define CXX_INLINE_VARIABLES (CXX_VER >= CXX_VER_STD_17)
  70. #endif
  71. #endif
  72. #ifndef CXX_FOLD_EXPRESSIONS
  73. #ifdef __cpp_fold_expressions
  74. #define CXX_FOLD_EXPRESSIONS __cpp_fold_expressions
  75. #else
  76. #define CXX_FOLD_EXPRESSIONS (CXX_VER >= CXX_VER_STD_17)
  77. #endif
  78. #endif
  79. /*
  80. * Workaround inspection
  81. */
  82. #if defined(__GNUC__) && (__GNUC__ < 5)
  83. // https://wg21.link/cwg1558
  84. #define UTL_WORKAROUND_CWG_1558
  85. #endif
  86. //! Base library requirement
  87. #if __cplusplus < CXX_VER_STD_11
  88. #error "uTL requires C++11"
  89. #endif
  90. //!@}
  91. #endif /* #ifndef __utl_core_version_h__ */