Change 33292 by [EMAIL PROTECTED] on 2008/02/12 14:58:50

        Subject: [PATCH] Fix bit-fields for VC [was RE: [perl #50386] GIMME_V 
broken with 5.10.0/GCC and XS?]
        From: "Jan Dubois" <[EMAIL PROTECTED]>
        Date: Fri, 1 Feb 2008 13:40:41 -0800
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/op.h#206 edit
... //depot/perl/perl.h#827 edit
... //depot/perl/regexp.h#136 edit
... //depot/perl/sv.h#345 edit
... //depot/perl/win32/makefile.mk#391 edit
... //depot/perl/win32/win32.h#129 edit

Differences ...

==== //depot/perl/op.h#206 (text) ====
Index: perl/op.h
--- perl/op.h#205~33269~        2008-02-10 02:21:04.000000000 -0800
+++ perl/op.h   2008-02-12 06:58:50.000000000 -0800
@@ -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

==== //depot/perl/perl.h#827 (text) ====
Index: perl/perl.h
--- perl/perl.h#826~33232~      2008-02-04 05:59:21.000000000 -0800
+++ perl/perl.h 2008-02-12 06:58:50.000000000 -0800
@@ -3328,6 +3328,17 @@
 };
 #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"

==== //depot/perl/regexp.h#136 (text) ====
Index: perl/regexp.h
--- perl/regexp.h#135~33077~    2008-01-26 08:44:43.000000000 -0800
+++ perl/regexp.h       2008-02-12 06:58:50.000000000 -0800
@@ -97,9 +97,9 @@
        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;

==== //depot/perl/sv.h#345 (text) ====
Index: perl/sv.h
--- perl/sv.h#344~33077~        2008-01-26 08:44:43.000000000 -0800
+++ perl/sv.h   2008-02-12 06:58:50.000000000 -0800
@@ -117,10 +117,10 @@
     _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
 };

==== //depot/perl/win32/makefile.mk#391 (text) ====
Index: perl/win32/makefile.mk
--- perl/win32/makefile.mk#390~32714~   2007-12-22 18:15:30.000000000 -0800
+++ perl/win32/makefile.mk      2008-02-12 06:58:50.000000000 -0800
@@ -522,7 +522,7 @@
 
 # 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
 

==== //depot/perl/win32/win32.h#129 (text) ====
Index: perl/win32/win32.h
--- perl/win32/win32.h#128~31347~       2007-06-07 04:48:47.000000000 -0700
+++ perl/win32/win32.h  2008-02-12 06:58:50.000000000 -0800
@@ -170,6 +170,14 @@
 
 /* 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)
End of Patch.

Reply via email to