Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
| 2 | // (C) Copyright Tobias Schwinger |
| 3 | // |
| 4 | // Use modification and distribution are subject to the boost Software License, |
| 5 | // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). |
| 6 | |
| 7 | //------------------------------------------------------------------------------ |
| 8 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 9 | #ifndef NDNBOOST_FT_CONFIG_COMPILER_HPP_INCLUDED |
| 10 | #define NDNBOOST_FT_CONFIG_COMPILER_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 11 | |
| 12 | #include <ndnboost/config.hpp> |
| 13 | #include <ndnboost/detail/workaround.hpp> |
| 14 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | #if defined(NDNBOOST_MSVC) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 16 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 17 | # if NDNBOOST_MSVC < 1310 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 18 | # error "unsupported compiler version" |
| 19 | # endif |
| 20 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 21 | # ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 22 | |
| 23 | // enable clrcall calling covention (call to .NET managed code) when |
| 24 | // compiling with /clr |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 25 | # if NDNBOOST_MSVC >= 1400 && defined(__cplusplus_cli) |
| 26 | # ifndef NDNBOOST_FT_CC_CLRCALL |
| 27 | # define NDNBOOST_FT_CC_CLRCALL callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 28 | # endif |
| 29 | # endif |
| 30 | |
| 31 | // Intel x86 architecture specific calling conventions |
| 32 | # ifdef _M_IX86 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 33 | # define NDNBOOST_FT_COMMON_X86_CCs callable_builtin |
| 34 | # if NDNBOOST_MSVC < 1400 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 35 | // version 7.1 is missing a keyword to specify the thiscall cc ... |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 36 | # ifndef NDNBOOST_FT_CC_IMPLICIT_THISCALL |
| 37 | # define NDNBOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin |
| 38 | # ifndef NDNBOOST_FT_CONFIG_OK |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 39 | # pragma message("INFO| /Gd /Gr /Gz will compiler options will cause") |
| 40 | # pragma message("INFO| a compile error.") |
| 41 | # pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.") |
| 42 | # pragma message("INFO| This message can be suppressed by defining") |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 43 | # pragma message("INFO| NDNBOOST_FT_CONFIG_OK.") |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 44 | # endif |
| 45 | # endif |
| 46 | # else |
| 47 | // ...introduced in version 8 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 48 | # ifndef NDNBOOST_FT_CC_THISCALL |
| 49 | # define NDNBOOST_FT_CC_THISCALL non_variadic|member|callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 50 | # endif |
| 51 | # endif |
| 52 | # endif |
| 53 | # endif |
| 54 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 55 | #elif defined(__GNUC__) && !defined(NDNBOOST_INTEL_LINUX) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 56 | |
| 57 | # if __GNUC__ < 3 |
| 58 | # error "unsupported compiler version" |
| 59 | # endif |
| 60 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 61 | # ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 62 | |
| 63 | # if defined(__i386__) |
| 64 | # // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439 |
| 65 | # // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 66 | # if NDNBOOST_WORKAROUND(__GNUC__,NDNBOOST_TESTED_AT(4)) |
| 67 | # ifndef NDNBOOST_FT_CC_IMPLICIT |
| 68 | # define NDNBOOST_FT_CC_IMPLICIT member|callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 69 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 70 | # define NDNBOOST_FT_COMMON_X86_CCs non_member|callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 71 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 72 | # define NDNBOOST_FT_COMMON_X86_CCs callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 73 | # endif |
| 74 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 75 | # ifndef NDNBOOST_FT_CC_IMPLICIT |
| 76 | # define NDNBOOST_FT_CC_IMPLICIT callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 77 | # endif |
| 78 | # endif |
| 79 | # endif |
| 80 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 81 | # if (defined(NDNBOOST_FT_CC_CDECL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 82 | && !defined(__cdecl) |
| 83 | # define __cdecl __attribute__((__cdecl__)) |
| 84 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 85 | # if (defined(NDNBOOST_FT_CC_STDCALL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 86 | && !defined(__stdcall) |
| 87 | # define __stdcall __attribute__((__stdcall__)) |
| 88 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 89 | # if (defined(NDNBOOST_FT_CC_FASTCALL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 90 | && !defined(__fastcall) |
| 91 | # define __fastcall __attribute__((__fastcall__)) |
| 92 | # endif |
| 93 | |
| 94 | #elif defined(__BORLANDC__) |
| 95 | |
| 96 | # if __BORLANDC__ < 0x550 |
| 97 | # error "unsupported compiler version" |
| 98 | # elif __BORLANDC__ > 0x565 |
| 99 | # pragma message("WARNING: library untested with this compiler version") |
| 100 | # endif |
| 101 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 102 | # ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS |
| 103 | # define NDNBOOST_FT_COMMON_X86_CCs callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 104 | # endif |
| 105 | |
| 106 | // syntactic specialities of cc specifier |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 107 | # define NDNBOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 108 | result() cc_spec() lparen() type_mod() name() rparen() |
| 109 | #else |
| 110 | // only enable default calling convention |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 111 | # define NDNBOOST_FT_CC_IMPLICIT callable_builtin |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 112 | #endif |
| 113 | |
| 114 | |
| 115 | #endif |
| 116 | |