Commit 5efaf7b0 by Kaveh R. Ghazi Committed by Kaveh Ghazi

Warning fixes:

	* 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.

From-SVN: r22679
parent 5abb0464
Wed Sep 30 19:24:41 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.
Wed Sep 30 19:03:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Wed Sep 30 19:03:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* grant.c (decode_decl_selective): Cast switch's enum argument to * grant.c (decode_decl_selective): Cast switch's enum argument to
......
...@@ -127,7 +127,9 @@ static int ...@@ -127,7 +127,9 @@ static int
id_cmp (p1, p2) id_cmp (p1, p2)
tree *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 /* Build the FUNCTION_TYPE or METHOD_TYPE which may raise exceptions
......
...@@ -1005,7 +1005,7 @@ extern tree build_chill_writerecord PROTO((tree, tree)); ...@@ -1005,7 +1005,7 @@ extern tree build_chill_writerecord PROTO((tree, tree));
extern tree build_chill_writetext PROTO((tree, tree)); extern tree build_chill_writetext PROTO((tree, tree));
extern void build_enum_tables PROTO((void)); extern void build_enum_tables PROTO((void));
extern tree build_text_mode PROTO((tree, tree, int)); 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_access_location PROTO((tree, tree));
extern void init_text_location PROTO((tree, tree)); extern void init_text_location PROTO((tree, tree));
extern void inout_init PROTO((void)); extern void inout_init PROTO((void));
......
...@@ -589,9 +589,9 @@ display_int_cst (val) ...@@ -589,9 +589,9 @@ display_int_cst (val)
else if (x == '\n') else if (x == '\n')
strcpy (buffer, "'^J'"); strcpy (buffer, "'^J'");
else if (x < ' ' || x > '~') else if (x < ' ' || x > '~')
sprintf (buffer, "'^(%u)'", x); sprintf (buffer, "'^(%u)'", (unsigned int) x);
else else
sprintf (buffer, "'%c'", x); sprintf (buffer, "'%c'", (char) x);
return buffer; return buffer;
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
for (fields = TYPE_VALUES (TREE_TYPE (val)); fields != NULL_TREE; for (fields = TYPE_VALUES (TREE_TYPE (val)); fields != NULL_TREE;
......
...@@ -897,7 +897,9 @@ print_lang_decl (file, node, indent) ...@@ -897,7 +897,9 @@ print_lang_decl (file, node, indent)
int indent; int indent;
{ {
indent_to (file, indent + 3); 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)) if (DECL_WEAK_NAME (node))
fprintf (file, "weak_name "); fprintf (file, "weak_name ");
if (CH_DECL_SIGNAL (node)) if (CH_DECL_SIGNAL (node))
...@@ -1437,12 +1439,22 @@ print_mode (mode) ...@@ -1437,12 +1439,22 @@ print_mode (mode)
{ {
tree itype = TYPE_DOMAIN (mode); tree itype = TYPE_DOMAIN (mode);
if (CH_STRING_TYPE_P (mode)) if (CH_STRING_TYPE_P (mode))
printf (" STRING (%d) OF ", {
fputs (" STRING (", stdout);
printf (HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype))); TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
fputs (") OF ", stdout);
}
else else
printf (" ARRAY (%d:%d) OF ", {
TREE_INT_CST_LOW (TYPE_MIN_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))); TREE_INT_CST_LOW (TYPE_MAX_VALUE (itype)));
fputs (") OF ", stdout);
}
mode = TREE_TYPE (mode); mode = TREE_TYPE (mode);
break; break;
} }
...@@ -3697,16 +3709,16 @@ init_decl_processing () ...@@ -3697,16 +3709,16 @@ init_decl_processing ()
tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE, tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
(((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
* sizeof (char))); * sizeof (char)));
bcopy (chill_tree_code_length, bcopy ((char *) chill_tree_code_length,
tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE, (char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
(((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
* sizeof (int))); * sizeof (int)));
bcopy (chill_tree_code_name, bcopy ((char *) chill_tree_code_name,
tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE, (char *) (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
(((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
* sizeof (char *))); * sizeof (char *)));
boolean_code_name = (char **) xmalloc (sizeof (char *) * (int) LAST_CHILL_TREE_CODE); 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[EQ_EXPR] = "=";
boolean_code_name[NE_EXPR] = "/="; boolean_code_name[NE_EXPR] = "/=";
......
...@@ -270,7 +270,8 @@ grant_array_type (type) ...@@ -270,7 +270,8 @@ grant_array_type (type)
if (TREE_CODE (maxval) == INTEGER_CST) if (TREE_CODE (maxval) == INTEGER_CST)
{ {
char wrk[20]; 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); APPEND (result, wrk);
} }
else if (TREE_CODE (maxval) == MINUS_EXPR else if (TREE_CODE (maxval) == MINUS_EXPR
......
...@@ -1615,8 +1615,8 @@ build_text_mode (textlength, indexmode, dynamic) ...@@ -1615,8 +1615,8 @@ build_text_mode (textlength, indexmode, dynamic)
} }
tree tree
check_text_length (type, length) check_text_length (length)
tree type, length; tree length;
{ {
if (length == NULL_TREE || TREE_CODE (length) == ERROR_MARK) if (length == NULL_TREE || TREE_CODE (length) == ERROR_MARK)
return length; return length;
...@@ -1750,7 +1750,8 @@ build_chill_associate (assoc, fname, attr) ...@@ -1750,7 +1750,8 @@ build_chill_associate (assoc, fname, attr)
tree fname; tree fname;
tree attr; 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; int had_errors = 0;
tree result; tree result;
...@@ -1982,7 +1983,8 @@ build_chill_modify (assoc, list) ...@@ -1982,7 +1983,8 @@ build_chill_modify (assoc, list)
tree assoc; tree assoc;
tree list; 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; int had_errors = 0, numargs;
tree fname = NULL_TREE, attr = NULL_TREE; tree fname = NULL_TREE, attr = NULL_TREE;
tree result; tree result;
...@@ -3898,7 +3900,7 @@ scanformcont (fcs, len, fcsptr, lenptr, exprlist, exprptr, ...@@ -3898,7 +3900,7 @@ scanformcont (fcs, len, fcsptr, lenptr, exprlist, exprptr,
int *nextargnum; int *nextargnum;
{ {
fcsstate_t state = FormatText; fcsstate_t state = FormatText;
char curr; unsigned char curr;
int dig; int dig;
while (len--) while (len--)
......
...@@ -877,7 +877,7 @@ maybe_downcase (str) ...@@ -877,7 +877,7 @@ maybe_downcase (str)
while (*str) while (*str)
{ {
if (ISUPPER ((unsigned char) *str)) if (ISUPPER ((unsigned char) *str))
*str = tolower (*str); *str = tolower ((unsigned char)*str);
str++; str++;
} }
} }
......
...@@ -564,7 +564,7 @@ satisfy (exp, chain) ...@@ -564,7 +564,7 @@ satisfy (exp, chain)
else if (CH_IS_TEXT_MODE (exp) && else if (CH_IS_TEXT_MODE (exp) &&
DECL_NAME (decl) == get_identifier ("__textlength")) DECL_NAME (decl) == get_identifier ("__textlength"))
DECL_INITIAL (decl) DECL_INITIAL (decl)
= check_text_length (exp, DECL_INITIAL (decl)); = check_text_length (DECL_INITIAL (decl));
} }
} }
else if (TREE_CODE (decl) == FIELD_DECL) else if (TREE_CODE (decl) == FIELD_DECL)
......
...@@ -154,8 +154,8 @@ generate_tasking_code_variable (name, tasking_code_ptr, quasi_flag) ...@@ -154,8 +154,8 @@ generate_tasking_code_variable (name, tasking_code_ptr, quasi_flag)
/* check for value should be assigned is out of range */ /* check for value should be assigned is out of range */
if (TREE_INT_CST_LOW (*tasking_code_ptr) > if (TREE_INT_CST_LOW (*tasking_code_ptr) >
TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node))) TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node)))
error ("Tasking code %d out of range for `%s'.", error ("Tasking code %ld out of range for `%s'.",
TREE_INT_CST_LOW (*tasking_code_ptr), (long) TREE_INT_CST_LOW (*tasking_code_ptr),
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
} }
...@@ -201,8 +201,8 @@ decl_tasking_code_variable (name, tasking_code_ptr, quasi_flag) ...@@ -201,8 +201,8 @@ decl_tasking_code_variable (name, tasking_code_ptr, quasi_flag)
/* check for value should be assigned is out of range */ /* check for value should be assigned is out of range */
if (TREE_INT_CST_LOW (*tasking_code_ptr) > if (TREE_INT_CST_LOW (*tasking_code_ptr) >
TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node))) TREE_INT_CST_LOW (TYPE_MAX_VALUE (chill_taskingcode_type_node)))
error ("Tasking code %d out of range for `%s'.", error ("Tasking code %ld out of range for `%s'.",
TREE_INT_CST_LOW (*tasking_code_ptr), (long) TREE_INT_CST_LOW (*tasking_code_ptr),
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment