diff options
-rw-r--r-- | op.h | 12 | ||||
-rw-r--r-- | perl.h | 11 | ||||
-rw-r--r-- | regexp.h | 4 | ||||
-rw-r--r-- | sv.h | 8 | ||||
-rw-r--r-- | win32/makefile.mk | 2 | ||||
-rw-r--r-- | win32/win32.h | 8 |
6 files changed, 32 insertions, 13 deletions
@@ -54,12 +54,12 @@ OP* (CPERLscope(*op_ppaddr))(pTHX); \ MADPROP_IN_BASEOP \ PADOFFSET op_targ; \ - unsigned op_type:9; \ - unsigned op_opt:1; \ - unsigned op_latefree:1; \ - unsigned op_latefreed:1; \ - unsigned op_attached:1; \ - unsigned op_spare:3; \ + PERL_BITFIELD16 op_type:9; \ + PERL_BITFIELD16 op_opt:1; \ + PERL_BITFIELD16 op_latefree:1; \ + PERL_BITFIELD16 op_latefreed:1; \ + PERL_BITFIELD16 op_attached:1; \ + PERL_BITFIELD16 op_spare:3; \ U8 op_flags; \ U8 op_private; #endif @@ -3328,6 +3328,17 @@ struct nexttoken { }; #endif +/* macros to define bit-fields in structs. */ +#ifndef PERL_BITFIELD8 +# define PERL_BITFIELD8 unsigned +#endif +#ifndef PERL_BITFIELD16 +# define PERL_BITFIELD16 unsigned +#endif +#ifndef PERL_BITFIELD32 +# define PERL_BITFIELD32 unsigned +#endif + #include "sv.h" #include "regexp.h" #include "util.h" @@ -97,9 +97,9 @@ typedef struct regexp_paren_pair { I32 sublen; /* Length of string pointed by subbeg */ \ /* Information about the match that isn't often used */ \ /* offset from wrapped to the start of precomp */ \ - unsigned pre_prefix:4; \ + PERL_BITFIELD32 pre_prefix:4; \ /* number of eval groups in the pattern - for security checks */\ - unsigned seen_evals:28 + PERL_BITFIELD32 seen_evals:28 typedef struct regexp { _XPV_HEAD; @@ -117,10 +117,10 @@ struct STRUCT_SV { /* struct sv { */ _SV_HEAD(void*); _SV_HEAD_UNION; #ifdef DEBUG_LEAKING_SCALARS - unsigned sv_debug_optype:9; /* the type of OP that allocated us */ - unsigned sv_debug_inpad:1; /* was allocated in a pad for an OP */ - unsigned sv_debug_cloned:1; /* was cloned for an ithread */ - unsigned sv_debug_line:16; /* the line where we were allocated */ + PERL_BITFIELD32 sv_debug_optype:9; /* the type of OP that allocated us */ + PERL_BITFIELD32 sv_debug_inpad:1; /* was allocated in a pad for an OP */ + PERL_BITFIELD32 sv_debug_cloned:1; /* was cloned for an ithread */ + PERL_BITFIELD32 sv_debug_line:16; /* the line where we were allocated */ char * sv_debug_file; /* the file where we were allocated */ #endif }; diff --git a/win32/makefile.mk b/win32/makefile.mk index 3f145b8e67..5a0e0208c7 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -522,7 +522,7 @@ LIBOUT_FLAG = # NOTE: we assume that GCC uses MSVCRT.DLL # See comments about PERL_MSVCRT_READFIX in the "cl" compiler section below. -BUILDOPT += -fno-strict-aliasing -DPERL_MSVCRT_READFIX +BUILDOPT += -fno-strict-aliasing -mms-bitfields -DPERL_MSVCRT_READFIX .ELSE diff --git a/win32/win32.h b/win32/win32.h index 224c657507..7bfeb15503 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -170,6 +170,14 @@ struct utsname { /* Compiler-specific stuff. */ +#if defined(_MSC_VER) || defined(__MINGW32__) +/* VC uses non-standard way to determine the size and alignment if bit-fields */ +/* MinGW will compiler with -mms-bitfields, so should use the same types */ +# define PERL_BITFIELD8 unsigned char +# define PERL_BITFIELD16 unsigned short +# define PERL_BITFIELD32 unsigned int +#endif + #ifdef __BORLANDC__ /* Borland C++ */ #if (__BORLANDC__ <= 0x520) |