From: Kaveh R. Ghazi Date: Wed, 23 Dec 1998 07:09:01 +0000 (+0000) Subject: Warning fixes: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=973838fdb39b9e8b41431189af47dcb422b7878b;p=gcc.git Warning fixes: * alias.c (record_alias_subset): Remove ignored `&'. (init_alias_once): Likewise. * c-lex.c (UNGETC): Cast first argument of comma expression to void. * config/mips/mips.c (mips_asm_file_end): Cast the result of fwrite to `int' when comparing against one. * config/mips/mips.h (CAN_ELIMINATE): Add parens around && within ||. (INITIAL_ELIMINATION_OFFSET): Add braces to avoid ambiguous `else'. * cse.c (rehash_using_reg): Change type of variable `i' to unsigned int. * dwarf2out.c (initial_return_save): Cast -1 to unsigned before assigning it to one. * except.c (duplicate_eh_handlers): Remove unused variable `tmp'. * final.c (final_scan_insn): Likewise for variable `i'. (output_asm_insn): Cast a char to unsigned char when used as an array index. * gcse.c (compute_pre_ppinout): Cast -1 to SBITMAP_ELT_TYPE when assigning it to one. * loop.c (strength_reduce): Remove unused variables `count' and `temp'. * recog.c (preprocess_constraints): Cast a char to unsigned char when used as an array index. * regmove.c (find_matches): Likewise. * reload1.c (calculate_needs): Add default case in switch. (eliminate_regs_in_insn): Initialize variable `offset'. (set_offsets_for_label): Change type of variable `i' to unsigned. (reload_as_needed): Wrap variable `i' in macro check on AUTO_INC_DEC || INSN_CLOBBERS_REGNO_P. * scan-decls.c (scan_decls): Mark parameters `argc' and `argv' with ATTRIBUTE_UNUSED. Cast variable `start_written' to size_t when comparing against one. * stor-layout.c (layout_decl): Cast maximum_field_alignment to unsigned when comparing against one. Likewise for GET_MODE_ALIGNMENT(). (layout_record): Cast record_align to int when comparing against a signed value. (layout_type): Cast TYPE_ALIGN() to int when comparing against a signed value. * tree.c (get_identifier): Cast variable `len' to unsigned when comparing against one. (maybe_get_identifier): Likewise From-SVN: r24403 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0384fbc25a2..5d14e878cfd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,60 @@ +Wed Dec 23 09:51:32 1998 Kaveh R. Ghazi + + * alias.c (record_alias_subset): Remove ignored `&'. + (init_alias_once): Likewise. + + * c-lex.c (UNGETC): Cast first argument of comma expression to void. + + * config/mips/mips.c (mips_asm_file_end): Cast the result of + fwrite to `int' when comparing against one. + + * config/mips/mips.h (CAN_ELIMINATE): Add parens around && within ||. + (INITIAL_ELIMINATION_OFFSET): Add braces to avoid ambiguous `else'. + + * cse.c (rehash_using_reg): Change type of variable `i' to + unsigned int. + + * dwarf2out.c (initial_return_save): Cast -1 to unsigned before + assigning it to one. + + * except.c (duplicate_eh_handlers): Remove unused variable `tmp'. + + * final.c (final_scan_insn): Likewise for variable `i'. + (output_asm_insn): Cast a char to unsigned char when used as an + array index. + + * gcse.c (compute_pre_ppinout): Cast -1 to SBITMAP_ELT_TYPE when + assigning it to one. + + * loop.c (strength_reduce): Remove unused variables `count' and `temp'. + + * recog.c (preprocess_constraints): Cast a char to unsigned char + when used as an array index. + + * regmove.c (find_matches): Likewise. + + * reload1.c (calculate_needs): Add default case in switch. + (eliminate_regs_in_insn): Initialize variable `offset'. + (set_offsets_for_label): Change type of variable `i' to unsigned. + (reload_as_needed): Wrap variable `i' in macro check on + AUTO_INC_DEC || INSN_CLOBBERS_REGNO_P. + + * scan-decls.c (scan_decls): Mark parameters `argc' and `argv' + with ATTRIBUTE_UNUSED. Cast variable `start_written' to size_t + when comparing against one. + + * stor-layout.c (layout_decl): Cast maximum_field_alignment to + unsigned when comparing against one. Likewise for + GET_MODE_ALIGNMENT(). + (layout_record): Cast record_align to int when comparing against a + signed value. + (layout_type): Cast TYPE_ALIGN() to int when comparing against a + signed value. + + * tree.c (get_identifier): Cast variable `len' to unsigned when + comparing against one. + (maybe_get_identifier): Likewise + Wed Dec 23 00:10:01 1998 Jeffrey A Law (law@cygnus.com) * toplev.c (rest_of_compilation): Do not set reload_completed. diff --git a/gcc/alias.c b/gcc/alias.c index ce5a4994365..1adc8b31071 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -302,7 +302,7 @@ record_alias_subset (superset, subset) (alias_set_entry) xmalloc (sizeof (struct alias_set_entry)); superset_entry->alias_set = superset; superset_entry->children - = splay_tree_new (&alias_set_compare, 0, 0); + = splay_tree_new (alias_set_compare, 0, 0); splay_tree_insert (alias_sets, (splay_tree_key) superset, (splay_tree_value) superset_entry); @@ -314,7 +314,7 @@ record_alias_subset (superset, subset) /* There is an entry for the subset. Enter all of its children (if they are not already present) as children of the SUPERSET. */ splay_tree_foreach (subset_entry->children, - &insert_subset_children, + insert_subset_children, superset_entry->children); /* Enter the SUBSET itself as a child of the SUPERSET. */ @@ -1295,7 +1295,7 @@ init_alias_once () && HARD_REGNO_MODE_OK (i, Pmode)) SET_HARD_REG_BIT (argument_registers, i); - alias_sets = splay_tree_new (&alias_set_compare, 0, 0); + alias_sets = splay_tree_new (alias_set_compare, 0, 0); } void diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 54c834f92b6..1b44817dbc7 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -63,7 +63,7 @@ extern unsigned char *yy_cur, *yy_lim; extern int yy_get_token (); #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ()) -#define UNGETC(c) ((c), yy_cur--) +#define UNGETC(c) ((void)(c), yy_cur--) #else #define GETC() getc (finput) #define UNGETC(c) ungetc (c, finput) diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index cf6ec559672..d713550f68b 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -5326,7 +5326,7 @@ mips_asm_file_end (file) fatal_io_error (temp_filename); while ((len = fread (buffer, 1, sizeof (buffer), asm_out_text_file)) > 0) - if (fwrite (buffer, 1, len, file) != len) + if ((int) fwrite (buffer, 1, len, file) != len) pfatal_with_name (asm_file_name); if (len < 0) diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index edf6399f3bd..c0e543846a2 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2180,7 +2180,7 @@ extern struct mips_frame_info current_frame_info; #define CAN_ELIMINATE(FROM, TO) \ (((FROM) == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p () \ - || TO == GP_REG_FIRST + 31 && leaf_function_p)) \ + || (TO == GP_REG_FIRST + 31 && leaf_function_p))) \ || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM \ && ((TO) == HARD_FRAME_POINTER_REGNUM \ || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed \ @@ -2219,11 +2219,13 @@ extern struct mips_frame_info current_frame_info; /* Some ABIs store 64 bits to the stack, but Pmode is 32 bits, \ so we must add 4 bytes to the offset to get the right value. */ \ else if ((FROM) == RETURN_ADDRESS_POINTER_REGNUM) \ + { \ if (leaf_function_p ()) \ (OFFSET) = 0; \ else (OFFSET) = current_frame_info.gp_sp_offset \ + ((UNITS_PER_WORD - (POINTER_SIZE / BITS_PER_UNIT)) \ * (BYTES_BIG_ENDIAN != 0)); \ + } \ } /* If we generate an insn to push BYTES bytes, diff --git a/gcc/cse.c b/gcc/cse.c index 5e7763188e5..2ef26a5e934 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -1772,7 +1772,7 @@ static void rehash_using_reg (x) rtx x; { - int i; + unsigned int i; struct table_elt *p, *next; unsigned hash; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 3c59c3f14a9..98f5ac935e6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1040,7 +1040,7 @@ static void initial_return_save (rtl) register rtx rtl; { - unsigned reg = -1; + unsigned int reg = (unsigned int) -1; long offset = 0; switch (GET_CODE (rtl)) diff --git a/gcc/except.c b/gcc/except.c index 2488d58772b..60e0d3caadf 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -982,7 +982,6 @@ duplicate_eh_handlers (old_note_eh_region, new_note_eh_region, map) { struct handler_info *ptr, *new_ptr; int new_region, region; - rtx tmp; region = find_func_region (old_note_eh_region); if (region == -1) diff --git a/gcc/final.c b/gcc/final.c index 066b621e9a8..461f605f0b6 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -2035,7 +2035,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) int prescan; int nopeepholes; { - register int i; #ifdef HAVE_cc0 rtx set; #endif @@ -3486,7 +3485,7 @@ output_asm_insn (template, operands) punctuation character alone, with no operand. The PRINT_OPERAND macro decides what is actually done. */ #ifdef PRINT_OPERAND_PUNCT_VALID_P - else if (PRINT_OPERAND_PUNCT_VALID_P (*p)) + else if (PRINT_OPERAND_PUNCT_VALID_P ((unsigned char)*p)) output_operand (NULL_RTX, *p++); #endif else diff --git a/gcc/gcse.c b/gcc/gcse.c index 06393dbb1a1..7209d2b9a77 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -4258,7 +4258,7 @@ compute_pre_ppinout () { int_list_ptr pred; SBITMAP_ELT_TYPE tmp = *antin & *pavin & (*antloc | (*transp & *ppout)); - SBITMAP_ELT_TYPE pred_val = -1L; + SBITMAP_ELT_TYPE pred_val = (SBITMAP_ELT_TYPE) -1; for (pred = s_preds[bb]; pred != NULL; pred = pred->next) { diff --git a/gcc/loop.c b/gcc/loop.c index dcae8d0c6f4..082fc817060 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -3927,10 +3927,8 @@ strength_reduce (scan_start, end, loop_top, insn_count, &add_val, &mult_val, &last_consec_insn)))) { - int count; struct induction *v = (struct induction *) alloca (sizeof (struct induction)); - rtx temp; /* If this is a library call, increase benefit. */ if (find_reg_note (p, REG_RETVAL, NULL_RTX)) diff --git a/gcc/recog.c b/gcc/recog.c index 19bc3b2bcf8..fa8c069b46e 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1908,7 +1908,7 @@ preprocess_constraints () break; default: - op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER (c)]; + op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER ((unsigned char)c)]; break; } } diff --git a/gcc/regmove.c b/gcc/regmove.c index 937241a5db2..69197a3387e 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -1471,7 +1471,7 @@ find_matches (insn, matchp) case 'j': case 'k': case 'l': case 'p': case 'q': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'W': case 'Y': case 'Z': - if (CLASS_LIKELY_SPILLED_P (REG_CLASS_FROM_LETTER (c))) + if (CLASS_LIKELY_SPILLED_P (REG_CLASS_FROM_LETTER ((unsigned char)c))) likely_spilled[op_no] = 1; break; } diff --git a/gcc/reload1.c b/gcc/reload1.c index b4cb69cc19d..39da06d6135 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1532,6 +1532,8 @@ calculate_needs (chain) case RELOAD_FOR_OPADDR_ADDR: this_needs = &insn_needs.op_addr_reload; break; + default: + abort(); } if (size > 1) @@ -3249,7 +3251,7 @@ eliminate_regs_in_insn (insn, replace) && ep->to == HARD_FRAME_POINTER_REGNUM) { rtx src = SET_SRC (old_set); - int offset, ok = 0; + int offset = 0, ok = 0; rtx prev_insn, prev_set; if (src == ep->to_rtx) @@ -3577,7 +3579,7 @@ static void set_offsets_for_label (insn) rtx insn; { - int i; + unsigned int i; int label_nr = CODE_LABEL_NUMBER (insn); struct elim_table *ep; @@ -4153,7 +4155,9 @@ reload_as_needed (live_known) int live_known; { struct insn_chain *chain; +#if defined (AUTO_INC_DEC) || defined (INSN_CLOBBERS_REGNO_P) register int i; +#endif rtx x; bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx); diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c index 5b947a412e3..2c6f12ae7b4 100644 --- a/gcc/scan-decls.c +++ b/gcc/scan-decls.c @@ -77,8 +77,8 @@ Here dname is the actual name being declared. int scan_decls (pfile, argc, argv) cpp_reader *pfile; - int argc; - char **argv; + int argc ATTRIBUTE_UNUSED; + char **argv ATTRIBUTE_UNUSED; { int saw_extern, saw_inline; int start_written; @@ -169,7 +169,7 @@ scan_decls (pfile, argc, argv) } break; case CPP_OTHER: - if (CPP_WRITTEN (pfile) == start_written + 1 + if (CPP_WRITTEN (pfile) == (size_t) start_written + 1 && (CPP_PWRITTEN (pfile)[-1] == '*' || CPP_PWRITTEN (pfile)[-1] == '&')) declarator_start = start_written; diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index a9474476de8..1379811cea7 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -283,7 +283,8 @@ layout_decl (decl, known_align) { DECL_BIT_FIELD_TYPE (decl) = DECL_BIT_FIELD (decl) ? type : 0; if (maximum_field_alignment != 0) - DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment); + DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), + (unsigned)maximum_field_alignment); else if (DECL_PACKED (decl)) DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); } @@ -299,7 +300,7 @@ layout_decl (decl, known_align) if (xmode != BLKmode && known_align % GET_MODE_ALIGNMENT (xmode) == 0) { - DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode), + DECL_ALIGN (decl) = MAX ((unsigned) GET_MODE_ALIGNMENT (xmode), DECL_ALIGN (decl)); DECL_MODE (decl) = xmode; DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode)); @@ -413,7 +414,7 @@ layout_record (rec) It does, however, affect the alignment of the next field within the structure. */ if (! integer_zerop (DECL_SIZE (field))) - record_align = MAX (record_align, desired_align); + record_align = MAX ((int)record_align, desired_align); else if (! DECL_PACKED (field)) desired_align = TYPE_ALIGN (TREE_TYPE (field)); /* A named bit field of declared type `int' @@ -426,11 +427,11 @@ layout_record (rec) else if (DECL_PACKED (field)) type_align = MIN (type_align, BITS_PER_UNIT); - record_align = MAX (record_align, type_align); + record_align = MAX ((int)record_align, type_align); } } else - record_align = MAX (record_align, desired_align); + record_align = MAX ((int)record_align, desired_align); #endif /* Does this field automatically have alignment it needs @@ -913,7 +914,7 @@ layout_type (type) MODE_INT, 1); if (STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT - && TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type)) + && (int)TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type)) && TYPE_MODE (type) != BLKmode) { TYPE_NO_FORCE_BLK (type) = 1; @@ -979,7 +980,7 @@ layout_type (type) then stick with BLKmode. */ if (STRICT_ALIGNMENT && ! (TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT - || (TYPE_ALIGN (type) + || ((int)TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type))))) { if (TYPE_MODE (type) != BLKmode) @@ -1011,7 +1012,7 @@ layout_type (type) then stick with BLKmode. */ && (! STRICT_ALIGNMENT || TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT - || TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type)))) + || (int)TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type)))) { tree field; /* A union which has any BLKmode members must itself be BLKmode; diff --git a/gcc/tree.c b/gcc/tree.c index de3655cb605..6cb386481b1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1266,7 +1266,7 @@ get_identifier (text) /* Decide how much of that length to hash on */ hash_len = len; - if (warn_id_clash && len > id_clash_len) + if (warn_id_clash && (unsigned)len > id_clash_len) hash_len = id_clash_len; /* Compute hash code */ @@ -1285,7 +1285,7 @@ get_identifier (text) return idp; /* <-- return if found */ /* Not found; optionally warn about a similar identifier */ - if (warn_id_clash && do_identifier_warnings && len >= id_clash_len) + if (warn_id_clash && do_identifier_warnings && (unsigned)len >= id_clash_len) for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp)) if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len)) { @@ -1329,7 +1329,7 @@ maybe_get_identifier (text) /* Decide how much of that length to hash on */ hash_len = len; - if (warn_id_clash && len > id_clash_len) + if (warn_id_clash && (unsigned)len > id_clash_len) hash_len = id_clash_len; /* Compute hash code */