summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op.h12
-rw-r--r--perl.h11
-rw-r--r--regexp.h4
-rw-r--r--sv.h8
-rw-r--r--win32/makefile.mk2
-rw-r--r--win32/win32.h8
6 files changed, 32 insertions, 13 deletions
diff --git a/op.h b/op.h
index 5c189008b8..b35e9da6be 100644
--- a/op.h
+++ b/op.h
@@ -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
diff --git a/perl.h b/perl.h
index 35bc28a53a..16b0c7c5ef 100644
--- a/perl.h
+++ b/perl.h
@@ -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"
diff --git a/regexp.h b/regexp.h
index f2366ca513..156e60b4e5 100644
--- a/regexp.h
+++ b/regexp.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;
diff --git a/sv.h b/sv.h
index 29a689dfa2..fc67ed9aba 100644
--- a/sv.h
+++ b/sv.h
@@ -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)