diff options
Diffstat (limited to 'Lib/swigarch.i')
-rw-r--r-- | Lib/swigarch.i | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/Lib/swigarch.i b/Lib/swigarch.i index bf4ee8ef8..2f7614940 100644 --- a/Lib/swigarch.i +++ b/Lib/swigarch.i @@ -6,57 +6,28 @@ * Use only in extreme cases, when no arch. independent code can be * generated * - * To activate architecture specific code, use + * To activate 32-bit architecture checks, use * * swig -DSWIGWORDSIZE32 * - * or + * This adds checks that long is 32-bits when compiling the generated wrappers. + * + * To activate 64-bit architecture specific code, use * * swig -DSWIGWORDSIZE64 * - * Note that extra checking code will be added to the wrapped code, - * which will prevent the compilation in a different architecture. + * This adds checks that long is 64-bits when compiling the generated wrappers. + * Some target languages also generate code that expects long to be 64-bits. * - * If you don't specify the SWIGWORDSIZE (the default case), swig will + * If you don't specify the SWIGWORDSIZE (the default case), SWIG will * generate architecture independent and/or 32bits code, with no extra - * checking code added. + * checks for the sizeof long. * ----------------------------------------------------------------------------- */ -#if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64) -# if (__WORDSIZE == 32) -# define SWIGWORDSIZE32 -# endif -#endif - -#if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32) -# if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64) -# define SWIGWORDSIZE64 -# endif -#endif - - #ifdef SWIGWORDSIZE32 -%{ -#define SWIGWORDSIZE32 -#ifndef LONG_MAX -#include <limits.h> -#endif -#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX) -# error "SWIG wrapped code invalid in 64 bit architecture, regenerate code using -DSWIGWORDSIZE64" -#endif -%} +%fragment("long_check_wordsize32"); #endif #ifdef SWIGWORDSIZE64 -%{ -#define SWIGWORDSIZE64 -#ifndef LONG_MAX -#include <limits.h> -#endif -#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX) -# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32" +%fragment("long_check_wordsize64"); #endif -%} -#endif - - |