compiler.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #ifndef BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
  7. #define BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
  8. #include <boost/config.hpp>
  9. #include <boost/detail/workaround.hpp>
  10. #if defined(BOOST_MSVC)
  11. # if BOOST_MSVC < 1310
  12. # error "unsupported compiler version"
  13. # endif
  14. # ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
  15. // enable clrcall calling covention (call to .NET managed code) when
  16. // compiling with /clr
  17. # if BOOST_MSVC >= 1400 && defined(__cplusplus_cli)
  18. # ifndef BOOST_FT_CC_CLRCALL
  19. # define BOOST_FT_CC_CLRCALL callable_builtin
  20. # endif
  21. # endif
  22. // Intel x86 architecture specific calling conventions
  23. # ifdef _M_IX86
  24. # define BOOST_FT_COMMON_X86_CCs callable_builtin
  25. # if BOOST_MSVC < 1400
  26. // version 7.1 is missing a keyword to specify the thiscall cc ...
  27. # ifndef BOOST_FT_CC_IMPLICIT_THISCALL
  28. # define BOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin
  29. # ifndef BOOST_FT_CONFIG_OK
  30. # pragma message("INFO| /Gd /Gr /Gz will compiler options will cause")
  31. # pragma message("INFO| a compile error.")
  32. # pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.")
  33. # pragma message("INFO| This message can be suppressed by defining")
  34. # pragma message("INFO| BOOST_FT_CONFIG_OK.")
  35. # endif
  36. # endif
  37. # else
  38. // ...introduced in version 8
  39. # ifndef BOOST_FT_CC_THISCALL
  40. # define BOOST_FT_CC_THISCALL non_variadic|member|callable_builtin
  41. # endif
  42. # endif
  43. # endif
  44. # endif
  45. #elif defined(__GNUC__) && !defined(BOOST_INTEL_LINUX)
  46. # if __GNUC__ < 3
  47. # error "unsupported compiler version"
  48. # endif
  49. # ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
  50. # if defined(__i386__)
  51. # // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439
  52. # // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328
  53. # if BOOST_WORKAROUND(__GNUC__,BOOST_TESTED_AT(4))
  54. # ifndef BOOST_FT_CC_IMPLICIT
  55. # define BOOST_FT_CC_IMPLICIT member|callable_builtin
  56. # endif
  57. # define BOOST_FT_COMMON_X86_CCs non_member|callable_builtin
  58. # else
  59. # define BOOST_FT_COMMON_X86_CCs callable_builtin
  60. # endif
  61. # else
  62. # ifndef BOOST_FT_CC_IMPLICIT
  63. # define BOOST_FT_CC_IMPLICIT callable_builtin
  64. # endif
  65. # endif
  66. # endif
  67. # if (defined(BOOST_FT_CC_CDECL) || defined(BOOST_FT_COMMON_X86_CCs)) \
  68. && !defined(__cdecl)
  69. # define __cdecl __attribute__((__cdecl__))
  70. # endif
  71. # if (defined(BOOST_FT_CC_STDCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
  72. && !defined(__stdcall)
  73. # define __stdcall __attribute__((__stdcall__))
  74. # endif
  75. # if (defined(BOOST_FT_CC_FASTCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
  76. && !defined(__fastcall)
  77. # define __fastcall __attribute__((__fastcall__))
  78. # endif
  79. #elif defined(__BORLANDC__)
  80. # if __BORLANDC__ < 0x550
  81. # error "unsupported compiler version"
  82. # elif __BORLANDC__ > 0x565
  83. # pragma message("WARNING: library untested with this compiler version")
  84. # endif
  85. # ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
  86. # define BOOST_FT_COMMON_X86_CCs callable_builtin
  87. # endif
  88. // syntactic specialities of cc specifier
  89. # define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
  90. result() cc_spec() lparen() type_mod() name() rparen()
  91. #else
  92. // only enable default calling convention
  93. # define BOOST_FT_CC_IMPLICIT callable_builtin
  94. #endif
  95. #endif