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


This patch eliminates 69 warnings of the form

    debug.c:96: warning: subscript has type `char'

from gcc-2.8.1 on Solaris 8.

The isXXXX() functions take 'int' arguments (since they must operate
either on characters or EOF).  On Solaris 8, under the default
compilation conditions for me with gcc, they are implemented as
lookup-tables, with the 'character' used as the index.  Hence normal
type promotion isn't performed and the 'subscript has type char'
warning gets issued.

Eventually, parrot may have to face some of the same issues with the
isXXXX() functions that perl5 did, and it may be appropriate to set up
various isALPHA() etc. macros or functions.  See perl5's handy.h,
particularly the section starting with

    /*
    * Character classes.
    *
    * Unfortunately, the introduction of locales means that we
    * can't trust isupper(), etc. to tell the truth.  And when
    * it comes to /\w+/ with tainting enabled, we *must* be able
    * to trust our character classes.
    *
    * Therefore, the default tests in the text of Perl will be
    * independent of locale.  Any code that wants to depend on
    * the current locale will use the tests that begin with
    "lc".
    */

This is probably not a big issue in debug.c, however, so the following
should suffice for now.

--- parrot-cvs/debug.c  Tue Jul 23 09:36:13 2002
+++ parrot-andy/debug.c Tue Jul 23 10:32:04 2002
@@ -20,9 +20,9 @@
 #include <stdlib.h>
 
 #define na(c) { \
-    while(*c && !isspace(*c)) \
+    while(*c && !isspace((int) *c)) \
         c++; \
-    while(*c && isspace(*c)) \
+    while(*c && isspace((int) *c)) \
         c++; }
 
 /* PDB_get_command
@@ -189,7 +189,7 @@
         PDB_init(interpreter,command);
     }
     
-    if (command && isdigit(*command))
+    if (command && isdigit((int) *command))
         n = atol(command);
 
     pdb->state &= ~PDB_STOPPED;
@@ -219,7 +219,7 @@
         PDB_init(interpreter,command);
     }
    
-    if (command && isdigit(*command))
+    if (command && isdigit((int) *command))
         n = atol(command);
 
     pdb->state &= ~PDB_STOPPED;
@@ -356,7 +356,7 @@
 
     while (command && *command) {
         i = 0;
-        while (command[i] && !isspace(command[i])) {
+        while (command[i] && !isspace((int) command[i])) {
             c[i] = command[i];
             i++;
     }
@@ -414,7 +414,7 @@
     PDB_line_t *line;
     long n;
 
-    if (isdigit(*command)) {
+    if (isdigit((int) *command)) {
         n = atol(command);
         breakpoint = interpreter->pdb->breakpoint;
         while (breakpoint && n--)
@@ -902,7 +902,7 @@
     char h = 0;
 
     while (*c && *c != '#' && *c != '\n') {
-        if (isalnum(*c) || *c == '"')
+        if (isalnum((int) *c) || *c == '"')
             h = 1;
         else if (*c == ':')
             h = 0;
@@ -924,13 +924,13 @@
     PDB_line_t *line;
 
     /* set the list line if provided */
-    if (isdigit(*command)) {
+    if (isdigit((int) *command)) {
         pdb->file->list_line = atol(command) - 1;
         na(command);
     }
 
     /* set the number of lines to print */
-    if (isdigit(*command)) {
+    if (isdigit((int) *command)) {
         n = atol(command);
         na(command);
     }
@@ -978,7 +978,7 @@
     int op_number,i,k,l,j = 0;
 
     /* find_op needs a string with only the opcode name */
-    while (command && !(isspace(*command))) 
+    while (command && !(isspace((int) *command))) 
         *(c++) = *(command++);
     *c = '\0';
     /* Find the opcode number */
@@ -1067,7 +1067,7 @@
     unsigned long c = 0;
 
     /* Print from the user stack? */
-    if (!*command || isdigit(*command))
+    if (!*command || isdigit((int) *command))
         PDB_print_user_stack(interpreter,command);
     else {
         for (i = 0; ((command[i] != 32) && command[i]) ; i++)

-- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042



Reply via email to