From 5efaf7b00ee3751680bffd751fa86eed6007c46a Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Wed, 30 Sep 1998 16:34:45 +0000 Subject: [PATCH] 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 --- gcc/ch/ChangeLog | 34 ++++++++++++++++++++++++++++++++++ gcc/ch/actions.c | 4 +++- gcc/ch/ch-tree.h | 2 +- gcc/ch/convert.c | 4 ++-- gcc/ch/decl.c | 34 +++++++++++++++++++++++----------- gcc/ch/grant.c | 3 ++- gcc/ch/inout.c | 12 +++++++----- gcc/ch/lex.c | 2 +- gcc/ch/satisfy.c | 2 +- gcc/ch/tasking.c | 8 ++++---- 10 files changed, 78 insertions(+), 27 deletions(-) diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index 738bd3c6ad0..5eb5e1961ce 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,37 @@ +Wed Sep 30 19:24:41 1998 Kaveh R. Ghazi + + * 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 * grant.c (decode_decl_selective): Cast switch's enum argument to diff --git a/gcc/ch/actions.c b/gcc/ch/actions.c index 11722197f8e..cd1c46ba2d3 100644 --- a/gcc/ch/actions.c +++ b/gcc/ch/actions.c @@ -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 --git a/gcc/ch/ch-tree.h b/gcc/ch/ch-tree.h index ae43dd924ac..c555677cee6 100644 --- a/gcc/ch/ch-tree.h +++ b/gcc/ch/ch-tree.h @@ -1005,7 +1005,7 @@ extern tree build_chill_writerecord PROTO((tree, tree)); 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 --git a/gcc/ch/convert.c b/gcc/ch/convert.c index 48becd0f360..93d14374be5 100644 --- a/gcc/ch/convert.c +++ b/gcc/ch/convert.c @@ -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 --git a/gcc/ch/decl.c b/gcc/ch/decl.c index da0822264a0..9c4735962f8 100644 --- a/gcc/ch/decl.c +++ b/gcc/ch/decl.c @@ -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 --git a/gcc/ch/grant.c b/gcc/ch/grant.c index 81162f0eed4..ada788c57e7 100644 --- a/gcc/ch/grant.c +++ b/gcc/ch/grant.c @@ -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 --git a/gcc/ch/inout.c b/gcc/ch/inout.c index 2c5f6281a87..c9af8160bd6 100644 --- a/gcc/ch/inout.c +++ b/gcc/ch/inout.c @@ -1615,8 +1615,8 @@ build_text_mode (textlength, indexmode, dynamic) } 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, attr) 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, exprlist, exprptr, int *nextargnum; { fcsstate_t state = FormatText; - char curr; + unsigned char curr; int dig; while (len--) diff --git a/gcc/ch/lex.c b/gcc/ch/lex.c index bb841d1e4f2..bc50f64a0af 100644 --- a/gcc/ch/lex.c +++ b/gcc/ch/lex.c @@ -877,7 +877,7 @@ maybe_downcase (str) while (*str) { if (ISUPPER ((unsigned char) *str)) - *str = tolower (*str); + *str = tolower ((unsigned char)*str); str++; } } diff --git a/gcc/ch/satisfy.c b/gcc/ch/satisfy.c index 04faa941f45..2b8607875b4 100644 --- a/gcc/ch/satisfy.c +++ b/gcc/ch/satisfy.c @@ -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 --git a/gcc/ch/tasking.c b/gcc/ch/tasking.c index 5ae992f400c..c0c1c9ccbd4 100644 --- a/gcc/ch/tasking.c +++ b/gcc/ch/tasking.c @@ -154,8 +154,8 @@ generate_tasking_code_variable (name, tasking_code_ptr, quasi_flag) /* 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, tasking_code_ptr, quasi_flag) /* 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)); } -- 2.30.2