stdcpp.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. Copyright Rene Rivera 2011-2015
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef BOOST_PREDEF_LANGUAGE_STDCPP_H
  8. #define BOOST_PREDEF_LANGUAGE_STDCPP_H
  9. #include <boost/predef/version_number.h>
  10. #include <boost/predef/make.h>
  11. /* tag::reference[]
  12. = `BOOST_LANG_STDCPP`
  13. http://en.wikipedia.org/wiki/C%2B%2B[Standard {CPP}] language.
  14. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date.
  15. Because of the way the {CPP} standardization process works the
  16. defined version year will not be the commonly known year of the standard.
  17. Specifically the defined versions are:
  18. .Detected Version Number vs. {CPP} Standard Year
  19. [options="header"]
  20. |===
  21. | Detected Version Number | Standard Year | {CPP} Standard
  22. | 27.11.1 | 1998 | ISO/IEC 14882:1998
  23. | 41.3.1 | 2011 | ISO/IEC 14882:2011
  24. | 44.2.1 | 2014 | ISO/IEC 14882:2014
  25. | 47.3.1 | 2017 | ISO/IEC 14882:2017
  26. |===
  27. [options="header"]
  28. |===
  29. | {predef_symbol} | {predef_version}
  30. | `+__cplusplus+` | {predef_detection}
  31. | `+__cplusplus+` | YYYY.MM.1
  32. |===
  33. */ // end::reference[]
  34. #define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_NOT_AVAILABLE
  35. #if defined(__cplusplus)
  36. # undef BOOST_LANG_STDCPP
  37. # if (__cplusplus > 100)
  38. # define BOOST_LANG_STDCPP BOOST_PREDEF_MAKE_YYYYMM(__cplusplus)
  39. # else
  40. # define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_AVAILABLE
  41. # endif
  42. #endif
  43. #if BOOST_LANG_STDCPP
  44. # define BOOST_LANG_STDCPP_AVAILABLE
  45. #endif
  46. #define BOOST_LANG_STDCPP_NAME "Standard C++"
  47. /* tag::reference[]
  48. = `BOOST_LANG_STDCPPCLI`
  49. http://en.wikipedia.org/wiki/C%2B%2B/CLI[Standard {CPP}/CLI] language.
  50. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date.
  51. [options="header"]
  52. |===
  53. | {predef_symbol} | {predef_version}
  54. | `+__cplusplus_cli+` | {predef_detection}
  55. | `+__cplusplus_cli+` | YYYY.MM.1
  56. |===
  57. */ // end::reference[]
  58. #define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_NOT_AVAILABLE
  59. #if defined(__cplusplus_cli)
  60. # undef BOOST_LANG_STDCPPCLI
  61. # if (__cplusplus_cli > 100)
  62. # define BOOST_LANG_STDCPPCLI BOOST_PREDEF_MAKE_YYYYMM(__cplusplus_cli)
  63. # else
  64. # define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_AVAILABLE
  65. # endif
  66. #endif
  67. #if BOOST_LANG_STDCPPCLI
  68. # define BOOST_LANG_STDCPPCLI_AVAILABLE
  69. #endif
  70. #define BOOST_LANG_STDCPPCLI_NAME "Standard C++/CLI"
  71. /* tag::reference[]
  72. = `BOOST_LANG_STDECPP`
  73. http://en.wikipedia.org/wiki/Embedded_C%2B%2B[Standard Embedded {CPP}] language.
  74. [options="header"]
  75. |===
  76. | {predef_symbol} | {predef_version}
  77. | `+__embedded_cplusplus+` | {predef_detection}
  78. |===
  79. */ // end::reference[]
  80. #define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_NOT_AVAILABLE
  81. #if defined(__embedded_cplusplus)
  82. # undef BOOST_LANG_STDECPP
  83. # define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_AVAILABLE
  84. #endif
  85. #if BOOST_LANG_STDECPP
  86. # define BOOST_LANG_STDECPP_AVAILABLE
  87. #endif
  88. #define BOOST_LANG_STDECPP_NAME "Standard Embedded C++"
  89. #endif
  90. #include <boost/predef/detail/test.h>
  91. BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPP,BOOST_LANG_STDCPP_NAME)
  92. #include <boost/predef/detail/test.h>
  93. BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPPCLI,BOOST_LANG_STDCPPCLI_NAME)
  94. #include <boost/predef/detail/test.h>
  95. BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDECPP,BOOST_LANG_STDECPP_NAME)