This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Yet another CHILL directory warning patch ...


	More warning fixes for the CHILL directory.  Okay to install?

		--Kaveh


Wed Sep 30 10:20:01 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* actions.c (id_cmp): Do pointer arithmetic as `long' not `int' to
 	ensure enough bits for calculation.

	* ch-tree.h (check_text_length): Remove unused parameter.

	* convert.c (display_int_cst): Cast a HOST_WIDE_INT argument to
	function sprintf into the appropriate type for printing.

	* decl.c (print_lang_decl): Use HOST_WIDE_INT_PRINT_DEC as the
	format specifier.
	(print_mode): Likewise.
	(init_decl_processing): Cast the arguments of bcopy/bzero to char *.

	* grant.c (grant_array_type): Use HOST_WIDE_INT_PRINT_DEC as
	the format specifier.

	* inout.c (check_text_length): Remove unused parameter `type'.
	(build_chill_associate): Initialize variables `arg1', `arg2',
	`arg3', `arg4' and `arg5'.
	(build_chill_modify): Likewise.
	(scanformcont): Change type of variable `curr' to `unsigned char'.

	* lex.c (maybe_downcase): Cast the argument of `tolower' to
	`unsigned char'.

	* satisfy.c (satisfy): Remove unused parameter in call to
	`check_text_length'.

	* tasking.c (generate_tasking_code_variable): Pass a HOST_WIDE_INT
	as a `long' in call to function `error'.
	(decl_tasking_code_variable): Likewise.
	
diff -rup orig/egcs-CVS19980929/gcc/ch/actions.c egcs-CVS19980929/gcc/ch/actions.c
--- orig/egcs-CVS19980929/gcc/ch/actions.c	Wed Sep 30 10:18:39 1998
+++ egcs-CVS19980929/gcc/ch/actions.c	Wed Sep 30 10:18:24 1998
@@ -127,7 +127,9 @@ static int
 id_cmp (p1, p2)
      tree *p1, *p2;
 {
-  return (int)TREE_VALUE (*p1) - (int)TREE_VALUE (*p2);
+  long diff = (long)TREE_VALUE (*p1) - (long)TREE_VALUE (*p2);
+
+  return (diff < 0) ? -1 : (diff > 0);
 }
 
 /* Build the FUNCTION_TYPE or METHOD_TYPE which may raise exceptions
diff -rup orig/egcs-CVS19980929/gcc/ch/ch-tree.h egcs-CVS19980929/gcc/ch/ch-tree.h
--- orig/egcs-CVS19980929/gcc/ch/ch-tree.h	Tue Sep 29 21:49:40 1998
+++ egcs-CVS19980929/gcc/ch/ch-tree.h	Wed Sep 30 09:57:52 1998
@@ -1005,7 +1005,7 @@ extern tree build_chill_writerecord     
 extern tree build_chill_writetext               PROTO((tree, tree));
 extern void build_enum_tables                   PROTO((void));
 extern tree build_text_mode                     PROTO((tree, tree, int));
-extern tree check_text_length                   PROTO((tree, tree));
+extern tree check_text_length                   PROTO((tree));
 extern void init_access_location                PROTO((tree, tree));
 extern void init_text_location                  PROTO((tree, tree));
 extern void inout_init                          PROTO((void));
diff -rup orig/egcs-CVS19980929/gcc/ch/convert.c egcs-CVS19980929/gcc/ch/convert.c
--- orig/egcs-CVS19980929/gcc/ch/convert.c	Tue Sep 29 21:49:41 1998
+++ egcs-CVS19980929/gcc/ch/convert.c	Wed Sep 30 09:51:23 1998
@@ -589,9 +589,9 @@ display_int_cst (val)
       else if (x == '\n')
 	strcpy (buffer, "'^J'");
       else if (x < ' ' || x > '~')
-	sprintf (buffer, "'^(%u)'", x);
+	sprintf (buffer, "'^(%u)'", (unsigned int) x);
       else
-	sprintf (buffer, "'%c'", x);
+	sprintf (buffer, "'%c'", (char) x);
       return buffer;
     case ENUMERAL_TYPE:
       for (fields = TYPE_VALUES (TREE_TYPE (val)); fields != NULL_TREE;
diff -rup orig/egcs-CVS19980929/gcc/ch/decl.c egcs-CVS19980929/gcc/ch/decl.c
--- orig/egcs-CVS19980929/gcc/ch/decl.c	Tue Sep 29 21:49:41 1998
+++ egcs-CVS19980929/gcc/ch/decl.c	Wed Sep 30 09:50:01 1998
@@ -897,7 +897,9 @@ print_lang_decl (file, node, indent)
      int  indent;
 {
   indent_to (file, indent + 3);
-  fprintf (file, "nesting_level %d ", DECL_NESTING_LEVEL (node));
+  fputs ("nesting_level ", file);
+  fprintf (file, HOST_WIDE_INT_PRINT_DEC, DECL_NESTING_LEVEL (node));
+  fputs (" ", file);
   if (DECL_WEAK_NAME (node))
     fprintf (file, "weak_name ");
   if (CH_DECL_SIGNAL (node))
@@ -1437,12 +1439,22 @@ print_mode (mode)
 	  {
 	    tree itype = TYPE_DOMAIN (mode);
 	    if (CH_STRING_TYPE_P (mode))
-	      printf (" STRING (%d) OF ",
-		      TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
+	      {
+		fputs (" STRING (", stdout);
+		printf (HOST_WIDE_INT_PRINT_DEC,
+			TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
+		fputs (") OF ", stdout);
+	      }
 	    else
-	      printf (" ARRAY (%d:%d) OF ",
-		      TREE_INT_CST_LOW (TYPE_MIN_VALUE (itype)),
-		      TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
+	      {
+		fputs (" ARRAY (", stdout);
+		printf (HOST_WIDE_INT_PRINT_DEC,
+			TREE_INT_CST_LOW (TYPE_MIN_VALUE (itype)));
+		fputs (":", stdout);
+		printf (HOST_WIDE_INT_PRINT_DEC,
+			TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
+		fputs (") OF ", stdout);
+	      }
 	    mode = TREE_TYPE (mode);
 	    break;
 	  }
@@ -3697,16 +3709,16 @@ init_decl_processing ()
          tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
          (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
           * sizeof (char)));
-  bcopy (chill_tree_code_length,
-         tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE,
+  bcopy ((char *) chill_tree_code_length,
+         (char *) tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE,
          (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
           * sizeof (int)));
-  bcopy (chill_tree_code_name,
-         tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
+  bcopy ((char *) chill_tree_code_name,
+         (char *) tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
          (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
           * sizeof (char *)));
   boolean_code_name = (char **) xmalloc (sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
-  bzero (boolean_code_name, sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
+  bzero ((char *) boolean_code_name, sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
 
   boolean_code_name[EQ_EXPR] = "=";
   boolean_code_name[NE_EXPR] = "/=";
diff -rup orig/egcs-CVS19980929/gcc/ch/grant.c egcs-CVS19980929/gcc/ch/grant.c
--- orig/egcs-CVS19980929/gcc/ch/grant.c	Tue Sep 29 21:49:44 1998
+++ egcs-CVS19980929/gcc/ch/grant.c	Wed Sep 30 09:25:21 1998
@@ -270,7 +270,8 @@ grant_array_type (type)
       if (TREE_CODE (maxval) == INTEGER_CST)
 	{
 	  char	wrk[20];
-	  sprintf (wrk, "%d", TREE_INT_CST_LOW (maxval) + 1);
+	  sprintf (wrk, HOST_WIDE_INT_PRINT_DEC,
+		   TREE_INT_CST_LOW (maxval) + 1);
 	  APPEND (result, wrk);
 	}
       else if (TREE_CODE (maxval) == MINUS_EXPR
diff -rup orig/egcs-CVS19980929/gcc/ch/inout.c egcs-CVS19980929/gcc/ch/inout.c
--- orig/egcs-CVS19980929/gcc/ch/inout.c	Tue Sep 29 21:49:45 1998
+++ egcs-CVS19980929/gcc/ch/inout.c	Wed Sep 30 10:06:17 1998
@@ -1615,8 +1615,8 @@ build_text_mode (textlength, indexmode, 
 }
 
 tree
-check_text_length (type, length)
-     tree type, length;
+check_text_length (length)
+     tree length;
 {
   if (length == NULL_TREE || TREE_CODE (length) == ERROR_MARK)
     return length;
@@ -1750,7 +1750,8 @@ build_chill_associate (assoc, fname, att
      tree fname;
      tree attr;
 {
-  tree arg1, arg2, arg3, arg4, arg5, arg6, arg7;
+  tree arg1 = NULL_TREE, arg2 = NULL_TREE, arg3 = NULL_TREE, arg4 = NULL_TREE,
+  arg5 = NULL_TREE, arg6, arg7;
   int had_errors = 0;
   tree result;
 
@@ -1982,7 +1983,8 @@ build_chill_modify (assoc, list)
      tree assoc;
      tree list;
 {
-  tree arg1, arg2, arg3, arg4, arg5, arg6, arg7;
+  tree arg1 = NULL_TREE, arg2 = NULL_TREE, arg3 = NULL_TREE, arg4 = NULL_TREE,
+  arg5 = NULL_TREE, arg6, arg7;
   int had_errors = 0, numargs;
   tree fname = NULL_TREE, attr = NULL_TREE;
   tree result;
@@ -3898,7 +3900,7 @@ scanformcont (fcs, len, fcsptr, lenptr, 
      int *nextargnum;
 {
   fcsstate_t state = FormatText;
-  char curr;
+  unsigned char curr;
   int dig;
 
   while (len--)
diff -rup orig/egcs-CVS19980929/gcc/ch/lex.c egcs-CVS19980929/gcc/ch/lex.c
--- orig/egcs-CVS19980929/gcc/ch/lex.c	Tue Sep 29 21:49:45 1998
+++ egcs-CVS19980929/gcc/ch/lex.c	Wed Sep 30 09:30:48 1998
@@ -877,7 +877,7 @@ maybe_downcase (str)
   while (*str)
     {
       if (ISUPPER ((unsigned char) *str))
-	*str = tolower (*str);
+	*str = tolower ((unsigned char)*str);
       str++;
     }
 }
diff -rup orig/egcs-CVS19980929/gcc/ch/satisfy.c egcs-CVS19980929/gcc/ch/satisfy.c
--- orig/egcs-CVS19980929/gcc/ch/satisfy.c	Tue Sep 29 21:49:47 1998
+++ egcs-CVS19980929/gcc/ch/satisfy.c	Wed Sep 30 09:58:06 1998
@@ -564,7 +564,7 @@ satisfy (exp, chain)
 			else if (CH_IS_TEXT_MODE (exp) &&
 				 DECL_NAME (decl) == get_identifier ("__textlength"))
 			  DECL_INITIAL (decl)
-			    = check_text_length (exp, DECL_INITIAL (decl));
+			    = check_text_length (DECL_INITIAL (decl));
 		      }
 		  }
 		else if (TREE_CODE (decl) == FIELD_DECL)
diff -rup orig/egcs-CVS19980929/gcc/ch/tasking.c egcs-CVS19980929/gcc/ch/tasking.c
--- orig/egcs-CVS19980929/gcc/ch/tasking.c	Wed Sep 30 10:18:39 1998
+++ egcs-CVS19980929/gcc/ch/tasking.c	Wed Sep 30 09:54:54 1998
@@ -154,8 +154,8 @@ generate_tasking_code_variable (name, ta
       /* check for value should be assigned is out of range */
       if (TREE_INT_CST_LOW (*tasking_code_ptr) >
 	  TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node)))
-	  error ("Tasking code %d out of range for `%s'.",
-		 TREE_INT_CST_LOW (*tasking_code_ptr),
+	  error ("Tasking code %ld out of range for `%s'.",
+		 (long) TREE_INT_CST_LOW (*tasking_code_ptr),
 		 IDENTIFIER_POINTER (name));
     }
 
@@ -201,8 +201,8 @@ decl_tasking_code_variable (name, taskin
       /* check for value should be assigned is out of range */
       if (TREE_INT_CST_LOW (*tasking_code_ptr) >
 	  TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node)))
-	  error ("Tasking code %d out of range for `%s'.",
-		 TREE_INT_CST_LOW (*tasking_code_ptr),
+	  error ("Tasking code %ld out of range for `%s'.",
+		 (long) TREE_INT_CST_LOW (*tasking_code_ptr),
 		 IDENTIFIER_POINTER (name));
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]