Attached patch fixes many of the warnings you see on MSVC level 4.  The
ones listed below, this patch does *not* handle.

core.ops and rx.ops have some warnings about the use of MAKE_KEY, and the
non-use of the variables returned by MAKE_KEY. I believe Steve Fink's
patch fixes these.


io_win32.c has the following problems:

PIO_win32_open's:
int err = GetLastError();
C:\p\parrot8\parrot\io\io_win32.c(157) :
warning C4189: 'err' : local variable is initialized but not referenced

PIO_win32_read's:
return -1;
C:\p\parrot8\parrot\io\io_win32.c(224) : warning C4245: 'return' :
conversion from 'const int ' to 'unsigned int ', signed/unsigned mismatch

PIO_win32_write's:
return -1;
C:\p\parrot8\parrot\io\io_win32.c(237) : warning C4245: 'return' :
conversion from 'const int ' to 'unsigned int ', signed/unsigned mismatch

PIO_win32_read's:
return -1;
C:\p\parrot8\parrot\io\io_win32.c(224) : warning C4702: unreachable code


Finally, the other, but less severe warnings, are:

key.c has an unreferenced function, debug_key.

misc.c has an unreferenced function, Pad_it.

resources.c has an unreferenced function, find_dead_strings. (I thought
Dan said this wasn't needed anymore?)

Finally, we have parrot.c, a completely empty file. Does it have a
purpose, or can it be removed?

Mike Lambert

? parrot/Debug
? parrot/parrot.ilk
? parrot/parrotexe.dsp
? parrot/parrotexe.dsw
? parrot/parrotexe.ncb
? parrot/parrotexe.plg
Index: parrot/core.ops
===================================================================
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.113
diff -u -r1.113 core.ops
--- parrot/core.ops     22 Mar 2002 20:24:02 -0000      1.113
+++ parrot/core.ops     28 Mar 2002 06:30:59 -0000
@@ -2262,7 +2262,6 @@
 =cut
 
 op entrytype(out INT, in INT) {
-  size_t height;
   Stack_entry *entry;
 
   entry = stack_entry(interpreter, interpreter->user_stack, $2);
Index: parrot/misc.c
===================================================================
RCS file: /cvs/public/parrot/misc.c,v
retrieving revision 1.19
diff -u -r1.19 misc.c
--- parrot/misc.c       17 Mar 2002 06:44:41 -0000      1.19
+++ parrot/misc.c       28 Mar 2002 06:30:59 -0000
@@ -89,38 +89,40 @@
 void int_to_str(char *, char *, HUGEINTVAL, INTVAL );
 */
 
-void gen_sprintf_call(char *, char *, SpfInfo, int);
+void gen_sprintf_call(char *, char *, SpfInfo, char);
 
 static void
-uint_to_str(char *buf1, char *buf2, UHUGEINTVAL num, INTVAL base)
+uint_to_str(char *buf1, char *buf2, UHUGEINTVAL num, byte base)
 {
-    int i = 0, cur;
+    int i = 0, cur2;
+       byte cur;
 
     do {
-        cur = num % base;
+        cur = (byte)(num % base);
 
         if (cur < 10) {
-            buf2[i] = '0' + cur;
+            buf2[i] = (char)('0' + cur);
         }
         else {
-            buf2[i] = 'a' + cur;
+            buf2[i] = (char)('a' + cur);
         }
 
         i++;
     } while (num /= base);
 
-    cur = i;
+    cur2 = i;
 
-    for (i = 0; i <= cur; i++) {
-        buf1[i] = buf2[cur - i];
+    for (i = 0; i <= cur2; i++) {
+        buf1[i] = buf2[cur2 - i];
     }
 }
 
 static void
-int_to_str(char *buf1, char *buf2, HUGEINTVAL num, INTVAL base)
+int_to_str(char *buf1, char *buf2, HUGEINTVAL num, char base)
 {
     BOOLVAL neg;
-    int i = 0, cur;
+    int i = 0, cur2;
+       byte cur;
 
     if (num < 0) {
         neg = 1;
@@ -131,13 +133,13 @@
     }
 
     do {
-        cur = num % base;
+        cur = (byte)(num % base);
 
         if (cur < 10) {
-            buf2[i] = '0' + cur;
+            buf2[i] = (char)('0' + cur);
         }
         else {
-            buf2[i] = 'a' + cur;
+            buf2[i] = (char)('a' + cur);
         }
 
         i++;
@@ -147,10 +149,10 @@
         buf2[i++] = '-';
     }
 
-    cur = i;
+    cur2 = i;
 
-    for (i = 0; i < cur; i++) {
-        buf1[i] = buf2[cur - i - 1];
+    for (i = 0; i < cur2; i++) {
+        buf1[i] = buf2[cur2 - i - 1];
     }
 
     buf1[i] = 0;
@@ -186,7 +188,7 @@
 }
 
 void
-gen_sprintf_call(char *buf, char *buf2, SpfInfo info, int thingy)
+gen_sprintf_call(char *buf, char *buf2, SpfInfo info, char thingy)
 {
     int i = 0;
     buf[i++] = '%';
@@ -251,7 +253,7 @@
 
                 for (i++; i < (INTVAL)string_length(pat)
                      && info.phase != PHASE_DONE; i++) {
-                    char ch = string_ord(pat, i);
+                    INTVAL ch = string_ord(pat, i);
 
                     switch (info.phase) {
                     /*@fallthrough@ */ case PHASE_FLAGS:
@@ -411,7 +413,7 @@
 
                         case 'f':
                             dbl = va_arg(*args, double);
-                            gen_sprintf_call(t1, t2, &info, (char)'f');
+                            gen_sprintf_call(t1, t2, &info, 'f');
                             sprintf(t2, t1, dbl);
                             targ = string_concat(interpreter, targ,
                                                  cstr2pstr(t2), 0);
Index: parrot/packfile.c
===================================================================
RCS file: /cvs/public/parrot/packfile.c,v
retrieving revision 1.36
diff -u -r1.36 packfile.c
--- parrot/packfile.c   18 Mar 2002 15:35:15 -0000      1.36
+++ parrot/packfile.c   28 Mar 2002 06:31:00 -0000
@@ -568,7 +568,7 @@
 
 ***************************************/
 
-opcode_t
+BOOLVAL
 PackFile_Constant_unpack(struct Parrot_Interp *interpreter,
                          struct PackFile_Constant *self, opcode_t *packed,
                          opcode_t packed_size)
@@ -576,7 +576,7 @@
     opcode_t *cursor;
     opcode_t type;
     opcode_t size;
-    opcode_t rc = 1;
+    BOOLVAL rc = 1;
 
     UNUSED(packed_size);
 
@@ -632,7 +632,7 @@
 
 ***************************************/
 
-opcode_t
+BOOLVAL
 PackFile_Constant_unpack_number(struct PackFile_Constant *self,
                                 opcode_t *packed, opcode_t packed_size)
 {
@@ -683,7 +683,7 @@
 
 ***************************************/
 
-opcode_t
+BOOLVAL
 PackFile_Constant_unpack_string(struct Parrot_Interp *interpreter,
                                 struct PackFile_Constant *self,
                                 opcode_t *packed, opcode_t packed_size)
Index: parrot/packout.c
===================================================================
RCS file: /cvs/public/parrot/packout.c,v
retrieving revision 1.4
diff -u -r1.4 packout.c
--- parrot/packout.c    17 Mar 2002 06:44:41 -0000      1.4
+++ parrot/packout.c    28 Mar 2002 06:31:00 -0000
@@ -196,7 +196,6 @@
 PackFile_Constant_pack(struct PackFile_Constant *self, opcode_t *packed)
 {
     opcode_t *cursor;
-    FLOATVAL *nv_ptr;
     char *charcursor;
     size_t i;
     opcode_t padded_size;
Index: parrot/rx.c
===================================================================
RCS file: /cvs/public/parrot/rx.c,v
retrieving revision 1.12
diff -u -r1.12 rx.c
--- parrot/rx.c 9 Mar 2002 01:41:39 -0000       1.12
+++ parrot/rx.c 28 Mar 2002 06:31:00 -0000
@@ -178,7 +178,7 @@
         return 0;
     }
 
-    return bmp->bmp[ch >> 3] & (1 << (ch & 7));
+    return (BOOLVAL)( bmp->bmp[ch >> 3] & (1 << (ch & 7)) ? 1 : 0 );
 }
 
 void
Index: parrot/string.c
===================================================================
RCS file: /cvs/public/parrot/string.c,v
retrieving revision 1.64
diff -u -r1.64 string.c
--- parrot/string.c     24 Mar 2002 06:57:28 -0000      1.64
+++ parrot/string.c     28 Mar 2002 06:31:01 -0000
@@ -434,8 +434,6 @@
                                  * end of our piece */
     UINTVAL true_offset;
     UINTVAL true_length;
-    UINTVAL new_length;
-    UINTVAL new_size;
     INTVAL diff;
         
     true_offset = (UINTVAL)offset;
@@ -791,7 +789,7 @@
      * would approach 128 characters in the buffer.
      */
     do {
-        *--ptr = '0' + i % 10;
+        *--ptr = (char)('0' + i % 10);
     }
     while(i /= 10);
 
Index: parrot/warnings.c
===================================================================
RCS file: /cvs/public/parrot/warnings.c,v
retrieving revision 1.5
diff -u -r1.5 warnings.c
--- parrot/warnings.c   5 Mar 2002 05:18:19 -0000       1.5
+++ parrot/warnings.c   28 Mar 2002 06:31:01 -0000
@@ -15,17 +15,18 @@
         return 2;
     }
 
-    if (!(targ = Parrot_vsprintf_c(interpreter, message, &args))) {
+    targ = Parrot_vsprintf_c(interpreter, message, &args);
+    if (!targ) {
         return -1;
     }
 
     va_end(args);
 
-    if (!
-        (targ =
+    targ =
          Parrot_sprintf_c(interpreter, "%S at %S line %d.\n", targ,
                           interpreter->current_file,
-                          interpreter->current_line))) {
+                          interpreter->current_line);
+    if (!targ) {
         return -1;
     }
 
@@ -52,17 +53,18 @@
         return 2;
     }
 
-    if (!(targ = Parrot_vsprintf_s(interpreter, message, &args))) {
+       targ = Parrot_vsprintf_s(interpreter, message, &args);
+    if (!targ) {
         return -1;
     }
 
     va_end(args);
 
-    if (!
-        (targ =
+    targ =
          Parrot_sprintf_c(interpreter, "%S at %S line %d.\n", targ,
                           interpreter->current_file,
-                          interpreter->current_line))) {
+                          interpreter->current_line);
+    if (!targ) {
         return -1;
     }
 
Index: parrot/classes/intqueue.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/intqueue.pmc,v
retrieving revision 1.7
diff -u -r1.7 intqueue.pmc
--- parrot/classes/intqueue.pmc 21 Mar 2002 23:29:26 -0000      1.7
+++ parrot/classes/intqueue.pmc 28 Mar 2002 06:31:01 -0000
@@ -138,7 +138,7 @@
     }
 
     BOOLVAL get_bool () {
-       return queue_length(SELF->data) != 0;
+       return (BOOLVAL)(queue_length(SELF->data) != 0);
     }
 
     void* get_value () {
@@ -147,8 +147,8 @@
 
     BOOLVAL is_same (PMC* other) {
         /* Do you refer to exactly the same data that I do? */
-        return other->vtable == SELF->vtable /* You never know if you've been 
inherited...*/
-            && SELF->cache.int_val == other->cache.int_val;
+        return (BOOLVAL)(other->vtable == SELF->vtable /* You never know if you've 
+been inherited...*/
+            && SELF->cache.int_val == other->cache.int_val);
     }
 
     void set_integer (PMC* value) {
@@ -531,7 +531,7 @@
 
     /* == operation */
     BOOLVAL is_equal (PMC* value) {
-        return SELF->cache.int_val == value->vtable->get_integer(INTERP, value);
+        return (BOOLVAL)(SELF->cache.int_val == value->vtable->get_integer(INTERP, 
+value));
     }
 
     void logical_or (PMC* value, PMC* dest) {
Index: parrot/include/parrot/packfile.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/packfile.h,v
retrieving revision 1.17
diff -u -r1.17 packfile.h
--- parrot/include/parrot/packfile.h    15 Mar 2002 21:56:06 -0000      1.17
+++ parrot/include/parrot/packfile.h    28 Mar 2002 06:31:01 -0000
@@ -107,14 +107,14 @@
 void
 PackFile_Constant_destroy(struct PackFile_Constant * self);
 
-opcode_t PackFile_Constant_unpack(struct Parrot_Interp *interpreter,
+BOOLVAL PackFile_Constant_unpack(struct Parrot_Interp *interpreter,
                                   struct PackFile_Constant *self,
                                   opcode_t *packed, opcode_t packed_size);
 
-opcode_t
+BOOLVAL
 PackFile_Constant_unpack_number(struct PackFile_Constant * self, opcode_t * packed, 
opcode_t packed_size);
 
-opcode_t PackFile_Constant_unpack_string(struct Parrot_Interp *interpreter,
+BOOLVAL PackFile_Constant_unpack_string(struct Parrot_Interp *interpreter,
                                          struct PackFile_Constant *self,
                                          opcode_t *packed,
                                          opcode_t packed_size);
Index: parrot/io/io_win32.c
===================================================================
RCS file: /cvs/public/parrot/io/io_win32.c,v
retrieving revision 1.14
diff -u -r1.14 io_win32.c
--- parrot/io/io_win32.c        9 Mar 2002 01:59:18 -0000       1.14
+++ parrot/io/io_win32.c        28 Mar 2002 06:31:02 -0000
@@ -190,7 +190,6 @@
 INTVAL
 PIO_win32_isatty(PIOHANDLE fd)
 {
-    HANDLE h;
     DWORD ftype = GetFileType(fd);
     if (ftype == FILE_TYPE_CHAR)
         return 1;

Reply via email to