Boost logo

Boost-Commit :

From: tschwinger_at_[hidden]
Date: 2007-11-05 12:15:04


Author: t_schwinger
Date: 2007-11-05 12:15:04 EST (Mon, 05 Nov 2007)
New Revision: 40794
URL: http://svn.boost.org/trac/boost/changeset/40794

Log:
- nonstandard calling conventions disabled by default
- automatic fallback configuration

Text files modified:
   trunk/boost/function_types/config/compiler.hpp | 104 +++++++++++++++++++++------------------
   trunk/boost/function_types/detail/pp_cc_loop/master.hpp | 33 ++++++++++++
   trunk/boost/function_types/detail/pp_cc_loop/preprocessed.hpp | 21 ++++++++
   3 files changed, 111 insertions(+), 47 deletions(-)

Modified: trunk/boost/function_types/config/compiler.hpp
==============================================================================
--- trunk/boost/function_types/config/compiler.hpp (original)
+++ trunk/boost/function_types/config/compiler.hpp 2007-11-05 12:15:04 EST (Mon, 05 Nov 2007)
@@ -18,33 +18,36 @@
 # error "unsupported compiler version"
 # endif
 
- // enable clrcall calling covention (call to .NET managed code) when
- // compiling with /clr
-# if BOOST_MSVC >= 1400 && defined(__cplusplus_cli)
-# ifndef BOOST_FT_CC_CLRCALL
-# define BOOST_FT_CC_CLRCALL callable_builtin
-# endif
-# endif
+# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
 
- // Intel x86 architecture specific calling conventions
-# ifdef _M_IX86
-# define BOOST_FT_COMMON_X86_CCs callable_builtin
-# if BOOST_MSVC < 1400
- // version 7.1 is missing a keyword to specify the thiscall cc ...
-# ifndef BOOST_FT_CC_IMPLICIT_THISCALL
-# define BOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin
-# ifndef BOOST_FT_CONFIG_OK
-# pragma message("INFO| /Gd /Gr /Gz will compiler options will cause")
-# pragma message("INFO| a compile error.")
-# pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.")
-# pragma message("INFO| This message can be suppressed by defining")
-# pragma message("INFO| BOOST_FT_CONFIG_OK.")
-# endif
+ // enable clrcall calling covention (call to .NET managed code) when
+ // compiling with /clr
+# if BOOST_MSVC >= 1400 && defined(__cplusplus_cli)
+# ifndef BOOST_FT_CC_CLRCALL
+# define BOOST_FT_CC_CLRCALL callable_builtin
 # endif
-# else
- // ...introduced in version 8
-# ifndef BOOST_FT_CC_THISCALL
-# define BOOST_FT_CC_THISCALL non_variadic|member|callable_builtin
+# endif
+
+ // Intel x86 architecture specific calling conventions
+# ifdef _M_IX86
+# define BOOST_FT_COMMON_X86_CCs callable_builtin
+# if BOOST_MSVC < 1400
+ // version 7.1 is missing a keyword to specify the thiscall cc ...
+# ifndef BOOST_FT_CC_IMPLICIT_THISCALL
+# define BOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin
+# ifndef BOOST_FT_CONFIG_OK
+# pragma message("INFO| /Gd /Gr /Gz will compiler options will cause")
+# pragma message("INFO| a compile error.")
+# pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.")
+# pragma message("INFO| This message can be suppressed by defining")
+# pragma message("INFO| BOOST_FT_CONFIG_OK.")
+# endif
+# endif
+# else
+ // ...introduced in version 8
+# ifndef BOOST_FT_CC_THISCALL
+# define BOOST_FT_CC_THISCALL non_variadic|member|callable_builtin
+# endif
 # endif
 # endif
 # endif
@@ -55,32 +58,37 @@
 # error "unsupported compiler version"
 # endif
 
-# if defined(__i386__)
-# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439
-# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328
-# if BOOST_WORKAROUND(__GNUC__,BOOST_TESTED_AT(4))
-# ifndef BOOST_FT_CC_IMPLICIT
-# define BOOST_FT_CC_IMPLICIT member|callable_builtin
+# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
+
+# if defined(__i386__)
+# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439
+# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328
+# if BOOST_WORKAROUND(__GNUC__,BOOST_TESTED_AT(4))
+# ifndef BOOST_FT_CC_IMPLICIT
+# define BOOST_FT_CC_IMPLICIT member|callable_builtin
+# endif
+# define BOOST_FT_COMMON_X86_CCs non_member|callable_builtin
+# else
+# define BOOST_FT_COMMON_X86_CCs callable_builtin
 # endif
-# define BOOST_FT_COMMON_X86_CCs non_member|callable_builtin
 # else
-# define BOOST_FT_COMMON_X86_CCs callable_builtin
-# endif
-# else
-# ifndef BOOST_FT_CC_IMPLICIT
-# define BOOST_FT_CC_IMPLICIT callable_builtin
+# ifndef BOOST_FT_CC_IMPLICIT
+# define BOOST_FT_CC_IMPLICIT callable_builtin
+# endif
 # endif
 # endif
 
-# // TODO: straighten out this hack
-# ifndef __cdecl
-# define __cdecl __attribute__((__cdecl__))
-# endif
-# ifndef __stdcall
-# define __stdcall __attribute__((__stdcall__))
-# endif
-# ifndef __fastcall
-# define __fastcall __attribute__((__fastcall__))
+# if (defined(BOOST_FT_CC_CDECL) || defined(BOOST_FT_COMMON_X86_CCs)) \
+ && !defined(__cdecl)
+# define __cdecl __attribute__((__cdecl__))
+# endif
+# if (defined(BOOST_FT_CC_STDCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
+ && !defined(__stdcall)
+# define __stdcall __attribute__((__stdcall__))
+# endif
+# if (defined(BOOST_FT_CC_FASTCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
+ && !defined(__fastcall)
+# define __fastcall __attribute__((__fastcall__))
 # endif
 
 #elif defined(__BORLANDC__)
@@ -91,7 +99,9 @@
 # pragma message("WARNING: library untested with this compiler version")
 # endif
 
-# define BOOST_FT_COMMON_X86_CCs callable_builtin
+# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
+# define BOOST_FT_COMMON_X86_CCs callable_builtin
+# endif
 
     // syntactic specialities of cc specifier
 # define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \

Modified: trunk/boost/function_types/detail/pp_cc_loop/master.hpp
==============================================================================
--- trunk/boost/function_types/detail/pp_cc_loop/master.hpp (original)
+++ trunk/boost/function_types/detail/pp_cc_loop/master.hpp 2007-11-05 12:15:04 EST (Mon, 05 Nov 2007)
@@ -37,6 +37,37 @@
 # define BOOST_PP_ITERATION_LIMITS \
         (0,BOOST_PP_SEQ_SIZE(BOOST_FT_CC_NAMES_SEQ)-1)
 # include BOOST_PP_ITERATE()
+# if !defined(BOOST_FT_config_valid) && BOOST_FT_CC_PREPROCESSING
+# define BOOST_FT_cc_id 1
+# define BOOST_FT_cc_name implicit_cc
+# define BOOST_FT_cc BOOST_PP_EMPTY
+# define BOOST_FT_cond callable_builtin
+# include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
+# undef BOOST_FT_cond
+# undef BOOST_FT_cc_name
+# undef BOOST_FT_cc
+# undef BOOST_FT_cc_id
+# elif !defined(BOOST_FT_config_valid) // and generating preprocessed file
+BOOST_PP_EXPAND(#) ifndef BOOST_FT_config_valid
+BOOST_PP_EXPAND(#) define BOOST_FT_cc_id 1
+BOOST_PP_EXPAND(#) define BOOST_FT_cc_name implicit_cc
+BOOST_PP_EXPAND(#) define BOOST_FT_cc BOOST_PP_EMPTY
+BOOST_PP_EXPAND(#) define BOOST_FT_cond callable_builtin
+#define _()
+BOOST_PP_EXPAND(#) include BOOST_PP_EXPAND _()( <BOOST_FT_cc_file> )
+#undef _
+BOOST_PP_EXPAND(#) undef BOOST_FT_cond
+BOOST_PP_EXPAND(#) undef BOOST_FT_cc_name
+BOOST_PP_EXPAND(#) undef BOOST_FT_cc
+BOOST_PP_EXPAND(#) undef BOOST_FT_cc_id
+BOOST_PP_EXPAND(#) else
+BOOST_PP_EXPAND(#) undef BOOST_FT_config_valid
+BOOST_PP_EXPAND(#) endif
+
+# else
+# undef BOOST_FT_config_valid
+# endif
+
 # include <boost/function_types/detail/encoding/aliases_undef.hpp>
 # include <boost/function_types/detail/encoding/undef.hpp>
 
@@ -53,6 +84,7 @@
 # define BOOST_FT_cond BOOST_PP_CAT(BOOST_FT_CC_,BOOST_FT_cc_pp_name)
 
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND(<BOOST_FT_cc_file>)
 # endif
 
@@ -87,6 +119,7 @@
 # undef BOOST_FT_cc_inf
 
 BOOST_PP_EXPAND(#) if BOOST_FT_cond
+BOOST_PP_EXPAND(#) define BOOST_FT_config_valid 1
 #define _()
 BOOST_PP_EXPAND(#) include BOOST_PP_EXPAND _()(<BOOST_FT_cc_file>)
 #undef _

Modified: trunk/boost/function_types/detail/pp_cc_loop/preprocessed.hpp
==============================================================================
--- trunk/boost/function_types/detail/pp_cc_loop/preprocessed.hpp (original)
+++ trunk/boost/function_types/detail/pp_cc_loop/preprocessed.hpp 2007-11-05 12:15:04 EST (Mon, 05 Nov 2007)
@@ -14,6 +14,7 @@
 # define BOOST_FT_cc BOOST_PP_EMPTY
 # define BOOST_FT_cond BOOST_FT_CC_IMPLICIT
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -25,6 +26,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(__cdecl )
 # define BOOST_FT_cond BOOST_FT_CC_CDECL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -36,6 +38,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(__stdcall )
 # define BOOST_FT_cond BOOST_FT_CC_STDCALL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -47,6 +50,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(pascal )
 # define BOOST_FT_cond BOOST_FT_CC_PASCAL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -58,6 +62,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(__fastcall)
 # define BOOST_FT_cond BOOST_FT_CC_FASTCALL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -69,6 +74,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(__clrcall )
 # define BOOST_FT_cond BOOST_FT_CC_CLRCALL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -80,6 +86,7 @@
 # define BOOST_FT_cc BOOST_PP_IDENTITY(__thiscall)
 # define BOOST_FT_cond BOOST_FT_CC_THISCALL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
@@ -91,9 +98,23 @@
 # define BOOST_FT_cc BOOST_PP_EMPTY
 # define BOOST_FT_cond BOOST_FT_CC_IMPLICIT_THISCALL
 # if BOOST_FT_cond
+# define BOOST_FT_config_valid 1
 # include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
 # endif
 # undef BOOST_FT_cond
 # undef BOOST_FT_cc_name
 # undef BOOST_FT_cc
 # undef BOOST_FT_cc_id
+# ifndef BOOST_FT_config_valid
+# define BOOST_FT_cc_id 1
+# define BOOST_FT_cc_name implicit_cc
+# define BOOST_FT_cc BOOST_PP_EMPTY
+# define BOOST_FT_cond 0x00000001
+# include BOOST_PP_EXPAND ( <BOOST_FT_cc_file> )
+# undef BOOST_FT_cond
+# undef BOOST_FT_cc_name
+# undef BOOST_FT_cc
+# undef BOOST_FT_cc_id
+# else
+# undef BOOST_FT_config_valid
+# endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk