From: Ian Lance Taylor Date: Sun, 11 Jul 1999 20:20:04 +0000 (+0000) Subject: * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab9da554193906c4406d4d5eadfc24ea8f521558;p=binutils-gdb.git * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED as appropriate. Fill in structure initializations. Add variable initializations. Add casts. * dwarf2dbg.c (print_stats): Change i to size_t. * listing.c (listing_listing): Change list_line to unsigned int. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 2abd2ee6bac..4d857d2783f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +1999-07-11 Ian Lance Taylor + + * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED + as appropriate. Fill in structure initializations. Add variable + initializations. Add casts. + * dwarf2dbg.c (print_stats): Change i to size_t. + * listing.c (listing_listing): Change list_line to unsigned int. + 1999-07-10 Ian Lance Taylor * config/tc-ppc.h (tc_fix_adjustable) [OBJ_ELF]: Call S_IS_LOCAL diff --git a/gas/app.c b/gas/app.c index c51c0f02726..0494aec23b6 100644 --- a/gas/app.c +++ b/gas/app.c @@ -267,7 +267,7 @@ app_pop (arg) saved_input = NULL; else { - assert (saved->saved_input_len <= sizeof input_buffer); + assert (saved->saved_input_len <= (int) (sizeof input_buffer)); memcpy (input_buffer, saved->saved_input, saved->saved_input_len); saved_input = input_buffer; saved_input_len = saved->saved_input_len; diff --git a/gas/cond.c b/gas/cond.c index 434fc66d724..943c9f6bf82 100644 --- a/gas/cond.c +++ b/gas/cond.c @@ -248,7 +248,7 @@ s_ifc (arg) void s_endif (arg) - int arg; + int arg ATTRIBUTE_UNUSED; { struct conditional_frame *hold; @@ -280,7 +280,7 @@ s_endif (arg) void s_else (arg) - int arg; + int arg ATTRIBUTE_UNUSED; { if (current_cframe == NULL) { diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index d5b8168d7eb..6feb5c5ba15 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -112,7 +112,7 @@ static const pseudo_typeS elf_pseudo_table[] = {"text", obj_elf_text, 0}, /* End sentinel. */ - {NULL}, + {NULL, NULL, 0}, }; static const pseudo_typeS ecoff_debug_pseudo_table[] = @@ -157,7 +157,7 @@ static const pseudo_typeS ecoff_debug_pseudo_table[] = { "vreg", s_ignore, 0 }, #endif - {NULL} /* end sentinel */ + {NULL, NULL, 0} /* end sentinel */ }; #undef NO_RELOC @@ -301,7 +301,7 @@ obj_elf_common (is_common) } if (S_GET_VALUE (symbolP) != 0) { - if (S_GET_VALUE (symbolP) != size) + if (S_GET_VALUE (symbolP) != (valueT) size) { as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."), S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size); @@ -418,7 +418,7 @@ obj_elf_common (is_common) static void obj_elf_local (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; int c; @@ -447,7 +447,7 @@ obj_elf_local (ignore) static void obj_elf_weak (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; int c; @@ -902,7 +902,7 @@ obj_elf_text (i) static void obj_elf_subsection (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register int temp; @@ -934,7 +934,7 @@ obj_elf_section_change_hook () void obj_elf_previous (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { segT new_section; int new_subsection; @@ -962,7 +962,7 @@ obj_elf_previous (ignore) static void obj_elf_popsection (xxx) - int xxx; + int xxx ATTRIBUTE_UNUSED; { struct section_stack *top = section_stack; @@ -989,7 +989,7 @@ obj_elf_popsection (xxx) static void obj_elf_line (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { /* Assume delimiter is part of expression. BSD4.2 as fails with delightful bug, so we are not being incompatible here. */ @@ -1005,7 +1005,7 @@ obj_elf_line (ignore) static void obj_elf_symver (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; char c; @@ -1065,6 +1065,7 @@ obj_elf_symver (ignore) static void obj_elf_vtable_inherit (ignore) + int ignore ATTRIBUTE_UNUSED; { char *cname, *pname; symbolS *csym, *psym; @@ -1136,6 +1137,7 @@ obj_elf_vtable_inherit (ignore) static void obj_elf_vtable_entry (ignore) + int ignore ATTRIBUTE_UNUSED; { char *name; symbolS *sym; @@ -1197,7 +1199,7 @@ obj_symbol_new_hook (symbolP) void obj_elf_version (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; unsigned int c; @@ -1264,7 +1266,7 @@ obj_elf_version (ignore) static void obj_elf_size (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name = input_line_pointer; char c = get_symbol_end (); @@ -1320,7 +1322,7 @@ obj_elf_size (ignore) static void obj_elf_type (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; char c; @@ -1365,7 +1367,7 @@ obj_elf_type (ignore) static void obj_elf_ident (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { static segT comment_section; segT old_section = now_seg; @@ -1425,7 +1427,7 @@ static void adjust_stab_sections (abfd, sec, xxx) bfd *abfd; asection *sec; - PTR xxx; + PTR xxx ATTRIBUTE_UNUSED; { char *name; asection *strsec; diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index bcfc5fdeff8..7070995f2e0 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1257,11 +1257,12 @@ md_assemble (line) && (strncmp (mnemonic, "fsub", 4) !=0) && (strncmp (mnemonic, "fdiv", 4) !=0)) { - const reg_entry *temp_reg; - expressionS *temp_disp; - expressionS *temp_imm; + const reg_entry *temp_reg = NULL; + expressionS *temp_disp = NULL; + expressionS *temp_imm = NULL; unsigned int temp_type; - int xchg1, xchg2; + int xchg1 = 0; + int xchg2 = 0; if (i.operands == 2) { @@ -2551,7 +2552,8 @@ i386_immediate (imm_start) if (cp != NULL) { char *tmpbuf; - int len, first; + int len = 0; + int first; /* GOT relocations are not supported in 16 bit mode */ if (flag_16bit_code) @@ -2780,7 +2782,8 @@ i386_displacement (disp_start, disp_end) if (cp != NULL) { char *tmpbuf; - int len, first; + int len = 0; + int first; /* GOT relocations are not supported in 16 bit mode */ if (flag_16bit_code) @@ -3460,8 +3463,8 @@ i386_operand (operand_string) int found_base_index_form; /* Start and end of displacement string expression (if found). */ - char *displacement_string_start; - char *displacement_string_end; + char *displacement_string_start = NULL; + char *displacement_string_end = NULL; do_memory_reference: @@ -3772,8 +3775,8 @@ md_convert_frag (headers, sec, fragP) #else void md_convert_frag (abfd, sec, fragP) - bfd *abfd; - segT sec; + bfd *abfd ATTRIBUTE_UNUSED; + segT sec ATTRIBUTE_UNUSED; register fragS *fragP; #endif { @@ -3855,8 +3858,8 @@ void md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) char *ptr; addressT from_addr, to_addr; - fragS *frag; - symbolS *to_symbol; + fragS *frag ATTRIBUTE_UNUSED; + symbolS *to_symbol ATTRIBUTE_UNUSED; { long offset; @@ -4188,7 +4191,7 @@ size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (c, arg) int c; - char *arg; + char *arg ATTRIBUTE_UNUSED; { switch (c) { @@ -4274,7 +4277,7 @@ md_undefined_symbol (name) /* Round up a section size to the appropriate boundary. */ valueT md_section_align (segment, size) - segT segment; + segT segment ATTRIBUTE_UNUSED; valueT size; { #ifdef OBJ_AOUT @@ -4309,7 +4312,7 @@ md_pcrel_from (fixP) static void s_bss (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register int temp; @@ -4336,7 +4339,7 @@ i386_validate_fix (fixp) arelent * tc_gen_reloc (section, fixp) - asection *section; + asection *section ATTRIBUTE_UNUSED; fixS *fixp; { arelent *rel; diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 48e964665d2..a1489721e3a 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -142,6 +142,34 @@ ls = { INITIAL_STATE }, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + { NULL, 0, 0, 0, 0 }, + 0, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } }; @@ -340,7 +368,7 @@ get_filenum (filenum, file) int i, last = filenum - 1; char char0 = file[0]; - if ((unsigned) last >= ls.num_filenames) + if (last >= ls.num_filenames) last = ls.last_filename; /* do a quick check against the previously used filename: */ @@ -386,7 +414,7 @@ dwarf2_gen_line_info (addr, l) if (filenum > 0 && !l->filename) { - if (filenum >= ls.num_filenames) + if (filenum >= (unsigned int) ls.num_filenames) { as_warn ("Encountered bad file number in line number debug info!"); return; @@ -563,7 +591,8 @@ print_stats (total_size) "set_column", "negate_stmt", "set_basic_block", "const_add_pc", "fixed_advance_pc" }; - int i, j; + size_t i; + int j; fprintf (stderr, "Average size: %g bytes/line\n", total_size / (double) ls.num_line_entries); @@ -658,7 +687,7 @@ dwarf2_finish () void dwarf2_directive_file (dummy) - int dummy; + int dummy ATTRIBUTE_UNUSED; { int len; @@ -685,7 +714,7 @@ dwarf2_directive_file (dummy) void dwarf2_directive_loc (dummy) - int dummy; + int dummy ATTRIBUTE_UNUSED; { ls.any_dwarf2_directives = 1; diff --git a/gas/hash.c b/gas/hash.c index 29066339c3a..0f129fb3fa1 100644 --- a/gas/hash.c +++ b/gas/hash.c @@ -374,9 +374,9 @@ hash_traverse (table, pfn) void hash_print_statistics (f, name, table) - FILE *f; - const char *name; - struct hash_control *table; + FILE *f ATTRIBUTE_UNUSED; + const char *name ATTRIBUTE_UNUSED; + struct hash_control *table ATTRIBUTE_UNUSED; { #ifdef HASH_STATISTICS unsigned int i; diff --git a/gas/listing.c b/gas/listing.c index acda916f1d1..1ab0ddef180 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -978,7 +978,7 @@ debugging_pseudo (list, line) static void listing_listing (name) - char *name; + char *name ATTRIBUTE_UNUSED; { list_info_type *list = head; file_info_type *current_hll_file = (file_info_type *) NULL; @@ -1006,7 +1006,7 @@ listing_listing (name) while (list) { - int list_line; + unsigned int list_line; width = listing_rhs_width > paper_width ? paper_width : listing_rhs_width; @@ -1180,7 +1180,7 @@ listing_file (name) void listing_eject (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { if (listing) listing_tail->edict = EDICT_EJECT; @@ -1188,7 +1188,7 @@ listing_eject (ignore) void listing_flags (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { while ((*input_line_pointer++) && (*input_line_pointer != '\n')) input_line_pointer++; @@ -1261,7 +1261,7 @@ listing_psize (width_only) void listing_nopage (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { paper_height = 0; } diff --git a/gas/read.c b/gas/read.c index bd471ff5d7a..886c028fdb3 100644 --- a/gas/read.c +++ b/gas/read.c @@ -419,7 +419,7 @@ static const pseudo_typeS potable[] = {"xstabs", s_xstab, 's'}, {"word", cons, 2}, {"zero", s_space, 0}, - {NULL} /* end sentinel */ + {NULL, NULL, 0} /* end sentinel */ }; static int pop_override_ok = 0; @@ -1147,7 +1147,7 @@ mri_comment_end (stop, stopc) void s_abort (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { as_fatal (_(".abort detected. Abandoning ship.")); } @@ -1337,7 +1337,7 @@ s_align_ptwo (arg) void s_comm (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register char *name; register char c; @@ -1419,7 +1419,7 @@ s_comm (ignore) void s_mri_common (small) - int small; + int small ATTRIBUTE_UNUSED; { char *name; char c; @@ -1518,7 +1518,7 @@ s_mri_common (small) void s_data (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { segT section; register int temp; @@ -1592,7 +1592,7 @@ s_app_file (appfile) void s_app_line (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { int l; @@ -1618,7 +1618,7 @@ s_app_line (ignore) void s_end (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { if (flag_mri) { @@ -1636,7 +1636,7 @@ s_end (ignore) void s_err (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { as_bad (_(".err encountered")); demand_empty_rest_of_line (); @@ -1646,7 +1646,7 @@ s_err (ignore) void s_fail (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { offsetT temp; char *stop = NULL; @@ -1669,7 +1669,7 @@ s_fail (ignore) void s_fill (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { expressionS rep_exp; long size = 1; @@ -1766,7 +1766,7 @@ s_fill (ignore) void s_globl (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *name; int c; @@ -1841,7 +1841,7 @@ s_irp (irpc) void s_linkonce (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { enum linkonce_type type; @@ -2119,7 +2119,7 @@ void s_lcomm_bytes (needs_align) void s_lsym (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register char *name; register char c; @@ -2241,7 +2241,7 @@ get_line_sb (line) void s_macro (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *file; unsigned int line; @@ -2293,7 +2293,7 @@ s_macro (ignore) void s_mexit (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { cond_exit_macro (macro_nest); buffer_limit = input_scrub_next_buffer (&input_line_pointer); @@ -2303,7 +2303,7 @@ s_mexit (ignore) void s_mri (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { int on, old_flag; @@ -2371,7 +2371,7 @@ do_org (segment, exp, fill) void s_org (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register segT segment; expressionS exp; @@ -2427,7 +2427,7 @@ s_org (ignore) void s_mri_sect (type) - char *type; + char *type ATTRIBUTE_UNUSED; { #ifdef TC_M68K @@ -2591,7 +2591,7 @@ s_mri_sect (type) void s_print (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *s; int len; @@ -2605,7 +2605,7 @@ s_print (ignore) void s_purgem (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { if (is_it_end_of_statement ()) { @@ -2635,7 +2635,7 @@ s_purgem (ignore) void s_rept (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { int count; sb one; @@ -3007,7 +3007,7 @@ s_float_space (float_type) void s_struct (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { char *stop = NULL; char stopc; @@ -3023,7 +3023,7 @@ s_struct (ignore) void s_text (ignore) - int ignore; + int ignore ATTRIBUTE_UNUSED; { register int temp; @@ -4832,7 +4832,7 @@ equals (sym_name, reassign) /* ARGSUSED */ void s_include (arg) - int arg; + int arg ATTRIBUTE_UNUSED; { char *newbuf; char *filename; @@ -5054,7 +5054,7 @@ do_s_func (end_p, default_prefix) void s_ignore (arg) - int arg; + int arg ATTRIBUTE_UNUSED; { while (!is_end_of_line[(unsigned char) *input_line_pointer]) { diff --git a/gas/stabs.c b/gas/stabs.c index 11d4655f36f..c8d9a0bc5ce 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -609,7 +609,7 @@ stabs_generate_asm_func (funcname, startlabname) void stabs_generate_asm_endfunc (funcname, startlabname) - const char *funcname; + const char *funcname ATTRIBUTE_UNUSED; const char *startlabname; { static int label_count; diff --git a/gas/symbols.c b/gas/symbols.c index dae202f7922..49cf3d959ae 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -771,7 +771,7 @@ symbol_insert (addme, target, rootPP, lastPP) symbolS *addme; symbolS *target; symbolS **rootPP; - symbolS **lastPP; + symbolS **lastPP ATTRIBUTE_UNUSED; { if (LOCAL_SYMBOL_CHECK (addme)) abort (); @@ -1190,7 +1190,7 @@ static void resolve_local_symbol PARAMS ((const char *, PTR)); static void resolve_local_symbol (key, value) - const char *key; + const char *key ATTRIBUTE_UNUSED; PTR value; { if (value != NULL) diff --git a/gas/write.c b/gas/write.c index d0a9ac67a88..ed747097307 100644 --- a/gas/write.c +++ b/gas/write.c @@ -382,7 +382,7 @@ record_alignment (seg, align) static void renumber_sections (abfd, sec, countparg) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; asection *sec; PTR countparg; { @@ -433,9 +433,9 @@ chain_frchains_together_1 (section, frchp) static void chain_frchains_together (abfd, section, xxx) - bfd *abfd; /* unused */ + bfd *abfd ATTRIBUTE_UNUSED; segT section; - PTR xxx; /* unused */ + PTR xxx ATTRIBUTE_UNUSED; { segment_info_type *info; @@ -578,7 +578,7 @@ static void relax_and_size_seg (abfd, sec, xxx) bfd *abfd; asection *sec; - PTR xxx; + PTR xxx ATTRIBUTE_UNUSED; { flagword flags; fragS *fragp; @@ -688,9 +688,9 @@ dump_section_relocs (abfd, sec, stream_) static void adjust_reloc_syms (abfd, sec, xxx) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; asection *sec; - PTR xxx; + PTR xxx ATTRIBUTE_UNUSED; { segment_info_type *seginfo = seg_info (sec); fixS *fixp; @@ -889,7 +889,7 @@ static void write_relocs (abfd, sec, xxx) bfd *abfd; asection *sec; - PTR xxx; + PTR xxx ATTRIBUTE_UNUSED; { segment_info_type *seginfo = seg_info (sec); int i; @@ -1088,9 +1088,9 @@ write_relocs (abfd, sec, xxx) static void write_contents (abfd, sec, xxx) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; asection *sec; - PTR xxx; + PTR xxx ATTRIBUTE_UNUSED; { segment_info_type *seginfo = seg_info (sec); unsigned long offset = 0; @@ -2769,7 +2769,8 @@ fixup_segment (fixP, this_segment_type) } /* not a bit fix */ #ifdef TC_VALIDATE_FIX - skip: ; + skip: ATTRIBUTE_UNUSED_LABEL + ; #endif #ifdef DEBUG5 fprintf (stderr, "result:\n");