gcc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Copyright Rene Rivera 2008-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_COMPILER_GCC_H
  8. #define BOOST_PREDEF_COMPILER_GCC_H
  9. /* Other compilers that emulate this one need to be detected first. */
  10. #include <boost/predef/compiler/clang.h>
  11. #include <boost/predef/version_number.h>
  12. #include <boost/predef/make.h>
  13. /* tag::reference[]
  14. = `BOOST_COMP_GNUC`
  15. http://en.wikipedia.org/wiki/GNU_Compiler_Collection[Gnu GCC C/{CPP}] compiler.
  16. Version number available as major, minor, and patch (if available).
  17. [options="header"]
  18. |===
  19. | {predef_symbol} | {predef_version}
  20. | `+__GNUC__+` | {predef_detection}
  21. | `+__GNUC__+`, `+__GNUC_MINOR__+`, `+__GNUC_PATCHLEVEL__+` | V.R.P
  22. | `+__GNUC__+`, `+__GNUC_MINOR__+` | V.R.0
  23. |===
  24. */ // end::reference[]
  25. #define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE
  26. #if defined(__GNUC__)
  27. # if !defined(BOOST_COMP_GNUC_DETECTION) && defined(__GNUC_PATCHLEVEL__)
  28. # define BOOST_COMP_GNUC_DETECTION \
  29. BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
  30. # endif
  31. # if !defined(BOOST_COMP_GNUC_DETECTION)
  32. # define BOOST_COMP_GNUC_DETECTION \
  33. BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0)
  34. # endif
  35. #endif
  36. #ifdef BOOST_COMP_GNUC_DETECTION
  37. # if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
  38. # define BOOST_COMP_GNUC_EMULATED BOOST_COMP_GNUC_DETECTION
  39. # else
  40. # undef BOOST_COMP_GNUC
  41. # define BOOST_COMP_GNUC BOOST_COMP_GNUC_DETECTION
  42. # endif
  43. # define BOOST_COMP_GNUC_AVAILABLE
  44. # include <boost/predef/detail/comp_detected.h>
  45. #endif
  46. #define BOOST_COMP_GNUC_NAME "Gnu GCC C/C++"
  47. #endif
  48. #include <boost/predef/detail/test.h>
  49. BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC,BOOST_COMP_GNUC_NAME)
  50. #ifdef BOOST_COMP_GNUC_EMULATED
  51. #include <boost/predef/detail/test.h>
  52. BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC_EMULATED,BOOST_COMP_GNUC_NAME)
  53. #endif