# New Ticket Created by  Steve Peters 
# Please include the string:  [perl #42271]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42271 >


The attached patch are some of the cleanups needed for compiling Parrot
with Borland C++ on Windows.  It is not yet compiling after this patch
because one of the changes that helped Borland C++ seems to cause the
Parrot go out of control and suck up all available CPU and memory on Linux.

Back to the drawing board,

Steve Peters
[EMAIL PROTECTED]
Index: src/events.c
===================================================================
--- src/events.c        (revision 17931)
+++ src/events.c        (working copy)
@@ -939,7 +939,7 @@
     QUEUE_ENTRY *entry;
     parrot_event* event;
 
-    while ((entry = peek_entry(event_q))) {
+    while ((entry = peek_entry(event_q)) != NULL) {
         /*
          * one or more entries arrived - we hold the mutex again
          * so we have to use the nonsyc_pop_entry to pop off event entries
Index: src/gc/dod.c
===================================================================
--- src/gc/dod.c        (revision 17931)
+++ src/gc/dod.c        (working copy)
@@ -253,11 +253,11 @@
      * get created as constant PMCs.
      */
     for (i = 1; i < (unsigned int)interp->n_vtable_max; i++) {
-        VTABLE *vtable;
+        VTABLE *vtable = interp->vtables[i];
         /*
          * XXX dynpmc groups have empty slots for abstract objects
          */
-        if ((vtable = interp->vtables[i])) {
+        if (vtable) {
 #if 0
             if (vtable->class)
                 pobject_lives(interp, (PObj *)vtable->class);
Index: src/string.c
===================================================================
--- src/string.c        (revision 17931)
+++ src/string.c        (working copy)
@@ -528,6 +528,7 @@
             return NULL;
             break;
     }
+    return NULL;
 }
 
 /*
Index: src/objects.c
===================================================================
--- src/objects.c       (revision 17931)
+++ src/objects.c       (working copy)
@@ -42,7 +42,7 @@
 {
     int i;
     const char *meth;
-    for (i = 0; (meth = Parrot_vtable_slot_names[i]); ++i) {
+    for (i = 0; (meth = Parrot_vtable_slot_names[i]) != NULL; ++i) {
         if (!*meth)
             continue;
         /* XXX slot_names still have __ in front */
@@ -309,7 +309,7 @@
     memset(&meth_str, 0, sizeof (meth_str));
     meth_str.encoding = Parrot_fixed_8_encoding_ptr;
     meth_str.charset = Parrot_default_charset_ptr;
-    for (i = 0; (meth = Parrot_vtable_slot_names[i]); ++i) {
+    for (i = 0; (meth = Parrot_vtable_slot_names[i]) != NULL; ++i) {
         if (!*meth)
             continue;
         meth_str.strstart = const_cast(meth);
@@ -746,7 +746,8 @@
         return NULL;
     meth = VTABLE_get_string(interp, prop);
 #else
-    if (!(props = PMC_metadata(class)))
+    props = PMC_metadata(class);
+    if (!props)
         return NULL;
     b = parrot_hash_get_bucket(interp,
                 (Hash*) PMC_struct_val(props), prop_str);
Index: src/pmc/os.pmc
===================================================================
--- src/pmc/os.pmc      (revision 17931)
+++ src/pmc/os.pmc      (working copy)
@@ -19,9 +19,12 @@
 
 */
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER)
 #  include <direct.h>
 #  include <io.h>
+#elif defined(__BORLANDC__)
+#  include <dir.h>
+#  include <dirent.h>
 #else
 #  include <dirent.h>
 #endif
Index: src/library.c
===================================================================
--- src/library.c       (revision 17931)
+++ src/library.c       (working copy)
@@ -176,7 +176,7 @@
     assert(path->encoding == Parrot_fixed_8_encoding_ptr ||
         path->encoding == Parrot_utf8_encoding_ptr);
 
-    while (cnv = strchr(path->strstart, path_separator))
+    while ((cnv = strchr(path->strstart, path_separator)) != NULL)
         *cnv = win32_path_separator;
 }
 
Index: src/exceptions.c
===================================================================
--- src/exceptions.c    (revision 17931)
+++ src/exceptions.c    (working copy)
@@ -235,7 +235,7 @@
     message = VTABLE_get_string_keyed_int(interp, exception, 0);
     /* [TODO: replace quadratic search with something linear, hopefully without
        trashing abstraction layers.  -- rgr, 17-Sep-06.] */
-    while ((e = stack_entry(interp, interp->dynamic_env, depth))) {
+    while ((e = stack_entry(interp, interp->dynamic_env, depth)) != NULL) {
         if (e->entry_type == STACK_ENTRY_PMC) {
             handler = UVal_pmc(e->entry);
             if (handler && handler->vtable->base_type ==
Index: config/init/hints/mswin32.pm
===================================================================
--- config/init/hints/mswin32.pm        (revision 17931)
+++ config/init/hints/mswin32.pm        (working copy)
@@ -145,7 +145,7 @@
             share_ext  => '.dll',
             load_ext   => '.dll',
             cc         => ${cc},
-            ccflags    => '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG 
-D_CONSOLE',
+            ccflags    => '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE 
-w-par -w-aus -w-ccc -w-rch',
             cc_o_out   => '-o',
             cc_exe_out => '-e',
             cc_debug   => '-v',
@@ -162,10 +162,10 @@
             link      => ${cc},
             linkflags => '',
 
-            ar       => 'tlib',
+            ar       => 'tlib /a /P128',
             ar_flags => '',
             ar_out   => '',
-            ar_extra => '/au',
+            ar_extra => '',
             slash    => '\\',
             blib_dir => 'blib\\lib',
             make_and => "\n\t",

Reply via email to