blob: 87170a1d67efc03d9d87d30ab63fc6b8ba2ed7bc [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
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 Thompson3d613fd2013-10-15 15:39:04 -07009#ifndef NDNBOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
10#define NDNBOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070011
12#include <ndnboost/config.hpp>
13#include <ndnboost/detail/workaround.hpp>
14
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#if defined(NDNBOOST_MSVC)
Jeff Thompsona28eed82013-08-22 16:21:10 -070016
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017# if NDNBOOST_MSVC < 1310
Jeff Thompsona28eed82013-08-22 16:21:10 -070018# error "unsupported compiler version"
19# endif
20
Jeff Thompson3d613fd2013-10-15 15:39:04 -070021# ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS
Jeff Thompsona28eed82013-08-22 16:21:10 -070022
23 // enable clrcall calling covention (call to .NET managed code) when
24 // compiling with /clr
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025# if NDNBOOST_MSVC >= 1400 && defined(__cplusplus_cli)
26# ifndef NDNBOOST_FT_CC_CLRCALL
27# define NDNBOOST_FT_CC_CLRCALL callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070028# endif
29# endif
30
31 // Intel x86 architecture specific calling conventions
32# ifdef _M_IX86
Jeff Thompson3d613fd2013-10-15 15:39:04 -070033# define NDNBOOST_FT_COMMON_X86_CCs callable_builtin
34# if NDNBOOST_MSVC < 1400
Jeff Thompsona28eed82013-08-22 16:21:10 -070035 // version 7.1 is missing a keyword to specify the thiscall cc ...
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036# 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 Thompsona28eed82013-08-22 16:21:10 -070039# 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 Thompson3d613fd2013-10-15 15:39:04 -070043# pragma message("INFO| NDNBOOST_FT_CONFIG_OK.")
Jeff Thompsona28eed82013-08-22 16:21:10 -070044# endif
45# endif
46# else
47 // ...introduced in version 8
Jeff Thompson3d613fd2013-10-15 15:39:04 -070048# ifndef NDNBOOST_FT_CC_THISCALL
49# define NDNBOOST_FT_CC_THISCALL non_variadic|member|callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070050# endif
51# endif
52# endif
53# endif
54
Jeff Thompson3d613fd2013-10-15 15:39:04 -070055#elif defined(__GNUC__) && !defined(NDNBOOST_INTEL_LINUX)
Jeff Thompsona28eed82013-08-22 16:21:10 -070056
57# if __GNUC__ < 3
58# error "unsupported compiler version"
59# endif
60
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061# ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS
Jeff Thompsona28eed82013-08-22 16:21:10 -070062
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 Thompson3d613fd2013-10-15 15:39:04 -070066# if NDNBOOST_WORKAROUND(__GNUC__,NDNBOOST_TESTED_AT(4))
67# ifndef NDNBOOST_FT_CC_IMPLICIT
68# define NDNBOOST_FT_CC_IMPLICIT member|callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070069# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070070# define NDNBOOST_FT_COMMON_X86_CCs non_member|callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070071# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070072# define NDNBOOST_FT_COMMON_X86_CCs callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070073# endif
74# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070075# ifndef NDNBOOST_FT_CC_IMPLICIT
76# define NDNBOOST_FT_CC_IMPLICIT callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -070077# endif
78# endif
79# endif
80
Jeff Thompson3d613fd2013-10-15 15:39:04 -070081# if (defined(NDNBOOST_FT_CC_CDECL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070082 && !defined(__cdecl)
83# define __cdecl __attribute__((__cdecl__))
84# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070085# if (defined(NDNBOOST_FT_CC_STDCALL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070086 && !defined(__stdcall)
87# define __stdcall __attribute__((__stdcall__))
88# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070089# if (defined(NDNBOOST_FT_CC_FASTCALL) || defined(NDNBOOST_FT_COMMON_X86_CCs)) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070090 && !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 Thompson3d613fd2013-10-15 15:39:04 -0700102# ifdef NDNBOOST_FT_AUTODETECT_CALLING_CONVENTIONS
103# define NDNBOOST_FT_COMMON_X86_CCs callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -0700104# endif
105
106 // syntactic specialities of cc specifier
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700107# define NDNBOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
Jeff Thompsona28eed82013-08-22 16:21:10 -0700108 result() cc_spec() lparen() type_mod() name() rparen()
109#else
110 // only enable default calling convention
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700111# define NDNBOOST_FT_CC_IMPLICIT callable_builtin
Jeff Thompsona28eed82013-08-22 16:21:10 -0700112#endif
113
114
115#endif
116