diff options
Diffstat (limited to 'gas/config')
91 files changed, 2287 insertions, 2241 deletions
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c index b03919e..a1c3ca2 100644 --- a/gas/config/atof-ieee.c +++ b/gas/config/atof-ieee.c @@ -147,12 +147,12 @@ make_invalid_floating_point_number (LITTLENUM_TYPE *words) { as_bad (_("cannot create floating-point number")); /* Zero the leftmost bit. */ - words[0] = (LITTLENUM_TYPE) ((unsigned) -1) >> 1; - words[1] = (LITTLENUM_TYPE) -1; - words[2] = (LITTLENUM_TYPE) -1; - words[3] = (LITTLENUM_TYPE) -1; - words[4] = (LITTLENUM_TYPE) -1; - words[5] = (LITTLENUM_TYPE) -1; + words[0] = (LITTLENUM_TYPE) -1 >> 1; + words[1] = -1; + words[2] = -1; + words[3] = -1; + words[4] = -1; + words[5] = -1; } /* Build a floating point constant at str into a IEEE floating @@ -283,7 +283,7 @@ atof_ieee (char *str, /* Text to convert to binary. */ default: make_invalid_floating_point_number (words); - return (NULL); + return NULL; } return atof_ieee_detail (str, precision, exponent_bits, words, NULL); @@ -553,7 +553,7 @@ gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits) tmp_bits = prec_bits; while (tmp_bits > LITTLENUM_NUMBER_OF_BITS) { - if (lp[n] != (LITTLENUM_TYPE) - 1) + if (lp[n] != (LITTLENUM_TYPE) -1) break; --n; tmp_bits -= LITTLENUM_NUMBER_OF_BITS; @@ -835,17 +835,17 @@ ieee_md_atof (int type, if (big_wordian) { - for (wordP = words; prec --;) + for (wordP = words; prec--;) { - md_number_to_chars (litP, (valueT) (* wordP ++), sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, *wordP++, sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } else { - for (wordP = words + prec; prec --;) + for (wordP = words + prec; prec--;) { - md_number_to_chars (litP, (valueT) (* -- wordP), sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, *--wordP, sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } diff --git a/gas/config/kvx-parse.c b/gas/config/kvx-parse.c index 5995d62..ea96f3d 100644 --- a/gas/config/kvx-parse.c +++ b/gas/config/kvx-parse.c @@ -68,7 +68,7 @@ has_relocation_of_size (const struct kvx_reloc **relocs) if (!relocs) return 0; - struct kvx_reloc **relocs_it = (struct kvx_reloc **) relocs; + const struct kvx_reloc **relocs_it = relocs; int has_only_one_p = relocs[0] && !relocs[1]; while (*relocs_it) @@ -101,15 +101,13 @@ has_relocation_of_size (const struct kvx_reloc **relocs) return 0; } -struct pseudo_func * -kvx_get_pseudo_func2 (symbolS * sym, struct kvx_reloc **relocs); -struct pseudo_func * -kvx_get_pseudo_func2 (symbolS *sym, struct kvx_reloc **relocs) +static struct pseudo_func * +kvx_get_pseudo_func2 (symbolS *sym, const struct kvx_reloc **relocs) { if (!relocs) return NULL; - struct kvx_reloc **relocs_it = (struct kvx_reloc **) relocs; + const struct kvx_reloc **relocs_it = relocs; for (int i = 0; i < 26; i++) { @@ -460,7 +458,7 @@ get_token_class (struct token_s *token, struct token_classes *classes, int insn_ { int cur = 0; int found = 0; - int tok_sz = token->end - token->begin; + size_t tok_sz = token->end - token->begin; char *tok = token->insn + token->begin; expressionS exp; @@ -559,7 +557,7 @@ get_token_class (struct token_s *token, struct token_classes *classes, int insn_ for (int i = 0; !found && i < class[cur].sz; ++i) { const char *ref = class[cur].class_values[i]; - found = ((long) strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz); + found = (strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz); token->val = i; } @@ -671,7 +669,7 @@ static struct token_list * create_token (struct token_s tok, int len, int loc) { struct token_list *tl = calloc (1, sizeof *tl); - int tok_sz = tok.end - tok.begin; + size_t tok_sz = tok.end - tok.begin; tl->tok = calloc (tok_sz + 1, sizeof (char)); memcpy (tl->tok, tok.insn + tok.begin, tok_sz * sizeof (char)); tl->val = tok.val; diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index f481ad4..20167e9 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -155,7 +155,7 @@ obj_aout_line (int ignore ATTRIBUTE_UNUSED) /* Assume delimiter is part of expression. BSD4.2 as fails with delightful bug, so we are not being incompatible here. */ - new_logical_line ((char *) NULL, (int) (get_absolute_expression ())); + new_logical_line (NULL, get_absolute_expression ()); demand_empty_rest_of_line (); } diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index becf7a9..1607a43 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -64,7 +64,7 @@ get_pxdata_name (segT seg, const char *base_name) else name = dollar; - sname = notes_concat (base_name, name, NULL); + sname = notes_concat (base_name, name, (const char *) NULL); return sname; } diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 1f9eaa3..be6a965 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -90,7 +90,7 @@ stack_init (unsigned long chunk_size, } static char * -stack_push (stack *st, char *element) +stack_push (stack *st, void *element) { if (st->pointer + st->element_size >= st->size) { @@ -369,10 +369,10 @@ void coff_obj_symbol_new_hook (symbolS *symbolP) { size_t sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type); - char *s = notes_alloc (sz); + combined_entry_type *s = notes_alloc (sz); memset (s, 0, sz); - coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s; + coffsymbol (symbol_get_bfdsym (symbolP))->native = s; coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = true; S_SET_DATA_TYPE (symbolP, T_NULL); @@ -462,7 +462,7 @@ obj_coff_ln (int ignore ATTRIBUTE_UNUSED) /* If there is no lineno symbol, treat a .ln directive as if it were a (no longer existing) .appline one. */ if (current_lineno_sym == NULL) - new_logical_line ((char *) NULL, l - 1); + new_logical_line (NULL, l - 1); else add_lineno (frag_now, frag_now_fix (), l); @@ -903,7 +903,7 @@ obj_coff_line (int ignore ATTRIBUTE_UNUSED) extern int listing; if (listing) - listing_source_line ((unsigned int) this_base); + listing_source_line (this_base); } #endif } @@ -982,8 +982,8 @@ obj_coff_type (int ignore ATTRIBUTE_UNUSED) S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ()); - if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) && - S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) + if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) + && S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) SF_SET_FUNCTION (def_symbol_in_progress); demand_empty_rest_of_line (); @@ -1011,7 +1011,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED) { /* If the .val is != from the .def (e.g. statics). */ symbol_set_frag (def_symbol_in_progress, frag_now); - S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); + S_SET_VALUE (def_symbol_in_progress, frag_now_fix ()); } else if (! streq (S_GET_NAME (def_symbol_in_progress), symbol_name)) { @@ -1325,7 +1325,7 @@ coff_frob_symbol (symbolS *symp, int *punt) if (S_GET_STORAGE_CLASS (symp) == C_BLOCK) { if (streq (S_GET_NAME (symp), ".bb")) - stack_push (block_stack, (char *) &symp); + stack_push (block_stack, &symp); else { symbolS *begin; @@ -1356,8 +1356,8 @@ coff_frob_symbol (symbolS *symp, int *punt) as_fatal (_("C_EFCN symbol for %s out of scope"), S_GET_NAME (symp)); SA_SET_SYM_FSIZE (last_functionP, - (long) (S_GET_VALUE (symp) - - S_GET_VALUE (last_functionP))); + (S_GET_VALUE (symp) + - S_GET_VALUE (last_functionP))); } } @@ -1392,7 +1392,7 @@ coff_frob_symbol (symbolS *symp, int *punt) *punt = 1; #endif - if (set_end != (symbolS *) NULL + if (set_end != NULL && ! *punt && ((symbol_get_bfdsym (symp)->flags & BSF_NOT_AT_END) != 0 || (S_IS_DEFINED (symp) @@ -1669,7 +1669,7 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) } } - sec = subseg_new (name, (subsegT) exp); + sec = subseg_new (name, exp); if (is_bss) seg_info (sec)->bss = 1; @@ -1812,8 +1812,8 @@ coff_frob_section (segT sec) /* Store the values. */ p = fragp->fr_literal; - bfd_h_put_16 (stdoutput, n_entries, (bfd_byte *) p + 6); - bfd_h_put_32 (stdoutput, size, (bfd_byte *) p + 8); + bfd_h_put_16 (stdoutput, n_entries, p + 6); + bfd_h_put_32 (stdoutput, size, p + 8); } void @@ -1827,7 +1827,7 @@ obj_coff_init_stab_section (segT stab ATTRIBUTE_UNUSED, segT stabstr) p = frag_more (12); /* Zero it out. */ memset (p, 0, 12); - file = as_where ((unsigned int *) NULL); + file = as_where (NULL); stroff = get_stab_string_offset (file, stabstr); know (stroff == 1); md_number_to_chars (p, stroff, 4); @@ -1839,7 +1839,7 @@ const char * s_get_name (symbolS *); const char * s_get_name (symbolS *s) { - return ((s == NULL) ? "(NULL)" : S_GET_NAME (s)); + return s == NULL ? "(NULL)" : S_GET_NAME (s); } void symbol_dump (void); diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 368594d..315d08e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -205,7 +205,7 @@ elf_file_symbol (const char *s) if (name_length > strlen (S_GET_NAME (sym))) { obstack_grow (¬es, s, name_length + 1); - S_SET_NAME (sym, (const char *) obstack_finish (¬es)); + S_SET_NAME (sym, obstack_finish (¬es)); } else strcpy ((char *) S_GET_NAME (sym), s); @@ -481,7 +481,7 @@ match_section (const asection *sec, const struct elf_section_match *match) static bool get_section_by_match (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf) { - struct elf_section_match *match = (struct elf_section_match *) inf; + struct elf_section_match *match = inf; const char *gname = match->group_name; const char *group_name = elf_group_name (sec); @@ -614,7 +614,7 @@ change_section (const char *name, old_sec = group_section_find (match_p, name, &group_idx); else old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section_by_match, - (void *) match_p); + match_p); if (old_sec) { sec = old_sec; @@ -942,13 +942,12 @@ obj_elf_parse_section_letters (char *str, size_t len, if (ISDIGIT (*str)) { char * end; - struct elf_backend_data *bed; + const struct elf_backend_data *bed; bfd_vma numeric_flags = strtoul (str, &end, 0); attr |= numeric_flags; - bed = (struct elf_backend_data *) - get_elf_backend_data (stdoutput); + bed = get_elf_backend_data (stdoutput); if (bed->elf_osabi == ELFOSABI_NONE || bed->elf_osabi == ELFOSABI_STANDALONE @@ -1164,6 +1163,15 @@ obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED) elf_set_group_name (now_seg, gname); } +/* Handle section related directives. + + Note on support for SFrame sections: These are generally expected to be + generated by the assembler. However, this function permits their direct + creation by the user. At the moment though, we go no extra mile by adding + an explicit @sframe for SHT_GNU_SFRAME (using the numeric value of section + type should suffice); Nor do we implement any outright refusal for + non-supported targets via ELFOSABI-specific checks. */ + void obj_elf_section (int push) { @@ -1229,7 +1237,7 @@ obj_elf_section (int push) if (push && ISDIGIT (*input_line_pointer)) { /* .pushsection has an optional subsection. */ - new_subsection = (subsegT) get_absolute_expression (); + new_subsection = get_absolute_expression (); SKIP_WHITESPACE (); @@ -1460,7 +1468,7 @@ obj_elf_section (int push) char *t = input_line_pointer; match.sh_info = strtoul (input_line_pointer, &input_line_pointer, 0); - if (match.sh_info == (unsigned int) -1) + if (match.sh_info == -1u) { as_warn (_("unsupported mbind section info: %s"), t); match.sh_info = 0; @@ -1497,8 +1505,7 @@ obj_elf_section (int push) errno = 0; id = strtoul (input_line_pointer, &input_line_pointer, 0); - overflow = (id == (unsigned long) -1 - && errno == ERANGE); + overflow = id == -1ul && errno == ERANGE; } else { @@ -1507,7 +1514,7 @@ obj_elf_section (int push) (const char **) &input_line_pointer, 0); overflow = id == ~(bfd_vma) 0; } - if (overflow || id > (unsigned int) -1) + if (overflow || id > -1u) { char *linefeed, saved_char = 0; if ((linefeed = strchr (t, '\n')) != NULL) @@ -1614,7 +1621,7 @@ obj_elf_bss (int i ATTRIBUTE_UNUSED) obj_elf_section_change_hook (); temp = get_absolute_expression (); - subseg_set (bss_section, (subsegT) temp); + subseg_set (bss_section, temp); demand_empty_rest_of_line (); #ifdef md_elf_section_change_hook @@ -1688,7 +1695,7 @@ obj_elf_subsection (int ignore ATTRIBUTE_UNUSED) obj_elf_section_change_hook (); temp = get_absolute_expression (); - subseg_set (now_seg, (subsegT) temp); + subseg_set (now_seg, temp); demand_empty_rest_of_line (); #ifdef md_elf_section_change_hook @@ -2691,7 +2698,7 @@ set_additional_section_info (bfd *abfd, if (!strcmp ("str", sec->name + strlen (sec->name) - 3)) return; - name = concat (sec->name, "str", NULL); + name = concat (sec->name, "str", (const char *) NULL); strsec = bfd_get_section_by_name (abfd, name); if (strsec) strsz = bfd_section_size (strsec); diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c index c5317e8..9fbde27 100644 --- a/gas/config/obj-evax.c +++ b/gas/config/obj-evax.c @@ -107,8 +107,7 @@ evax_frob_symbol (symbolS *sym, int *punt) else if ((symbol->flags & BSF_GLOBAL) && (symbol->flags & BSF_FUNCTION)) { - struct evax_private_udata_struct *udata - = (struct evax_private_udata_struct *)symbol->udata.p; + struct evax_private_udata_struct *udata = symbol->udata.p; /* Fix up equates of function definitions. */ while (udata->enbsym == NULL) diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index d0cd3af..01e76c5 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -531,8 +531,8 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); if (*input_line_pointer == ',') { - align = (unsigned int) parse_align (0); - if (align == (unsigned int) -1) + align = parse_align (0); + if (align == -1u) { as_warn (_("align value not recognized, using size")); align = size; @@ -552,7 +552,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) new_seg = obj_mach_o_make_or_get_sect (segname, sectname, specified_mask, BFD_MACH_O_S_ZEROFILL, BFD_MACH_O_S_ATTR_NONE, - align, (offsetT) 0 /*stub size*/); + align, 0 /*stub size*/); if (new_seg == NULL) return; @@ -960,7 +960,7 @@ obj_mach_o_fileprop (int prop) if (prop < 0 || prop >= OBJ_MACH_O_FILE_PROP_MAX) as_fatal (_("internal error: bad file property ID %d"), prop); - switch ((obj_mach_o_file_properties) prop) + switch (prop) { case OBJ_MACH_O_FILE_PROP_SUBSECTS_VIA_SYMS: obj_mach_o_subsections_by_symbols = 1; @@ -1023,7 +1023,7 @@ obj_mach_o_set_symbol_qualifier (symbolS *sym, int type) if (sec != NULL) sectype = sec->flags & BFD_MACH_O_SECTION_TYPE_MASK; - switch ((obj_mach_o_symbol_type) type) + switch (type) { case OBJ_MACH_O_SYM_LOCAL: /* This is an extension over the system tools. */ @@ -1613,7 +1613,7 @@ obj_mach_o_check_before_writing (bfd *abfd ATTRIBUTE_UNUSED, void obj_mach_o_pre_output_hook (void) { - bfd_map_over_sections (stdoutput, obj_mach_o_check_before_writing, (char *) 0); + bfd_map_over_sections (stdoutput, obj_mach_o_check_before_writing, NULL); } /* Here we count up frags in each subsection (where a sub-section is defined @@ -1662,7 +1662,7 @@ obj_mach_o_set_subsections (bfd *abfd ATTRIBUTE_UNUSED, void obj_mach_o_pre_relax_hook (void) { - bfd_map_over_sections (stdoutput, obj_mach_o_set_subsections, (char *) 0); + bfd_map_over_sections (stdoutput, obj_mach_o_set_subsections, NULL); } /* Zerofill and GB Zerofill sections must be sorted to follow all other @@ -1698,7 +1698,7 @@ obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p { bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec); unsigned bfd_align = bfd_section_alignment (sec); - obj_mach_o_set_vma_data *p = (struct obj_mach_o_set_vma_data *)v_p; + obj_mach_o_set_vma_data *p = v_p; unsigned sectype = (ms->flags & BFD_MACH_O_SECTION_TYPE_MASK); unsigned zf; @@ -1741,11 +1741,11 @@ void obj_mach_o_post_relax_hook (void) memset (&d, 0, sizeof (d)); - bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d); + bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d); if ((d.vma_pass = d.zerofill_seen) != 0) - bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d); + bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d); if ((d.vma_pass = d.gb_zerofill_seen) != 0) - bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d); + bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d); } static void @@ -1777,8 +1777,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec, obj_mach_o_indirect_sym *isym; obj_mach_o_indirect_sym *list = NULL; obj_mach_o_indirect_sym *list_tail = NULL; - unsigned long eltsiz = - bfd_mach_o_section_get_entry_size (abfd, ms); + unsigned long eltsiz = bfd_mach_o_section_get_entry_size (abfd, ms); for (isym = indirect_syms; isym != NULL; isym = isym->next) { @@ -1801,7 +1800,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec, entry size, we're dead ... */ gas_assert (eltsiz != 0); - ncalc = (unsigned int) (sect_size / eltsiz); + ncalc = sect_size / eltsiz; if (nactual != ncalc) as_bad (_("the number of .indirect_symbols defined in section %s" " does not match the number expected (%d defined, %d" @@ -1875,7 +1874,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec, void obj_mach_o_frob_file_after_relocs (void) { - bfd_map_over_sections (stdoutput, obj_mach_o_set_indirect_symbols, (char *) 0); + bfd_map_over_sections (stdoutput, obj_mach_o_set_indirect_symbols, NULL); } /* Reverse relocations order to make ld happy. */ diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index 0d8108f..7cfc9cb 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -246,7 +246,7 @@ obj_som_init_stab_section (segT stab, segT stabstr) the call to get_stab_string_offset. */ p = frag_more (12); memset (p, 0, 12); - file = as_where ((unsigned int *) NULL); + file = as_where (NULL); stroff = get_stab_string_offset (file, stabstr); know (stroff == 1); md_number_to_chars (p, stroff, 4); @@ -284,8 +284,8 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) p = seg_info (sec)->stabu.p; gas_assert (p != 0); - bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6); - bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8); + bfd_h_put_16 (abfd, nsyms, p + 6); + bfd_h_put_32 (abfd, strsz, p + 8); } /* Called late in the assembly phase to adjust the special @@ -294,7 +294,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) void som_frob_file (void) { - bfd_map_over_sections (stdoutput, adjust_stab_sections, (void *) 0); + bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL); } static void diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 13649e8..96bfe74 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2351,6 +2351,14 @@ s_aarch64_cfi_b_key_frame (int ignored ATTRIBUTE_UNUSED) fde->pauth_key = AARCH64_PAUTH_KEY_B; } +static void +s_aarch64_mte_tagged_frame (int ignored ATTRIBUTE_UNUSED) +{ + demand_empty_rest_of_line (); + struct fde_entry *fde = frchain_now->frch_cfi_data->cur_fde_data; + fde->memtag_frame_p = true; +} + #ifdef OBJ_ELF /* Emit BFD_RELOC_AARCH64_TLSDESC_ADD on the next ADD instruction. */ @@ -2476,6 +2484,7 @@ const pseudo_typeS md_pseudo_table[] = { {"arch_extension", s_aarch64_arch_extension, 0}, {"inst", s_aarch64_inst, 0}, {"cfi_b_key_frame", s_aarch64_cfi_b_key_frame, 0}, + {"cfi_mte_tagged_frame", s_aarch64_mte_tagged_frame, 0}, #ifdef OBJ_ELF {"tlsdescadd", s_tlsdescadd, 0}, {"tlsdesccall", s_tlsdesccall, 0}, @@ -4607,7 +4616,9 @@ parse_hint_opt (const char *name, char **str, && o->value != HINT_OPD_CSYNC) || ((strcmp ("bti", name) == 0) && (o->value != HINT_OPD_C && o->value != HINT_OPD_J - && o->value != HINT_OPD_JC))) + && o->value != HINT_OPD_JC)) + || ((strcmp ("stshh", name) == 0) + && (o->value != HINT_OPD_KEEP && o->value != HINT_OPD_STRM))) return false; *str = q; @@ -4954,6 +4965,10 @@ parse_sme_sm_za (char **str) return TOLOWER (p[0]); } +/* By default, system register accesses are unguarded (apart from the + requirement of +d128 for mrrs/msrr). */ +static int sysreg_checking_p = 0; + /* Parse a system register or a PSTATE field name for an MSR/MRS instruction. Returns the encoding for the option, or PARSE_FAIL. @@ -5008,10 +5023,11 @@ parse_sys_reg (char **str, htab_t sys_regs, } else { - if (pstatefield_p && !aarch64_pstatefield_supported_p (cpu_variant, o)) + if (pstatefield_p && sysreg_checking_p + && !aarch64_pstatefield_supported_p (cpu_variant, o)) as_bad (_("selected processor does not support PSTATE field " "name '%s'"), buf); - if (!pstatefield_p + if (!pstatefield_p && sysreg_checking_p && !aarch64_sys_ins_reg_supported_p (cpu_variant, o->name, o->flags, &o->features)) as_bad (_("selected processor does not support system register " @@ -5092,12 +5108,14 @@ parse_sys_ins_reg (char **str, htab_t sys_ins_regs, bool sysreg128_p) } while (0) #define po_imm_nc_or_fail() do { \ - if (! parse_constant_immediate (&str, &val, imm_reg_type)) \ + aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \ + if (! parse_constant_immediate (&str, &val, invalid_types)) \ goto failure; \ } while (0) #define po_imm_or_fail(min, max) do { \ - if (! parse_constant_immediate (&str, &val, imm_reg_type)) \ + aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \ + if (! parse_constant_immediate (&str, &val, invalid_types)) \ goto failure; \ if (val < min || val > max) \ { \ @@ -5108,8 +5126,9 @@ parse_sys_ins_reg (char **str, htab_t sys_ins_regs, bool sysreg128_p) } while (0) #define po_enum_or_fail(array) do { \ + aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \ if (!parse_enum_string (&str, &val, array, \ - ARRAY_SIZE (array), imm_reg_type)) \ + ARRAY_SIZE (array), invalid_types)) \ goto failure; \ } while (0) @@ -5622,7 +5641,7 @@ static const char *aarch64_apply_style { int res; char *ptr; - struct obstack *stack = (struct obstack *) styler->state; + struct obstack *stack = styler->state; va_list ap; /* Calculate the required space. */ @@ -5632,7 +5651,7 @@ static const char *aarch64_apply_style gas_assert (res >= 0); /* Allocate space on the obstack and format the result. */ - ptr = (char *) obstack_alloc (stack, res + 1); + ptr = obstack_alloc (stack, res + 1); res = vsnprintf (ptr, (res + 1), fmt, args); gas_assert (res >= 0); @@ -5651,7 +5670,7 @@ print_operands (char *buf, const aarch64_opcode *opcode, obstack_init (&content); styler.apply_style = aarch64_apply_style; - styler.state = (void *) &content; + styler.state = &content; for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i) { @@ -6655,6 +6674,28 @@ reg_list_valid_p (uint32_t reginfo, struct aarch64_reglist *list, return true; } +static aarch64_reg_type +imm_invalid_reg_types (uint64_t flags) +{ + switch (flags & F_INVALID_IMM_SYMS) + { + case F_INVALID_IMM_SYMS_1: + return REG_TYPE_R_ZR_BHSDQ_V; + + case F_INVALID_IMM_SYMS_2: + return REG_TYPE_R_ZR_SP_BHSDQ_VZP; + + case F_INVALID_IMM_SYMS_3: + return REG_TYPE_R_ZR_SP_BHSDQ_VZP_PN; + + default: + /* All instructions with immediate operands require an explicit flag - + this ensures that the flags will not be forgotten when adding new + instructions. */ + gas_assert (0); + } +} + /* Generic instruction operand parser. This does no encoding and no semantic validation; it merely squirrels values away in the inst structure. Returns TRUE or FALSE depending on whether the @@ -6667,19 +6708,10 @@ parse_operands (char *str, const aarch64_opcode *opcode) char *backtrack_pos = 0; const enum aarch64_opnd *operands = opcode->operands; const uint64_t flags = opcode->flags; - aarch64_reg_type imm_reg_type; clear_error (); skip_whitespace (str); - if (AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SME2)) - imm_reg_type = REG_TYPE_R_ZR_SP_BHSDQ_VZP_PN; - else if (AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE) - || AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE2)) - imm_reg_type = REG_TYPE_R_ZR_SP_BHSDQ_VZP; - else - imm_reg_type = REG_TYPE_R_ZR_BHSDQ_V; - for (i = 0; operands[i] != AARCH64_OPND_NIL; i++) { int64_t val; @@ -6917,6 +6949,7 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_SME_Zn_INDEX1_16: case AARCH64_OPND_SME_Zn_INDEX2_15: case AARCH64_OPND_SME_Zn_INDEX2_16: + case AARCH64_OPND_SME_Zn_INDEX2_19: case AARCH64_OPND_SME_Zn_INDEX3_14: case AARCH64_OPND_SME_Zn_INDEX3_15: case AARCH64_OPND_SME_Zn_INDEX4_14: @@ -7234,13 +7267,15 @@ parse_operands (char *str, const aarch64_opcode *opcode) { int qfloat; bool res1 = false, res2 = false; + aarch64_reg_type invalid_types + = imm_invalid_reg_types (opcode->flags); /* N.B. -0.0 will be rejected; although -0.0 shouldn't be rejected, it is probably not worth the effort to support it. */ if (!(res1 = parse_aarch64_imm_float (&str, &qfloat, false, - imm_reg_type)) + invalid_types)) && (error_p () || !(res2 = parse_constant_immediate (&str, &val, - imm_reg_type)))) + invalid_types)))) goto failure; if ((res1 && qfloat == 0) || (res2 && val == 0)) { @@ -7274,7 +7309,8 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_SIMD_IMM: case AARCH64_OPND_SIMD_IMM_SFT: - if (! parse_big_immediate (&str, &val, imm_reg_type)) + if (! parse_big_immediate (&str, &val, + imm_invalid_reg_types (opcode->flags))) goto failure; assign_imm_if_const_or_fixup_later (&inst.reloc, info, /* addr_off_p */ 0, @@ -7302,11 +7338,13 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_SIMD_FPIMM: case AARCH64_OPND_SVE_FPIMM8: { + aarch64_reg_type invalid_types + = imm_invalid_reg_types (opcode->flags); int qfloat; bool dp_p; dp_p = double_precision_operand_p (&inst.base.operands[0]); - if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, imm_reg_type) + if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, invalid_types) || !aarch64_imm_float_p (qfloat)) { if (!error_p ()) @@ -7323,11 +7361,13 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_SVE_I1_HALF_TWO: case AARCH64_OPND_SVE_I1_ZERO_ONE: { + aarch64_reg_type invalid_types + = imm_invalid_reg_types (opcode->flags); int qfloat; bool dp_p; dp_p = double_precision_operand_p (&inst.base.operands[0]); - if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, imm_reg_type)) + if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, invalid_types)) { if (!error_p ()) set_fatal_syntax_error (_("invalid floating-point" @@ -7416,13 +7456,17 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_EXCEPTION: case AARCH64_OPND_UNDEFINED: - po_misc_or_fail (parse_immediate_expression (&str, &inst.reloc.exp, - imm_reg_type)); - assign_imm_if_const_or_fixup_later (&inst.reloc, info, - /* addr_off_p */ 0, - /* need_libopcodes_p */ 0, - /* skip_p */ 1); - break; + { + aarch64_reg_type invalid_types + = imm_invalid_reg_types (opcode->flags); + po_misc_or_fail (parse_immediate_expression (&str, &inst.reloc.exp, + invalid_types)); + assign_imm_if_const_or_fixup_later (&inst.reloc, info, + /* addr_off_p */ 0, + /* need_libopcodes_p */ 0, + /* skip_p */ 1); + break; + } case AARCH64_OPND_NZCV: { @@ -8091,7 +8135,9 @@ parse_operands (char *str, const aarch64_opcode *opcode) { /* DSB nXS barrier variant accept 5-bit unsigned immediate, with possible values 16, 20, 24 or 28 , encoded as val<3:2>. */ - if (! parse_constant_immediate (&str, &val, imm_reg_type)) + aarch64_reg_type invalid_types + = imm_invalid_reg_types (opcode->flags); + if (! parse_constant_immediate (&str, &val, invalid_types)) goto failure; if (!(val == 16 || val == 20 || val == 24 || val == 28)) { @@ -8106,9 +8152,18 @@ parse_operands (char *str, const aarch64_opcode *opcode) case AARCH64_OPND_PRFOP: val = parse_pldop (&str); + + if (opcode->iclass != ldst_pos && val == 0x18) + { + set_syntax_error (_("invalid prefetch operation (IR is not valid for" + " this instruction variant)")); + goto failure; + } + /* This is an extension to accept a 0..31 immediate. */ if (val == PARSE_FAIL) po_imm_or_fail (0, 31); + inst.base.operands[i].prfop = aarch64_prfops + val; break; @@ -8188,6 +8243,11 @@ parse_operands (char *str, const aarch64_opcode *opcode) goto failure; break; + case AARCH64_OPND_STSHH_POLICY: + if (!parse_hint_opt (opcode->name, &str, &(info->hint_option))) + goto failure; + break; + case AARCH64_OPND_SME_ZAda_1b: case AARCH64_OPND_SME_ZAda_2b: case AARCH64_OPND_SME_ZAda_3b: @@ -8662,7 +8722,7 @@ md_assemble (char *str) if (last_label_seen != NULL) { symbol_set_frag (last_label_seen, frag_now); - S_SET_VALUE (last_label_seen, (valueT) frag_now_fix ()); + S_SET_VALUE (last_label_seen, frag_now_fix ()); S_SET_SEGMENT (last_label_seen, now_seg); } @@ -9347,6 +9407,10 @@ try_to_encode_as_unscaled_ldst (aarch64_inst *instr) if (new_op == OP_NIL) return false; + if ((instr->opcode->op == OP_PRFM_POS) + && (instr->operands[0].prfop->value == 0x18)) + return false; + new_opcode = aarch64_get_opcode (new_op); gas_assert (new_opcode != NULL); @@ -10123,7 +10187,7 @@ cons_fix_new_aarch64 (fragS * frag, int where, int size, expressionS * exp) } #endif - fix_new_exp (frag, where, (int) size, exp, pcrel, type); + fix_new_exp (frag, where, size, exp, pcrel, type); } /* Implement md_after_parse_args. This is the earliest time we need to decide @@ -10269,7 +10333,7 @@ aarch64_adjust_symtab (void) { #ifdef OBJ_ELF /* Remove any overlapping mapping symbols generated by alignment frags. */ - bfd_map_over_sections (stdoutput, check_mapping_symbols, (char *) 0); + bfd_map_over_sections (stdoutput, check_mapping_symbols, NULL); /* Now do generic ELF adjustments. */ elf_adjust_symtab (); #endif @@ -10553,6 +10617,9 @@ static struct aarch64_option_table aarch64_opts[] = { NULL}, {"mno-verbose-error", N_("do not output verbose error messages"), &verbose_error_p, 0, NULL}, + {"menable-sysreg-checking", + N_("enable feature flag gating for system registers"), + &sysreg_checking_p, 1, NULL}, {NULL, NULL, NULL, 0, NULL} }; @@ -10675,6 +10742,7 @@ static const struct aarch64_arch_option_table aarch64_archs[] = { {"armv9.3-a", AARCH64_ARCH_FEATURES (V9_3A)}, {"armv9.4-a", AARCH64_ARCH_FEATURES (V9_4A)}, {"armv9.5-a", AARCH64_ARCH_FEATURES (V9_5A)}, + {"armv9.6-a", AARCH64_ARCH_FEATURES (V9_6A)}, {NULL, AARCH64_NO_FEATURES} }; @@ -10698,6 +10766,7 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { {"lse", AARCH64_FEATURE (LSE), AARCH64_NO_FEATURES}, {"lsfe", AARCH64_FEATURE (LSFE), AARCH64_FEATURE (FP)}, {"lse128", AARCH64_FEATURE (LSE128), AARCH64_FEATURE (LSE)}, + {"lsui", AARCH64_FEATURE (LSUI), AARCH64_NO_FEATURES}, {"simd", AARCH64_FEATURE (SIMD), AARCH64_FEATURE (FP)}, {"pan", AARCH64_FEATURE (PAN), AARCH64_NO_FEATURES}, {"lor", AARCH64_FEATURE (LOR), AARCH64_NO_FEATURES}, @@ -10735,7 +10804,7 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { {"sve2-sm4", AARCH64_FEATURE (SVE2_SM4), AARCH64_FEATURES (2, SVE2, SM4)}, {"sve2-aes", AARCH64_FEATURE (SVE2_AES), - AARCH64_FEATURES (2, SVE2, AES)}, + AARCH64_FEATURES (2, SVE2, SVE_AES)}, {"sve2-sha3", AARCH64_FEATURE (SVE2_SHA3), AARCH64_FEATURES (2, SVE2, SHA3)}, {"sve2-bitperm", AARCH64_FEATURE (SVE2_BITPERM), @@ -10773,6 +10842,9 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { {"sve-f16f32mm", AARCH64_FEATURE (SVE_F16F32MM), AARCH64_FEATURE (SVE)}, {"f8f32mm", AARCH64_FEATURE (F8F32MM), AARCH64_FEATURES (2, SIMD, FP8)}, {"f8f16mm", AARCH64_FEATURE (F8F16MM), AARCH64_FEATURES (2, SIMD, FP8)}, + {"sve-aes", AARCH64_FEATURE (SVE_AES), AARCH64_FEATURE (AES)}, + {"sve-aes2", AARCH64_FEATURE (SVE_AES2), AARCH64_NO_FEATURES}, + {"ssve-aes", AARCH64_FEATURE (SSVE_AES), AARCH64_FEATURES (2, SME2, SVE_AES)}, {"rcpc3", AARCH64_FEATURE (RCPC3), AARCH64_FEATURE (RCPC2)}, {"cpa", AARCH64_FEATURE (CPA), AARCH64_NO_FEATURES}, {"faminmax", AARCH64_FEATURE (FAMINMAX), AARCH64_FEATURE (SIMD)}, @@ -10797,6 +10869,8 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { {"sme-b16b16", AARCH64_FEATURE (SME_B16B16), AARCH64_FEATURES (2, SVE_B16B16, SME2)}, {"pops", AARCH64_FEATURE (PoPS), AARCH64_NO_FEATURES}, + {"sve2p2", AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2p1)}, + {"sme2p2", AARCH64_FEATURE (SME2p2), AARCH64_FEATURE (SME2p1)}, {NULL, AARCH64_NO_FEATURES, AARCH64_NO_FEATURES}, }; @@ -10809,6 +10883,8 @@ struct aarch64_virtual_dependency_table }; static const struct aarch64_virtual_dependency_table aarch64_dependencies[] = { + {AARCH64_FEATURE (SVE2), AARCH64_FEATURE (SVE2_SSVE_AES)}, + {AARCH64_FEATURE (SSVE_AES), AARCH64_FEATURE (SVE2_SSVE_AES)}, {AARCH64_FEATURES (2, FP8FMA, SVE2), AARCH64_FEATURE (FP8FMA_SVE)}, {AARCH64_FEATURE (SSVE_FP8FMA), AARCH64_FEATURE (FP8FMA_SVE)}, {AARCH64_FEATURES (2, FP8DOT4, SVE2), AARCH64_FEATURE (FP8DOT4_SVE)}, @@ -10817,13 +10893,15 @@ static const struct aarch64_virtual_dependency_table aarch64_dependencies[] = { {AARCH64_FEATURE (SSVE_FP8DOT2), AARCH64_FEATURE (FP8DOT2_SVE)}, {AARCH64_FEATURE (SME_F16F16), AARCH64_FEATURE (SME_F16F16_F8F16)}, {AARCH64_FEATURE (SME_F8F16), AARCH64_FEATURE (SME_F16F16_F8F16)}, - {AARCH64_FEATURE (SVE2p1), AARCH64_FEATURES (3, SVE2p1_SME, SVE2p1_SME2, - SVE2p1_SME2p1)}, + {AARCH64_FEATURE (SVE), AARCH64_FEATURE (SVE_SME2p2)}, {AARCH64_FEATURE (SME), AARCH64_FEATURE (SVE2p1_SME)}, - {AARCH64_FEATURE (SME2), AARCH64_FEATURE (SVE2p1_SME2)}, {AARCH64_FEATURE (SVE2), AARCH64_FEATURE (SVE2_SME2)}, - {AARCH64_FEATURE (SME2), AARCH64_FEATURE (SVE2_SME2)}, + {AARCH64_FEATURE (SME2), AARCH64_FEATURES (2, SVE2_SME2, SVE2p1_SME2)}, + {AARCH64_FEATURE (SVE2p1), AARCH64_FEATURES (3, SVE2p1_SME, SVE2p1_SME2, + SVE2p1_SME2p1)}, {AARCH64_FEATURE (SME2p1), AARCH64_FEATURE (SVE2p1_SME2p1)}, + {AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2p2_SME2p2)}, + {AARCH64_FEATURE (SME2p2), AARCH64_FEATURES (2, SVE_SME2p2, SVE2p2_SME2p2)}, }; static aarch64_feature_set diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index 0d8066c..fce34ed 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -90,13 +90,21 @@ enum pointer_auth_key { /* The extra fields required by AArch64 in fde_entry and cie_entry. Currently only used to store the key used to sign the frame's return address. */ -#define tc_fde_entry_extras enum pointer_auth_key pauth_key; -#define tc_cie_entry_extras enum pointer_auth_key pauth_key; +#define tc_fde_entry_extras enum pointer_auth_key pauth_key; \ + bool memtag_frame_p; +#define tc_cie_entry_extras enum pointer_auth_key pauth_key; \ + bool memtag_frame_p; /* The extra initialisation steps needed by AArch64 in alloc_fde_entry. Currently only used to initialise the key used to sign the return address. */ -#define tc_fde_entry_init_extra(fde) fde->pauth_key = AARCH64_PAUTH_KEY_A; +#define tc_fde_entry_init_extra(fde) \ + do \ + { \ + fde->pauth_key = AARCH64_PAUTH_KEY_A; \ + fde->memtag_frame_p = false; \ + } \ + while (0) /* Extra checks required by AArch64 when outputting the current cie_entry. Currently only used to output a 'B' if the return address is signed with the @@ -106,18 +114,29 @@ enum pointer_auth_key { { \ if (cie->pauth_key == AARCH64_PAUTH_KEY_B) \ out_one ('B'); \ + if (cie->memtag_frame_p) \ + out_one ('G'); \ } \ while (0) /* Extra equivalence checks required by AArch64 when selecting the correct cie - for some fde. Currently only used to check for quivalence between keys used - to sign ther return address. */ -#define tc_cie_fde_equivalent_extra(cie, fde) (cie->pauth_key == fde->pauth_key) + for some fde. Currently used to check for equivalence between - keys used + to sign the return address, and if stack locations have MTE tagging + enabled. */ +#define tc_cie_fde_equivalent_extra(cie, fde) \ + ((cie->pauth_key == fde->pauth_key) \ + && (cie->memtag_frame_p == fde->memtag_frame_p)) /* The extra initialisation steps needed by AArch64 in select_cie_for_fde. Currently only used to initialise the key used to sign the return address. */ -#define tc_cie_entry_init_extra(cie, fde) cie->pauth_key = fde->pauth_key; +#define tc_cie_entry_init_extra(cie, fde) \ + do \ + { \ + cie->pauth_key = fde->pauth_key; \ + cie->memtag_frame_p = fde->memtag_frame_p; \ + } \ + while (0) #define TC_FIX_TYPE struct aarch64_fix #define TC_INIT_FIX_DATA(FIX) { (FIX)->tc_fix_data.inst = NULL; \ diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index f9ca351..9558425 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -99,7 +99,7 @@ struct alpha_insn long sequence; }; -enum alpha_macro_arg +typedef enum { MACRO_EOA = 1, MACRO_IR, @@ -108,14 +108,20 @@ enum alpha_macro_arg MACRO_CPIR, MACRO_FPR, MACRO_EXP - }; + } alpha_macro_argset; + +typedef union +{ + const void *p; + uintptr_t i; +} alpha_macro_arg; struct alpha_macro { const char *name; - void (*emit) (const expressionS *, int, const void *); - const void * arg; - enum alpha_macro_arg argsets[16]; + void (*emit) (const expressionS *, int, alpha_macro_arg); + alpha_macro_arg arg; + alpha_macro_argset argsets[16]; }; /* Extra expression types. */ @@ -170,33 +176,13 @@ struct alpha_macro #define note_fpreg(R) (alpha_fprmask |= (1 << (R))) /* Predicates for 16- and 32-bit ranges */ -/* XXX: The non-shift version appears to trigger a compiler bug when - cross-assembling from x86 w/ gcc 2.7.2. */ - -#if 1 -#define range_signed_16(x) \ - (((offsetT) (x) >> 15) == 0 || ((offsetT) (x) >> 15) == -1) -#define range_signed_32(x) \ - (((offsetT) (x) >> 31) == 0 || ((offsetT) (x) >> 31) == -1) -#else -#define range_signed_16(x) ((offsetT) (x) >= -(offsetT) 0x8000 && \ - (offsetT) (x) <= (offsetT) 0x7FFF) -#define range_signed_32(x) ((offsetT) (x) >= -(offsetT) 0x80000000 && \ - (offsetT) (x) <= (offsetT) 0x7FFFFFFF) -#endif +#define range_signed_16(x) ((valueT) (x) + 0x8000 <= 0xFFFF) +#define range_signed_32(x) ((valueT) (x) + 0x80000000 <= 0xFFFFFFFF) /* Macros for sign extending from 16- and 32-bits. */ -/* XXX: The cast macros will work on all the systems that I care about, - but really a predicate should be found to use the non-cast forms. */ - -#if 1 -#define sign_extend_16(x) ((short) (x)) -#define sign_extend_32(x) ((int) (x)) -#else -#define sign_extend_16(x) ((offsetT) (((x) & 0xFFFF) ^ 0x8000) - 0x8000) -#define sign_extend_32(x) ((offsetT) (((x) & 0xFFFFFFFF) \ - ^ 0x80000000) - 0x80000000) -#endif +#define sign_extend_16(x) ((((valueT) (x) & 0xFFFF) ^ 0x8000) - 0x8000) +#define sign_extend_32(x) ((((valueT) (x) & 0xFFFFFFFF) ^ 0x80000000) \ + - 0x80000000) /* Macros to build tokens. */ @@ -442,7 +428,7 @@ static int alpha_flag_show_after_trunc = 0; /* -H */ #define ALPHA_RELOC_TABLE(op) \ (&alpha_reloc_op[ ((!USER_RELOC_P (op)) \ ? (abort (), 0) \ - : (int) (op) - (int) O_literal) ]) + : (op) - O_literal) ]) #define DEF(NAME, RELOC, REQ, ALLOW) \ { #NAME, sizeof(#NAME)-1, O_##NAME, RELOC, REQ, ALLOW} @@ -638,7 +624,7 @@ alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED, for (fixp = seginfo->fix_root; fixp; fixp = next) { next = fixp->fx_next; - fixp->fx_next = (fixS *) 0; + fixp->fx_next = NULL; switch (fixp->fx_r_type) { @@ -736,7 +722,7 @@ alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED, && ! fixp->tc_fix_data.info->multi_section_p) { for (slave = fixp->tc_fix_data.info->slaves; - slave != (fixS *) 0; + slave != NULL; slave = slave->tc_fix_data.next_reloc) { slave->fx_next = fixp->fx_next; @@ -1661,7 +1647,7 @@ load_expression (int targreg, static void emit_lda (const expressionS *tok, int ntok, - const void * unused ATTRIBUTE_UNUSED) + alpha_macro_arg unused ATTRIBUTE_UNUSED) { int basereg; @@ -1679,7 +1665,7 @@ emit_lda (const expressionS *tok, static void emit_ldah (const expressionS *tok, int ntok ATTRIBUTE_UNUSED, - const void * unused ATTRIBUTE_UNUSED) + alpha_macro_arg unused ATTRIBUTE_UNUSED) { expressionS newtok[3]; @@ -1719,7 +1705,7 @@ alpha_align (int n, if (label != NULL && S_GET_SEGMENT (label) == now_seg) { symbol_set_frag (label, frag_now); - S_SET_VALUE (label, (valueT) frag_now_fix ()); + S_SET_VALUE (label, frag_now_fix ()); } record_alignment (now_seg, n); @@ -1738,7 +1724,7 @@ emit_insn (struct alpha_insn *insn) /* Take care of alignment duties. */ if (alpha_auto_align_on && alpha_current_align < 2) - alpha_align (2, (char *) NULL, alpha_insn_label, 0); + alpha_align (2, NULL, alpha_insn_label, 0); if (alpha_current_align > 2) alpha_current_align = 2; alpha_insn_label = NULL; @@ -1754,7 +1740,7 @@ emit_insn (struct alpha_insn *insn) /* Apply the fixups in order. */ for (i = 0; i < insn->nfixups; ++i) { - const struct alpha_operand *operand = (const struct alpha_operand *) 0; + const struct alpha_operand *operand = NULL; struct alpha_fixup *fixup = &insn->fixups[i]; struct alpha_reloc_tag *info = NULL; int size, pcrel; @@ -1777,8 +1763,7 @@ emit_insn (struct alpha_insn *insn) else { reloc_howto_type *reloc_howto = - bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) fixup->reloc); + bfd_reloc_type_lookup (stdoutput, fixup->reloc); gas_assert (reloc_howto); size = bfd_get_reloc_size (reloc_howto); @@ -1800,7 +1785,7 @@ emit_insn (struct alpha_insn *insn) } fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size, - &fixup->exp, pcrel, (bfd_reloc_code_real_type) fixup->reloc); + &fixup->exp, pcrel, fixup->reloc); /* Turn off complaints that the addend is too large for some fixups, and copy in the sequence number for the explicit relocations. */ @@ -2029,7 +2014,7 @@ assemble_insn (const struct alpha_opcode *opcode, for (argidx = opcode->operands; *argidx; ++argidx) { const struct alpha_operand *operand = &alpha_operands[*argidx]; - const expressionS *t = (const expressionS *) 0; + const expressionS *t = NULL; if (operand->flags & AXP_OPERAND_FAKE) { @@ -2138,8 +2123,7 @@ assemble_insn (const struct alpha_opcode *opcode, else if (reloc < BFD_RELOC_UNUSED && reloc > 0) { reloc_howto_type *reloc_howto - = bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) reloc); + = bfd_reloc_type_lookup (stdoutput, reloc); if (reloc_operand == NULL || reloc_howto->bitsize != reloc_operand->bits) { @@ -2166,7 +2150,7 @@ assemble_insn (const struct alpha_opcode *opcode, static void emit_ir_load (const expressionS *tok, int ntok, - const void * opname) + alpha_macro_arg opname) { int basereg; long lituse; @@ -2182,7 +2166,7 @@ emit_ir_load (const expressionS *tok, basereg = tok[2].X_add_number; lituse = load_expression (tok[0].X_add_number, &tok[1], - &basereg, &newtok[1], (const char *) opname); + &basereg, &newtok[1], opname.p); if (basereg == alpha_gp_register && (symlen > 4 && strcmp (&symname [symlen - 4], "..lk") == 0)) @@ -2191,7 +2175,7 @@ emit_ir_load (const expressionS *tok, newtok[0] = tok[0]; set_tok_preg (newtok[2], basereg); - assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn); + assemble_tokens_to_insn (opname.p, newtok, 3, &insn); if (lituse) { @@ -2211,7 +2195,7 @@ emit_ir_load (const expressionS *tok, static void emit_loadstore (const expressionS *tok, int ntok, - const void * opname) + alpha_macro_arg opname) { int basereg; long lituse; @@ -2229,7 +2213,7 @@ emit_loadstore (const expressionS *tok, as_bad (_("macro requires $at register while noat in effect")); lituse = load_expression (AXP_REG_AT, &tok[1], - &basereg, &newtok[1], (const char *) opname); + &basereg, &newtok[1], opname.p); } else { @@ -2240,7 +2224,7 @@ emit_loadstore (const expressionS *tok, newtok[0] = tok[0]; set_tok_preg (newtok[2], basereg); - assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn); + assemble_tokens_to_insn (opname.p, newtok, 3, &insn); if (lituse) { @@ -2259,10 +2243,10 @@ emit_loadstore (const expressionS *tok, static void emit_ldXu (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { if (alpha_target & AXP_OPCODE_BWX) - emit_ir_load (tok, ntok, ldXu_op[(long) vlgsize]); + emit_ir_load (tok, ntok, (alpha_macro_arg) { ldXu_op[lgsize.i] }); else { expressionS newtok[3]; @@ -2302,7 +2286,7 @@ emit_ldXu (const expressionS *tok, /* Emit "extXl targ, $at, targ". */ set_tok_reg (newtok[1], basereg); newtok[2] = newtok[0]; - assemble_tokens_to_insn (extXl_op[(long) vlgsize], newtok, 3, &insn); + assemble_tokens_to_insn (extXl_op[lgsize.i], newtok, 3, &insn); if (lituse) { @@ -2322,10 +2306,10 @@ emit_ldXu (const expressionS *tok, static void emit_ldX (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - emit_ldXu (tok, ntok, vlgsize); - assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1); + emit_ldXu (tok, ntok, lgsize); + assemble_tokens (sextX_op[lgsize.i], tok, 1, 1); } /* Load an integral value from an unaligned address as an unsigned @@ -2334,9 +2318,8 @@ emit_ldX (const expressionS *tok, static void emit_uldXu (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - long lgsize = (long) vlgsize; expressionS newtok[3]; if (alpha_noat_on) @@ -2355,19 +2338,19 @@ emit_uldXu (const expressionS *tok, /* Emit "ldq_u $t10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); - set_tok_const (newtok[1], (1 << lgsize) - 1); + set_tok_const (newtok[1], (1 << lgsize.i) - 1); assemble_tokens ("ldq_u", newtok, 3, 1); /* Emit "extXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_reg (newtok[1], AXP_REG_AT); set_tok_reg (newtok[2], AXP_REG_T9); - assemble_tokens (extXl_op[lgsize], newtok, 3, 1); + assemble_tokens (extXl_op[lgsize.i], newtok, 3, 1); /* Emit "extXh $t10, $at, $t10". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_reg (newtok[2], AXP_REG_T10); - assemble_tokens (extXh_op[lgsize], newtok, 3, 1); + assemble_tokens (extXh_op[lgsize.i], newtok, 3, 1); /* Emit "or $t9, $t10, targ". */ set_tok_reg (newtok[0], AXP_REG_T9); @@ -2383,10 +2366,10 @@ emit_uldXu (const expressionS *tok, static void emit_uldX (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - emit_uldXu (tok, ntok, vlgsize); - assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1); + emit_uldXu (tok, ntok, lgsize); + assemble_tokens (sextX_op[lgsize.i], tok, 1, 1); } /* Implement the ldil macro. */ @@ -2394,7 +2377,7 @@ emit_uldX (const expressionS *tok, static void emit_ldil (const expressionS *tok, int ntok, - const void * unused ATTRIBUTE_UNUSED) + alpha_macro_arg unused ATTRIBUTE_UNUSED) { expressionS newtok[2]; @@ -2409,12 +2392,10 @@ emit_ldil (const expressionS *tok, static void emit_stX (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - int lgsize = (int) (long) vlgsize; - if (alpha_target & AXP_OPCODE_BWX) - emit_loadstore (tok, ntok, stX_op[lgsize]); + emit_loadstore (tok, ntok, (alpha_macro_arg) { stX_op[lgsize.i] }); else { expressionS newtok[3]; @@ -2455,7 +2436,7 @@ emit_stX (const expressionS *tok, newtok[0] = tok[0]; set_tok_reg (newtok[1], basereg); set_tok_reg (newtok[2], AXP_REG_T10); - assemble_tokens_to_insn (insXl_op[lgsize], newtok, 3, &insn); + assemble_tokens_to_insn (insXl_op[lgsize.i], newtok, 3, &insn); if (lituse) { @@ -2471,7 +2452,7 @@ emit_stX (const expressionS *tok, /* Emit "mskXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); newtok[2] = newtok[0]; - assemble_tokens_to_insn (mskXl_op[lgsize], newtok, 3, &insn); + assemble_tokens_to_insn (mskXl_op[lgsize.i], newtok, 3, &insn); if (lituse) { @@ -2511,9 +2492,8 @@ emit_stX (const expressionS *tok, static void emit_ustX (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - int lgsize = (int) (long) vlgsize; expressionS newtok[3]; /* Emit "lda $at, exp". */ @@ -2529,28 +2509,28 @@ emit_ustX (const expressionS *tok, /* Emit "ldq_u $10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); - set_tok_const (newtok[1], (1 << lgsize) - 1); + set_tok_const (newtok[1], (1 << lgsize.i) - 1); assemble_tokens ("ldq_u", newtok, 3, 1); /* Emit "insXl src, $at, $t11". */ newtok[0] = tok[0]; set_tok_reg (newtok[1], AXP_REG_AT); set_tok_reg (newtok[2], AXP_REG_T11); - assemble_tokens (insXl_op[lgsize], newtok, 3, 1); + assemble_tokens (insXl_op[lgsize.i], newtok, 3, 1); /* Emit "insXh src, $at, $t12". */ set_tok_reg (newtok[2], AXP_REG_T12); - assemble_tokens (insXh_op[lgsize], newtok, 3, 1); + assemble_tokens (insXh_op[lgsize.i], newtok, 3, 1); /* Emit "mskXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); newtok[2] = newtok[0]; - assemble_tokens (mskXl_op[lgsize], newtok, 3, 1); + assemble_tokens (mskXl_op[lgsize.i], newtok, 3, 1); /* Emit "mskXh $t10, $at, $t10". */ set_tok_reg (newtok[0], AXP_REG_T10); newtok[2] = newtok[0]; - assemble_tokens (mskXh_op[lgsize], newtok, 3, 1); + assemble_tokens (mskXh_op[lgsize.i], newtok, 3, 1); /* Emit "or $t9, $t11, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); @@ -2566,7 +2546,7 @@ emit_ustX (const expressionS *tok, /* Emit "stq_u $t10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); - set_tok_const (newtok[1], (1 << lgsize) - 1); + set_tok_const (newtok[1], (1 << lgsize.i) - 1); set_tok_preg (newtok[2], AXP_REG_AT); assemble_tokens ("stq_u", newtok, 3, 1); @@ -2582,15 +2562,13 @@ emit_ustX (const expressionS *tok, static void emit_sextX (const expressionS *tok, int ntok, - const void * vlgsize) + alpha_macro_arg lgsize) { - long lgsize = (long) vlgsize; - if (alpha_target & AXP_OPCODE_BWX) - assemble_tokens (sextX_op[lgsize], tok, ntok, 0); + assemble_tokens (sextX_op[lgsize.i], tok, ntok, 0); else { - int bitshift = 64 - 8 * (1 << lgsize); + int bitshift = 64 - 8 * (1 << lgsize.i); expressionS newtok[3]; /* Emit "sll src,bits,dst". */ @@ -2615,7 +2593,7 @@ emit_sextX (const expressionS *tok, static void emit_division (const expressionS *tok, int ntok, - const void * symname) + alpha_macro_arg symname) { /* DIVISION and MODULUS. Yech. @@ -2686,7 +2664,7 @@ emit_division (const expressionS *tok, } } - sym = symbol_find_or_make ((const char *) symname); + sym = symbol_find_or_make (symname.p); set_tok_reg (newtok[0], AXP_REG_AT); set_tok_sym (newtok[1], sym, 0); @@ -2712,7 +2690,7 @@ emit_division (const expressionS *tok, static void emit_division (const expressionS *tok, int ntok, - const void * symname) + alpha_macro_arg symname) { /* DIVISION and MODULUS. Yech. Convert @@ -2739,7 +2717,7 @@ emit_division (const expressionS *tok, else rr = regno (tok[2].X_add_number); - sym = symbol_find_or_make ((const char *) symname); + sym = symbol_find_or_make (symname.p); /* Move the operands into the right place. */ if (yr == AXP_REG_T10 && xr == AXP_REG_T11) @@ -2818,9 +2796,8 @@ FIXME static void emit_jsrjmp (const expressionS *tok, int ntok, - const void * vopname) + alpha_macro_arg opname) { - const char *opname = (const char *) vopname; struct alpha_insn insn; expressionS newtok[3]; int r, tokidx = 0; @@ -2829,7 +2806,7 @@ emit_jsrjmp (const expressionS *tok, if (tokidx < ntok && tok[tokidx].X_op == O_register) r = regno (tok[tokidx++].X_add_number); else - r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA; + r = strcmp (opname.p, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA; set_tok_reg (newtok[0], r); @@ -2843,7 +2820,7 @@ emit_jsrjmp (const expressionS *tok, { int basereg = alpha_gp_register; lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], - &basereg, NULL, opname); + &basereg, NULL, opname.p); } #endif @@ -2856,7 +2833,7 @@ emit_jsrjmp (const expressionS *tok, #endif set_tok_const (newtok[2], 0); - assemble_tokens_to_insn (opname, newtok, 3, &insn); + assemble_tokens_to_insn (opname.p, newtok, 3, &insn); if (lituse) { @@ -2914,9 +2891,8 @@ emit_jsrjmp (const expressionS *tok, static void emit_retjcr (const expressionS *tok, int ntok, - const void * vopname) + alpha_macro_arg opname) { - const char *opname = (const char *) vopname; expressionS newtok[3]; int r, tokidx = 0; @@ -2938,9 +2914,9 @@ emit_retjcr (const expressionS *tok, if (tokidx < ntok) newtok[2] = tok[tokidx]; else - set_tok_const (newtok[2], strcmp (opname, "ret") == 0); + set_tok_const (newtok[2], strcmp (opname.p, "ret") == 0); - assemble_tokens (opname, newtok, 3, 0); + assemble_tokens (opname.p, newtok, 3, 0); } /* Implement the ldgp macro. */ @@ -2948,7 +2924,7 @@ emit_retjcr (const expressionS *tok, static void emit_ldgp (const expressionS *tok ATTRIBUTE_UNUSED, int ntok ATTRIBUTE_UNUSED, - const void * unused ATTRIBUTE_UNUSED) + alpha_macro_arg unused ATTRIBUTE_UNUSED) { #ifdef OBJ_AOUT FIXME @@ -3009,167 +2985,167 @@ FIXME static const struct alpha_macro alpha_macros[] = { /* Load/Store macros. */ - { "lda", emit_lda, NULL, + { "lda", emit_lda, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldah", emit_ldah, NULL, + { "ldah", emit_ldah, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldl", emit_ir_load, "ldl", + { "ldl", emit_ir_load, { "ldl" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldl_l", emit_ir_load, "ldl_l", + { "ldl_l", emit_ir_load, { "ldl_l" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq", emit_ir_load, "ldq", + { "ldq", emit_ir_load, { "ldq" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq_l", emit_ir_load, "ldq_l", + { "ldq_l", emit_ir_load, { "ldq_l" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq_u", emit_ir_load, "ldq_u", + { "ldq_u", emit_ir_load, { "ldq_u" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldf", emit_loadstore, "ldf", + { "ldf", emit_loadstore, { "ldf" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldg", emit_loadstore, "ldg", + { "ldg", emit_loadstore, { "ldg" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "lds", emit_loadstore, "lds", + { "lds", emit_loadstore, { "lds" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldt", emit_loadstore, "ldt", + { "ldt", emit_loadstore, { "ldt" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldb", emit_ldX, (void *) 0, + { "ldb", emit_ldX, { .i = 0 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldbu", emit_ldXu, (void *) 0, + { "ldbu", emit_ldXu, { .i = 0 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldw", emit_ldX, (void *) 1, + { "ldw", emit_ldX, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldwu", emit_ldXu, (void *) 1, + { "ldwu", emit_ldXu, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldw", emit_uldX, (void *) 1, + { "uldw", emit_uldX, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldwu", emit_uldXu, (void *) 1, + { "uldwu", emit_uldXu, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldl", emit_uldX, (void *) 2, + { "uldl", emit_uldX, { .i = 2 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldlu", emit_uldXu, (void *) 2, + { "uldlu", emit_uldXu, { .i = 2 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldq", emit_uldXu, (void *) 3, + { "uldq", emit_uldXu, { .i = 3 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldgp", emit_ldgp, NULL, + { "ldgp", emit_ldgp, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, - { "ldi", emit_lda, NULL, + { "ldi", emit_lda, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldil", emit_ldil, NULL, + { "ldil", emit_ldil, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldiq", emit_lda, NULL, + { "ldiq", emit_lda, { NULL }, { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stl", emit_loadstore, "stl", + { "stl", emit_loadstore, { "stl" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stl_c", emit_loadstore, "stl_c", + { "stl_c", emit_loadstore, { "stl_c" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq", emit_loadstore, "stq", + { "stq", emit_loadstore, { "stq" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq_c", emit_loadstore, "stq_c", + { "stq_c", emit_loadstore, { "stq_c" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq_u", emit_loadstore, "stq_u", + { "stq_u", emit_loadstore, { "stq_u" }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stf", emit_loadstore, "stf", + { "stf", emit_loadstore, { "stf" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stg", emit_loadstore, "stg", + { "stg", emit_loadstore, { "stg" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "sts", emit_loadstore, "sts", + { "sts", emit_loadstore, { "sts" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stt", emit_loadstore, "stt", + { "stt", emit_loadstore, { "stt" }, { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stb", emit_stX, (void *) 0, + { "stb", emit_stX, { .i = 0 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stw", emit_stX, (void *) 1, + { "stw", emit_stX, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustw", emit_ustX, (void *) 1, + { "ustw", emit_ustX, { .i = 1 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustl", emit_ustX, (void *) 2, + { "ustl", emit_ustX, { .i = 2 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustq", emit_ustX, (void *) 3, + { "ustq", emit_ustX, { .i = 3 }, { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, /* Arithmetic macros. */ - { "sextb", emit_sextX, (void *) 0, + { "sextb", emit_sextX, { .i = 0 }, { MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EOA, /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - { "sextw", emit_sextX, (void *) 1, + { "sextw", emit_sextX, { .i = 1 }, { MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EOA, /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - { "divl", emit_division, "__divl", + { "divl", emit_division, { "__divl" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divlu", emit_division, "__divlu", + { "divlu", emit_division, { "__divlu" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divq", emit_division, "__divq", + { "divq", emit_division, { "__divq" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divqu", emit_division, "__divqu", + { "divqu", emit_division, { "__divqu" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "reml", emit_division, "__reml", + { "reml", emit_division, { "__reml" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remlu", emit_division, "__remlu", + { "remlu", emit_division, { "__remlu" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remq", emit_division, "__remq", + { "remq", emit_division, { "__remq" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remqu", emit_division, "__remqu", + { "remqu", emit_division, { "__remqu" }, { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_IR, MACRO_EOA, /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "jsr", emit_jsrjmp, "jsr", + { "jsr", emit_jsrjmp, { "jsr" }, { MACRO_PIR, MACRO_EXP, MACRO_EOA, MACRO_PIR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_EXP, MACRO_EOA } }, - { "jmp", emit_jsrjmp, "jmp", + { "jmp", emit_jsrjmp, { "jmp" }, { MACRO_PIR, MACRO_EXP, MACRO_EOA, MACRO_PIR, MACRO_EOA, MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_EXP, MACRO_EOA } }, - { "ret", emit_retjcr, "ret", + { "ret", emit_retjcr, { "ret" }, { MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_IR, MACRO_EOA, MACRO_PIR, MACRO_EXP, MACRO_EOA, MACRO_PIR, MACRO_EOA, MACRO_EXP, MACRO_EOA, MACRO_EOA } }, - { "jcr", emit_retjcr, "jcr", + { "jcr", emit_retjcr, { "jcr" }, { MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_IR, MACRO_EOA, MACRO_PIR, MACRO_EXP, MACRO_EOA, MACRO_PIR, MACRO_EOA, MACRO_EXP, MACRO_EOA, MACRO_EOA } }, - { "jsr_coroutine", emit_retjcr, "jcr", + { "jsr_coroutine", emit_retjcr, { "jcr" }, { MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_IR, MACRO_EOA, MACRO_PIR, MACRO_EXP, MACRO_EOA, @@ -3195,7 +3171,7 @@ find_macro_match (const struct alpha_macro *first_macro, do { - const enum alpha_macro_arg *arg = macro->argsets; + const alpha_macro_argset *arg = macro->argsets; int tokidx = 0; while (*arg) @@ -3389,11 +3365,11 @@ add_to_link_pool (symbolS *sym, offsetT addend) if (seginfo->frchainP) for (fixp = seginfo->frchainP->fix_root; - fixp != (fixS *) NULL; + fixp != NULL; fixp = fixp->fx_next) { if (fixp->fx_addsy == sym - && fixp->fx_offset == (valueT)addend + && fixp->fx_offset == (valueT) addend && fixp->tc_fix_data.info && fixp->tc_fix_data.info->sym && symbol_symbolS (fixp->tc_fix_data.info->sym) @@ -3416,8 +3392,8 @@ add_to_link_pool (symbolS *sym, offsetT addend) expsym = make_expr_symbol (&e); /* Create a fixup for the entry. */ - fixp = fix_new - (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, BFD_RELOC_64); + fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, + sym, addend, 0, BFD_RELOC_64); fixp->tc_fix_data.info = get_alpha_reloc_tag (next_sequence_num--); fixp->tc_fix_data.info->sym = expsym; @@ -3552,7 +3528,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) symbolS *sec_symbol; segT current_seg = now_seg; subsegT current_subseg = now_subseg; - int cur_size; + offsetT cur_size; input_line_pointer++; SKIP_WHITESPACE (); @@ -3567,13 +3543,12 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) /* Reuse stab_string_size to store the size of the section. */ cur_size = seg_info (sec)->stabu.stab_string_size; - if ((int) size > cur_size) + if (size > cur_size) { - char *pfrag - = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL, - (valueT)size - (valueT)cur_size, NULL); + char *pfrag = frag_var (rs_fill, 1, 1, 0, NULL, + size - cur_size, NULL); *pfrag = 0; - seg_info (sec)->stabu.stab_string_size = (int)size; + seg_info (sec)->stabu.stab_string_size = size; } S_SET_SEGMENT (symbolP, sec); @@ -3598,8 +3573,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) record_alignment (bss_section, log_align); symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP, - size, NULL); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SEGMENT (symbolP, bss_section); @@ -4590,7 +4564,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) *(p + 3) = alpha_evax_proc->ra_save; break; case PDSC_S_K_KIND_FP_STACK: - md_number_to_chars (p + 2, (valueT) alpha_evax_proc->rsa_offset, 2); + md_number_to_chars (p + 2, alpha_evax_proc->rsa_offset, 2); break; default: /* impossible */ break; @@ -4600,7 +4574,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) *(p + 5) = alpha_evax_proc->type & 0x0f; /* Signature offset. */ - md_number_to_chars (p + 6, (valueT) 0, 2); + md_number_to_chars (p + 6, 0, 2); fix_new_exp (frag_now, p - frag_now->fr_literal + 8, 8, &exp, 0, BFD_RELOC_64); @@ -4610,8 +4584,8 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) /* pdesc+16: Size. */ p = frag_more (6); - md_number_to_chars (p, (valueT) alpha_evax_proc->framesize, 4); - md_number_to_chars (p + 4, (valueT) 0, 2); + md_number_to_chars (p, alpha_evax_proc->framesize, 4); + md_number_to_chars (p + 4, 0, 2); /* Entry length. */ exp.X_op = O_subtract; @@ -4868,7 +4842,7 @@ s_alpha_gprel32 (int ignore ATTRIBUTE_UNUSED) #endif if (alpha_auto_align_on && alpha_current_align < 2) - alpha_align (2, (char *) NULL, alpha_insn_label, 0); + alpha_align (2, NULL, alpha_insn_label, 0); if (alpha_current_align > 2) alpha_current_align = 2; alpha_insn_label = NULL; @@ -4911,7 +4885,7 @@ s_alpha_float_cons (int type) } if (alpha_auto_align_on && alpha_current_align < log_size) - alpha_align (log_size, (char *) NULL, alpha_insn_label, 0); + alpha_align (log_size, NULL, alpha_insn_label, 0); if (alpha_current_align > log_size) alpha_current_align = log_size; alpha_insn_label = NULL; @@ -5096,7 +5070,7 @@ alpha_cons_align (int size) ++log_size; if (alpha_auto_align_on && alpha_current_align < log_size) - alpha_align (log_size, (char *) NULL, alpha_insn_label, 0); + alpha_align (log_size, NULL, alpha_insn_label, 0); if (alpha_current_align > log_size) alpha_current_align = log_size; alpha_insn_label = NULL; @@ -5509,7 +5483,7 @@ md_begin (void) #ifdef OBJ_ELF if (ECOFF_DEBUGGING) { - segT sec = subseg_new (".mdebug", (subsegT) 0); + segT sec = subseg_new (".mdebug", 0); bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); bfd_set_section_alignment (sec, 3); } diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 30d6cb9..4c27c60 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -522,7 +522,7 @@ static unsigned cl_features = 0; #define ARC_RELOC_TABLE(op) \ (&arc_reloc_op[ ((!USER_RELOC_P (op)) \ ? (abort (), 0) \ - : (int) (op) - (int) O_gotoff) ]) + : (op) - O_gotoff) ]) #define DEF(NAME, RELOC, REQ) \ { #NAME, sizeof (#NAME)-1, O_##NAME, RELOC, REQ} @@ -778,7 +778,7 @@ arc_insert_opcode (const struct arc_opcode *opcode) static void arc_opcode_free (void *elt) { - string_tuple_t *tuple = (string_tuple_t *) elt; + string_tuple_t *tuple = elt; struct arc_opcode_hash_entry *entry = (void *) tuple->value; free (entry->opcode); free (entry); @@ -1444,7 +1444,7 @@ apply_fixups (struct arc_insn *insn, fragS *fragP, int fix) offset = insn->len; /* Some fixups are only used internally, thus no howto. */ - if ((int) fixup->reloc == 0) + if (fixup->reloc == 0) as_fatal (_("Unhandled reloc type")); if ((int) fixup->reloc < 0) @@ -1457,8 +1457,7 @@ apply_fixups (struct arc_insn *insn, fragS *fragP, int fix) else { reloc_howto_type *reloc_howto = - bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) fixup->reloc); + bfd_reloc_type_lookup (stdoutput, fixup->reloc); gas_assert (reloc_howto); /* FIXME! the reloc size is wrong in the BFD file. @@ -2768,7 +2767,7 @@ md_pcrel_from_section (fixS *fixP, pr_debug ("pcrel_from_section, fx_offset = %d\n", (int) fixP->fx_offset); - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (!S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { @@ -3660,7 +3659,7 @@ find_reloc (const char *name, if (!nflg) continue; found_flag = false; - unsigned * psflg = (unsigned *)r->flags; + const unsigned *psflg = r->flags; do { tmp = false; @@ -3918,7 +3917,7 @@ assemble_insn (const struct arc_opcode *opcode, for (argidx = opcode->operands; *argidx; ++argidx) { const struct arc_operand *operand = &arc_operands[*argidx]; - const expressionS *t = (const expressionS *) 0; + const expressionS *t = NULL; if (ARC_OPERAND_IS_FAKE (operand)) continue; @@ -4058,8 +4057,7 @@ assemble_insn (const struct arc_opcode *opcode, { /* sanity checks. */ reloc_howto_type *reloc_howto - = bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) reloc); + = bfd_reloc_type_lookup (stdoutput, reloc); unsigned reloc_bitsize = reloc_howto->bitsize; if (reloc_howto->rightshift) reloc_bitsize -= reloc_howto->rightshift; @@ -4083,8 +4081,7 @@ assemble_insn (const struct arc_opcode *opcode, else { reloc_howto_type *reloc_howto = - bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) fixup->reloc); + bfd_reloc_type_lookup (stdoutput, fixup->reloc); pcrel = reloc_howto->pc_relative; } fixup->pcrel = pcrel; @@ -4676,7 +4673,7 @@ arc_extinsn (int ignore ATTRIBUTE_UNUSED) as_warn ("%s", errmsg); /* Insert the extension instruction. */ - arc_insert_opcode ((const struct arc_opcode *) arc_ext_opcodes); + arc_insert_opcode (arc_ext_opcodes); create_extinst_section (&einsn); } @@ -4974,7 +4971,7 @@ arc_stralloc (char * s1, const char * s2) gas_assert (s2); len += strlen (s2) + 1; - p = (char *) xmalloc (len); + p = xmalloc (len); if (s1) { diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h index 145d955..65470f0 100644 --- a/gas/config/tc-arc.h +++ b/gas/config/tc-arc.h @@ -271,4 +271,4 @@ struct arc_relax_type extern void arc_md_end (void); #define md_end arc_md_end -#endif +#endif /* TC_ARC */ diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 13afe8d..99c07d4 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -3098,7 +3098,7 @@ find_real_start (symbolS * symbolP) if (S_IS_LOCAL (symbolP) || name[0] == '.') return symbolP; - real_start = concat (STUB_NAME, name, NULL); + real_start = concat (STUB_NAME, name, (const char *) NULL); new_target = symbol_find (real_start); free (real_start); @@ -3701,7 +3701,7 @@ symbol_locate (symbolS * symbolP, name_length = strlen (name) + 1; /* +1 for \0. */ obstack_grow (¬es, name, name_length); - preserved_copy_of_name = (char *) obstack_finish (¬es); + preserved_copy_of_name = obstack_finish (¬es); #ifdef tc_canonicalize_symbol_name preserved_copy_of_name = @@ -3844,9 +3844,8 @@ s_arm_elf_cons (int nbytes) emit_expr (&exp, (unsigned int) nbytes); else { - reloc_howto_type *howto = (reloc_howto_type *) - bfd_reloc_type_lookup (stdoutput, - (bfd_reloc_code_real_type) reloc); + reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, + reloc); int size = bfd_get_reloc_size (howto); if (reloc == BFD_RELOC_ARM_PLT32) @@ -22218,8 +22217,8 @@ fix_new_arm (fragS * frag, break; default: - new_fix = (fixS *) fix_new (frag, where, size, make_expr_symbol (exp), 0, - pc_rel, (enum bfd_reloc_code_real) reloc); + new_fix = fix_new (frag, where, size, make_expr_symbol (exp), 0, + pc_rel, reloc); break; } @@ -26039,14 +26038,13 @@ static valueT md_chars_to_number (char * buf, int n) { valueT result = 0; - unsigned char * where = (unsigned char *) buf; if (target_big_endian) { while (n--) { result <<= 8; - result |= (*where++ & 255); + result |= (*buf++ & 255); } } else @@ -26054,7 +26052,7 @@ md_chars_to_number (char * buf, int n) while (n--) { result <<= 8; - result |= (where[n] & 255); + result |= (buf[n] & 255); } } @@ -29803,10 +29801,6 @@ elf32_arm_target_format (void) return (target_big_endian ? "elf32-bigarm-vxworks" : "elf32-littlearm-vxworks"); -#elif defined (TE_NACL) - return (target_big_endian - ? "elf32-bigarm-nacl" - : "elf32-littlearm-nacl"); #else if (arm_fdpic) { @@ -29997,7 +29991,7 @@ arm_adjust_symtab (void) } /* Remove any overlapping mapping symbols generated by alignment frags. */ - bfd_map_over_sections (stdoutput, check_mapping_symbols, (char *) 0); + bfd_map_over_sections (stdoutput, check_mapping_symbols, NULL); /* Now do generic ELF adjustments. */ elf_adjust_symtab (); #endif diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index aa5f117..4148a6f 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -20,6 +20,7 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef TC_ARM #define TC_ARM 1 #ifndef TARGET_BYTES_BIG_ENDIAN @@ -377,3 +378,5 @@ extern bool arm_tc_equal_in_insn (int, char *); #define TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION) \ arm_is_largest_exponent_ok ((PRECISION)) int arm_is_largest_exponent_ok (int precision); + +#endif /* TC_ARM */ diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 650b736..671df82 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -1423,10 +1423,10 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) && AVR_SKIP_P (frag_now->tc_frag_data.prev_opcode)) as_warn (_("skipping two-word instruction")); - bfd_putl32 ((bfd_vma) bin, frag); + bfd_putl32 (bin, frag); } else - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); frag_now->tc_frag_data.prev_opcode = bin; *line = str; @@ -1440,7 +1440,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & (-1UL << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* If you define this macro, it should return the offset between the @@ -1452,7 +1452,7 @@ md_section_align (asection *seg, valueT addr) long md_pcrel_from_section (fixS *fixp, segT sec) { - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) return 0; @@ -1519,7 +1519,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) unsigned long insn; long value = *valP; - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; else if (fixP->fx_pcrel) @@ -1567,7 +1567,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) fixP->fx_subsy = NULL; } /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* For the DIFF relocs, write the value into the object file while still @@ -1588,10 +1588,10 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) *where = value; break; case BFD_RELOC_AVR_DIFF16: - bfd_putl16 ((bfd_vma) value, where); + bfd_putl16 (value, where); break; case BFD_RELOC_AVR_DIFF32: - bfd_putl32 ((bfd_vma) value, where); + bfd_putl32 (value, where); break; case BFD_RELOC_AVR_CALL: break; @@ -1619,7 +1619,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); value = (value << 3) & 0x3f8; - bfd_putl16 ((bfd_vma) (value | insn), where); + bfd_putl16 (value | insn, where); break; case BFD_RELOC_AVR_13_PCREL: @@ -1640,15 +1640,15 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) } value &= 0xfff; - bfd_putl16 ((bfd_vma) (value | insn), where); + bfd_putl16 (value | insn, where); break; case BFD_RELOC_32: - bfd_putl32 ((bfd_vma) value, where); + bfd_putl32 (value, where); break; case BFD_RELOC_16: - bfd_putl16 ((bfd_vma) value, where); + bfd_putl16 (value, where); break; case BFD_RELOC_8: @@ -1659,14 +1659,14 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) break; case BFD_RELOC_AVR_16_PM: - bfd_putl16 ((bfd_vma) (value >> 1), where); + bfd_putl16 (value >> 1, where); break; case BFD_RELOC_AVR_LDI: if (value > 255) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value), where); break; case BFD_RELOC_AVR_LDS_STS_16: @@ -1675,78 +1675,78 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) _("operand out of range: 0x%lx"), (unsigned long)value); insn |= ((value & 0xF) | ((value & 0x30) << 5) | ((value & 0x40) << 2)); - bfd_putl16 ((bfd_vma) insn, where); + bfd_putl16 (insn, where); break; case BFD_RELOC_AVR_6: if ((value > 63) || (value < 0)) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); - bfd_putl16 ((bfd_vma) insn | ((value & 7) | ((value & (3 << 3)) << 7) - | ((value & (1 << 5)) << 8)), where); + bfd_putl16 (insn | ((value & 7) | ((value & (3 << 3)) << 7) + | ((value & (1 << 5)) << 8)), where); break; case BFD_RELOC_AVR_6_ADIW: if ((value > 63) || (value < 0)) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); - bfd_putl16 ((bfd_vma) insn | (value & 0xf) | ((value & 0x30) << 2), where); + bfd_putl16 (insn | (value & 0xf) | ((value & 0x30) << 2), where); break; case BFD_RELOC_AVR_LO8_LDI: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value), where); break; case BFD_RELOC_AVR_HI8_LDI: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 8), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 8), where); break; case BFD_RELOC_AVR_MS8_LDI: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 24), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 24), where); break; case BFD_RELOC_AVR_HH8_LDI: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 16), where); break; case BFD_RELOC_AVR_LO8_LDI_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value), where); break; case BFD_RELOC_AVR_HI8_LDI_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 8), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 8), where); break; case BFD_RELOC_AVR_MS8_LDI_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 24), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 24), where); break; case BFD_RELOC_AVR_HH8_LDI_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 16), where); break; case BFD_RELOC_AVR_LO8_LDI_PM: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 1), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 1), where); break; case BFD_RELOC_AVR_HI8_LDI_PM: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 9), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 9), where); break; case BFD_RELOC_AVR_HH8_LDI_PM: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 17), where); + bfd_putl16 (insn | LDI_IMMEDIATE (value >> 17), where); break; case BFD_RELOC_AVR_LO8_LDI_PM_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 1), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 1), where); break; case BFD_RELOC_AVR_HI8_LDI_PM_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 9), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 9), where); break; case BFD_RELOC_AVR_HH8_LDI_PM_NEG: - bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 17), where); + bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 17), where); break; case BFD_RELOC_AVR_CALL: @@ -1759,8 +1759,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) _("odd address operand: %ld"), value); value >>= 1; x |= ((value & 0x10000) | ((value << 3) & 0x1f00000)) >> 16; - bfd_putl16 ((bfd_vma) x, where); - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2); + bfd_putl16 (x, where); + bfd_putl16 (value & 0xffff, where + 2); } break; @@ -1785,14 +1785,14 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) if (value > 63) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); - bfd_putl16 ((bfd_vma) insn | ((value & 0x30) << 5) | (value & 0x0f), where); + bfd_putl16 (insn | ((value & 0x30) << 5) | (value & 0x0f), where); break; case BFD_RELOC_AVR_PORT5: if (value > 31) as_bad_where (fixP->fx_file, fixP->fx_line, _("operand out of range: %ld"), value); - bfd_putl16 ((bfd_vma) insn | ((value & 0x1f) << 3), where); + bfd_putl16 (insn | ((value & 0x1f) << 3), where); break; } } @@ -1856,7 +1856,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, reloc->howto = bfd_reloc_type_lookup (stdoutput, code); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _("reloc %d not supported by object file format"), @@ -2190,8 +2190,7 @@ avr_output_property_record (char * const frag_base, char *frag_ptr, fix->fx_line = 0; frag_ptr += 4; - md_number_to_chars (frag_ptr, (bfd_byte) record->type, 1); - frag_ptr += 1; + *frag_ptr++ = record->type & 0xff; /* Write out the rest of the data. */ switch (record->type) @@ -2546,7 +2545,7 @@ avr_emit_insn (const char *insn, int reg, char **pwhere) || 0 == strcmp ("mov", op->name) || 0 == strcmp ("ldi", op->name)); - bfd_putl16 ((bfd_vma) bin, *pwhere); + bfd_putl16 (bin, *pwhere); (*pwhere) += 2 * op->insn_size; } diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 5b1db29..0a635f4 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -52,7 +52,7 @@ FILE *errorf; #endif static flagword bfin_flags = DEFAULT_FLAGS | DEFAULT_FDPIC; -static const char *bfin_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0; +static const char *bfin_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : NULL; /* Blackfin specific function to handle FD-PIC pointer initializations. */ @@ -614,7 +614,7 @@ md_operand (expressionS * expressionP) symbolS * md_undefined_symbol (char *name ATTRIBUTE_UNUSED) { - return (symbolS *) 0; + return NULL; } int @@ -806,7 +806,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) reloc->addend = fixp->fx_offset; reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, /* xgettext:c-format. */ @@ -824,7 +824,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (!S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { @@ -937,7 +937,7 @@ Expr_Node_Create (Expr_Node_Type type, { - Expr_Node *node = (Expr_Node *) allocate (sizeof (Expr_Node)); + Expr_Node *node = allocate (sizeof (Expr_Node)); node->type = type; node->value = value; node->Left_Child = Left_Child; @@ -1857,8 +1857,8 @@ bfin_gen_loop (Expr_Node *exp, REG_T reg, int rop, REG_T preg) symbolS *sym; loopsym = exp->value.s_value; - lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5); - lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5); + lbeginsym = xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5); + lendsym = xmalloc (strlen (loopsym) + strlen ("__END") + 5); lbeginsym[0] = 0; lendsym[0] = 0; @@ -1902,7 +1902,7 @@ bfin_loop_beginend (Expr_Node *exp, int begin) const char *suffix = begin ? "__BEGIN" : "__END"; loopsym = exp->value.s_value; - label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5); + label_name = xmalloc (strlen (loopsym) + strlen (suffix) + 5); label_name[0] = 0; diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c index 84eab3f..fd77c6f 100644 --- a/gas/config/tc-bpf.c +++ b/gas/config/tc-bpf.c @@ -315,7 +315,7 @@ immediate_overflow (int64_t value, unsigned bits) long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || (S_GET_SEGMENT (fixP->fx_addsy) != sec) || S_IS_EXTERNAL (fixP->fx_addsy) @@ -362,7 +362,7 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixP) reloc->howto = bfd_reloc_type_lookup (stdoutput, r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixP->fx_file, fixP->fx_line, _("relocation is not supported")); @@ -516,17 +516,6 @@ encode_int32 (int32_t value, char *buffer) } } -/* Write a BPF instruction to BUF. */ - -static void -write_insn_bytes (bfd_byte *buf, char *bytes) -{ - int i; - - for (i = 0; i < 8; ++i) - md_number_to_chars ((char *) buf + i, (valueT) bytes[i], 1); -} - /* *FRAGP has been relaxed to its final size, and now needs to have the bytes inside it modified to conform to the new size. @@ -625,13 +614,14 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, { /* 16-bit disp is known and not in range. Turn the JA into a JAL with a 32-bit displacement. */ - char bytes[8] = {0}; - - bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff; - bytes[1] = (word >> 48) & 0xff; - bytes[2] = 0; /* disp16 high */ - bytes[3] = 0; /* disp16 lo */ - write_insn_bytes (buf, bytes); + buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff; + buf[1] = (word >> 48) & 0xff; + buf[2] = 0; /* disp16 high */ + buf[3] = 0; /* disp16 lo */ + buf[4] = 0; + buf[5] = 0; + buf[6] = 0; + buf[7] = 0; /* Install fixup for the JAL. */ reloc_howto_type *reloc_howto @@ -713,8 +703,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, /* 16-bit disp is known and not in range. Turn the JXX into a sequence JXX +1; JA +1; JAL d32. */ - char bytes[8]; - /* First, set the 16-bit offset in the current instruction to 1. */ @@ -726,24 +714,25 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, /* Then, write the JA + 1 */ - bytes[0] = 0x05; /* JA */ - bytes[1] = 0x0; - encode_int16 (1, bytes + 2); - bytes[4] = 0x0; - bytes[5] = 0x0; - bytes[6] = 0x0; - bytes[7] = 0x0; - write_insn_bytes (buf, bytes); + buf[0] = 0x05; /* JA */ + buf[1] = 0x0; + encode_int16 (1, (char *) buf + 2); + buf[4] = 0x0; + buf[5] = 0x0; + buf[6] = 0x0; + buf[7] = 0x0; buf += 8; /* Finally, write the JAL to the target. */ - bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff; - bytes[1] = 0; - bytes[2] = 0; - bytes[3] = 0; - encode_int32 ((int32_t) 0, bytes + 4); - write_insn_bytes (buf, bytes); + buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff; + buf[1] = 0; + buf[2] = 0; + buf[3] = 0; + buf[4] = 0; + buf[5] = 0; + buf[6] = 0; + buf[7] = 0; /* Install fixup for the JAL. */ reloc_howto_type *reloc_howto @@ -848,7 +837,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) break; } - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; if (fixP->fx_done) @@ -870,14 +859,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) md_number_to_chars (where, *valP, 8); break; case BFD_RELOC_BPF_DISP16: - md_number_to_chars (where + 2, (uint16_t) *valP, 2); + md_number_to_chars (where + 2, *valP, 2); break; case BFD_RELOC_BPF_DISP32: case BFD_RELOC_BPF_DISPCALL32: - md_number_to_chars (where + 4, (uint32_t) *valP, 4); + md_number_to_chars (where + 4, *valP, 4); break; case BFD_RELOC_16_PCREL: - md_number_to_chars (where + 2, (uint32_t) *valP, 2); + md_number_to_chars (where + 2, *valP, 2); break; default: as_bad_where (fixP->fx_file, fixP->fx_line, @@ -1195,13 +1184,11 @@ add_fixed_insn (struct bpf_insn *insn) { char *this_frag = frag_more (insn->size); char bytes[16]; - int i; /* First encode the known parts of the instruction, including opcodes and constant immediates, and write them to the frag. */ encode_insn (insn, bytes, 0 /* relax */); - for (i = 0; i < insn->size; ++i) - md_number_to_chars (this_frag + i, (valueT) bytes[i], 1); + memcpy (this_frag, bytes, insn->size); /* Now install the instruction fixups. */ install_insn_fixups (insn, frag_now, @@ -1214,7 +1201,6 @@ static void add_relaxed_insn (struct bpf_insn *insn, expressionS *exp) { char bytes[16]; - int i; char *this_frag; unsigned worst_case = relaxed_branch_length (NULL, NULL, 0); unsigned best_case = insn->size; @@ -1231,8 +1217,7 @@ add_relaxed_insn (struct bpf_insn *insn, expressionS *exp) /* First encode the known parts of the instruction, including opcodes and constant immediates, and write them to the frag. */ encode_insn (insn, bytes, 1 /* relax */); - for (i = 0; i < insn->size; ++i) - md_number_to_chars (this_frag + i, (valueT) bytes[i], 1); + memcpy (this_frag, bytes, insn->size); /* Note that instruction fixups will be applied once the frag is relaxed, in md_convert_frag. */ diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 62a7deb..f2d1108 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts); static void l_cons (int nbytes) { - int c; expressionS exp; #ifdef md_flush_pending_output @@ -141,7 +140,6 @@ l_cons (int nbytes) md_cons_align (nbytes); #endif - c = 0; do { unsigned int bits_available = BITS_PER_CHAR * nbytes; @@ -235,8 +233,7 @@ l_cons (int nbytes) if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c')) code_label = 1; - emit_expr (&exp, (unsigned int) nbytes); - ++c; + emit_expr (&exp, nbytes); if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c')) { input_line_pointer +=3; @@ -636,15 +633,15 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg) } void -md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, fragS *fragP) +md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + fragS *fragP) { /* 'opcode' points to the start of the instruction, whether we need to change the instruction's fixed encoding. */ char *opcode = &fragP->fr_literal[0] + fragP->fr_fix; bfd_reloc_code_real_type reloc; - subseg_change (sec, 0); - switch (fragP->fr_subtype) { case 0: @@ -760,7 +757,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) switch (fixP->fx_r_type) { case BFD_RELOC_CR16_NUM8: - bfd_put_8 (stdoutput, (unsigned char) val, buf); + bfd_put_8 (stdoutput, val, buf); break; case BFD_RELOC_CR16_NUM16: bfd_put_16 (stdoutput, val, buf); @@ -2456,7 +2453,7 @@ print_insn (ins *insn) /* Write the instruction encoding to frag. */ for (i = 0; i < insn_size; i++) { - md_number_to_chars (this_frag, (valueT) words[i], 2); + md_number_to_chars (this_frag, words[i], 2); this_frag += 2; } } @@ -2514,7 +2511,7 @@ md_assemble (char *op) strcpy (param1, get_b_cc (op)); strcat (param1,","); strcat (param1, param); - param = (char *) ¶m1; + param = param1; cr16_assemble ("b", param); return; } diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c index 5780386..ed91d06 100644 --- a/gas/config/tc-cris.c +++ b/gas/config/tc-cris.c @@ -877,7 +877,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, case ENCODE_RELAX (STATE_COND_BRANCH, STATE_DWORD): gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP, - fragP->fr_symbol, (symbolS *) NULL, + fragP->fr_symbol, NULL, fragP->fr_offset); /* Ten bytes added: a branch, nop and a jump. */ var_part_size = 2 + 2 + 4 + 2; @@ -885,7 +885,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, case ENCODE_RELAX (STATE_COND_BRANCH_PIC, STATE_DWORD): gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP, - fragP->fr_symbol, (symbolS *) NULL, + fragP->fr_symbol, NULL, fragP->fr_offset); /* Twelve bytes added: a branch, nop and a pic-branch-32. */ var_part_size = 2 + 2 + 4 + 2 + 2; @@ -893,7 +893,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, case ENCODE_RELAX (STATE_COND_BRANCH_V32, STATE_DWORD): gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP, - fragP->fr_symbol, (symbolS *) NULL, + fragP->fr_symbol, NULL, fragP->fr_offset); /* Twelve bytes added: a branch, nop and another branch and nop. */ var_part_size = 2 + 2 + 2 + 4 + 2; @@ -1274,7 +1274,7 @@ md_assemble (char *str) opcodep = cris_insn_first_word_frag (); /* Output the prefix opcode. */ - md_number_to_chars (opcodep, (long) prefix.opcode, 2); + md_number_to_chars (opcodep, prefix.opcode, 2); /* Having a specified reloc only happens for DIP and for BDAP with PIC or TLS operands, but it is ok to drop through here for the other @@ -1324,7 +1324,7 @@ md_assemble (char *str) opcodep = frag_more (2); /* Output the instruction opcode. */ - md_number_to_chars (opcodep, (long) (output_instruction.opcode), 2); + md_number_to_chars (opcodep, output_instruction.opcode, 2); /* Output the symbol-dependent instruction stuff. */ if (output_instruction.insn_type == CRIS_INSN_BRANCH) @@ -1392,8 +1392,7 @@ md_assemble (char *str) ? 12 : 10); gen_cond_branch_32 (opcodep, cond_jump, frag_now, - output_instruction.expr.X_add_symbol, - (symbolS *) NULL, + output_instruction.expr.X_add_symbol, NULL, output_instruction.expr.X_add_number); } } @@ -4047,7 +4046,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) fixP->fx_done = 1; /* We can't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* This operand-type is scaled. */ diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c index fffd3f1..e519214 100644 --- a/gas/config/tc-crx.c +++ b/gas/config/tc-crx.c @@ -325,7 +325,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP) gas_assert ((int) fixP->fx_r_type > 0); reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixP->fx_file, fixP->fx_line, _("internal error: reloc %d (`%s') not supported by object file format"), @@ -368,15 +368,15 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg) } void -md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, fragS *fragP) +md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + fragS *fragP) { /* 'opcode' points to the start of the instruction, whether we need to change the instruction's fixed encoding. */ char *opcode = &fragP->fr_literal[0] + fragP->fr_fix; bfd_reloc_code_real_type reloc; - subseg_change (sec, 0); - switch (fragP->fr_subtype) { case 0: @@ -456,7 +456,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) switch (fixP->fx_r_type) { case BFD_RELOC_CRX_NUM8: - bfd_put_8 (stdoutput, (unsigned char) val, buf); + bfd_put_8 (stdoutput, val, buf); break; case BFD_RELOC_CRX_NUM16: bfd_put_16 (stdoutput, val, buf); @@ -569,8 +569,8 @@ process_label_constant (char *str, ins * crx_ins) str); crx_ins->exp.X_op = O_constant; crx_ins->exp.X_add_number = 0; - crx_ins->exp.X_add_symbol = (symbolS *) 0; - crx_ins->exp.X_op_symbol = (symbolS *) 0; + crx_ins->exp.X_add_symbol = NULL; + crx_ins->exp.X_op_symbol = NULL; /* Fall through. */ case O_constant: @@ -1907,7 +1907,7 @@ print_insn (ins *insn) /* Write the instruction encoding to frag. */ for (i = 0; i < insn_size; i++) { - md_number_to_chars (this_frag, (valueT) words[i], 2); + md_number_to_chars (this_frag, words[i], 2); this_frag += 2; } } diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index beb46fa..dc8ee74 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -1950,11 +1950,11 @@ mapping_state (map_state state) { struct frag * const frag_first = seg_info (now_seg)->frchainP->frch_root; if (frag_now != frag_first || frag_now_fix () > 0) - make_mapping_symbol (MAP_DATA, (valueT) 0, frag_first); + make_mapping_symbol (MAP_DATA, 0, frag_first); } seg_info (now_seg)->tc_segment_info_data.current_state = state; - make_mapping_symbol (state, (valueT) frag_now_fix (), frag_now); + make_mapping_symbol (state, frag_now_fix (), frag_now); } /* Dump the literal pool. */ @@ -5269,7 +5269,7 @@ md_pcrel_from_section (fixS * fixP, segT seg) { /* If the symbol is undefined or defined in another section we leave the add number alone for the linker to fix it later. */ - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != seg)) return fixP->fx_size; @@ -5320,7 +5320,7 @@ csky_cons_fix_new (fragS *frag, reloc = BFD_RELOC_32; break; } - fixP = fix_new_exp (frag, off, (int) len, exp, 0, reloc); + fixP = fix_new_exp (frag, off, len, exp, 0, reloc); if (BFD_RELOC_CKCORE_TLS_IE32 == insn_reloc || BFD_RELOC_CKCORE_TLS_GD32 == insn_reloc || BFD_RELOC_CKCORE_TLS_LDM32 == insn_reloc) @@ -5596,25 +5596,25 @@ md_apply_fix (fixS *fixP, case BFD_RELOC_CKCORE_PCREL_IMM8BY4: case BFD_RELOC_CKCORE_PCREL_IMM10BY4: case BFD_RELOC_CKCORE_PCREL_IMM16BY4: - max = (offsetT) howto->dst_mask; + max = howto->dst_mask; min = 0; break; /* lrw16. */ case BFD_RELOC_CKCORE_PCREL_IMM7BY4: if (do_extend_lrw) - max = (offsetT)((1 << (howto->bitsize + 1)) - 2); + max = ((valueT) 1 << (howto->bitsize + 1)) - 2; else - max = (offsetT)((1 << howto->bitsize) - 1); + max = ((valueT) 1 << howto->bitsize) - 1; min = 0; break; /* flrws, flrwd: the offset bits are divided in two parts. */ case BFD_RELOC_CKCORE_PCREL_FLRW_IMM8BY4: - max = (offsetT)((1 << howto->bitsize) - 1); + max = ((valueT) 1 << howto->bitsize) - 1; min = 0; break; /* Offset is signed. */ default: - max = (offsetT)(howto->dst_mask >> 1); + max = howto->dst_mask >> 1; min = - max - 1; issigned = 1; } @@ -5630,7 +5630,7 @@ md_apply_fix (fixS *fixP, if (do_extend_lrw && (opcode & 0xfc00) == CSKYV2_INST_LRW16) val &= 0xff; else - val &= issigned ? (offsetT)(howto->dst_mask) : max; + val &= issigned ? (offsetT) howto->dst_mask : max; if (fixP->fx_r_type == BFD_RELOC_CKCORE_PCREL_BLOOP_IMM4BY4) val = (val & 0xf) << 12; @@ -7689,7 +7689,7 @@ csky_cons (int nbytes) howto->name, nbytes); else { - register char *p = frag_more ((int) nbytes); + register char *p = frag_more (nbytes); int offset = nbytes - size; fix_new_exp (frag_now, @@ -7698,7 +7698,7 @@ csky_cons (int nbytes) } } else - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); if (now_seg == text_section) poolspan += nbytes; } @@ -7861,8 +7861,7 @@ static void csky_stack_size (int arg ATTRIBUTE_UNUSED) { expressionS exp; - stack_size_entry *sse - = (stack_size_entry *) xcalloc (1, sizeof (stack_size_entry)); + stack_size_entry *sse = xcalloc (1, sizeof (stack_size_entry)); expression (&exp); if (exp.X_op == O_symbol) diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h index 7e32347..d391084 100644 --- a/gas/config/tc-csky.h +++ b/gas/config/tc-csky.h @@ -106,4 +106,4 @@ extern long csky_relax_frag (segT, fragS *, long); const char * elf32_csky_target_format (void); #endif -#endif +#endif /* TC_CSKY */ diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index b10cdff..98d5e8b 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -275,7 +275,7 @@ void md_begin (void) { const char *prev_name = ""; - struct d10v_opcode *opcode; + const struct d10v_opcode *opcode; d10v_hash = str_htab_create (); /* Insert unique names into hash table. The D10v instruction set @@ -283,11 +283,11 @@ md_begin (void) on the operands. This hash table then provides a quick index to the first opcode with a particular name in the opcode table. */ - for (opcode = (struct d10v_opcode *) d10v_opcodes; opcode->name; opcode++) + for (opcode = d10v_opcodes; opcode->name; opcode++) { if (strcmp (prev_name, opcode->name)) { - prev_name = (char *) opcode->name; + prev_name = opcode->name; str_hash_insert (d10v_hash, opcode->name, opcode, 0); } } @@ -325,7 +325,7 @@ postfix (char *p) } static bfd_reloc_code_real_type -get_reloc (struct d10v_operand *op) +get_reloc (const struct d10v_operand *op) { int bits = op->bits; @@ -564,7 +564,7 @@ build_insn (struct d10v_opcode *opcode, else { fixups->fix[fixups->fc].reloc = - get_reloc ((struct d10v_operand *) &d10v_operands[opcode->operands[i]]); + get_reloc (&d10v_operands[opcode->operands[i]]); /* Check that an immediate was passed to ops that expect one. */ if ((flags & OPERAND_NUM) @@ -1454,7 +1454,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _("reloc %d not supported by object file format"), @@ -1481,7 +1481,7 @@ md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS *fixp, segT sec) { - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) return 0; @@ -1497,11 +1497,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) int op_type; int left = 0; - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); op_type = fixP->fx_r_type; @@ -1521,13 +1521,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } else fixP->fx_r_type = - get_reloc ((struct d10v_operand *) &d10v_operands[op_type]); + get_reloc (&d10v_operands[op_type]); } /* Fetch the instruction, insert the fully resolved operand value, and stuff the instruction back again. */ where = fixP->fx_frag->fr_literal + fixP->fx_where; - insn = bfd_getb32 ((unsigned char *) where); + insn = bfd_getb32 (where); switch (fixP->fx_r_type) { @@ -1551,7 +1551,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) /* Instruction addresses are always right-shifted by 2. */ value >>= AT_WORD_RIGHT_SHIFT; if (fixP->fx_size == 2) - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); else { struct d10v_opcode *rep, *repi; @@ -1569,14 +1569,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) fixP->fx_line); insn = d10v_insert_operand (insn, op_type, (offsetT) value, left, fixP); - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); } break; case BFD_RELOC_32: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (value, where); break; case BFD_RELOC_16: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); break; case BFD_RELOC_8: *where = value; diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 76827d5..bfa4adf 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -306,11 +306,11 @@ md_section_align (asection *seg, valueT addr) void md_begin (void) { - struct d30v_opcode *opcode; + const struct d30v_opcode *opcode; d30v_hash = str_htab_create (); /* Insert opcode names into a hash table. */ - for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++) + for (opcode = d30v_opcode_table; opcode->name; opcode++) str_hash_insert (d30v_hash, opcode->name, opcode, 0); fixups = &FixUps[0]; @@ -484,8 +484,8 @@ build_insn (struct d30v_insn *opcode, expressionS *opers) int i, bits, shift, flags; unsigned long number, id = 0; long long insn; - struct d30v_opcode *op = opcode->op; - struct d30v_format *form = opcode->form; + const struct d30v_opcode *op = opcode->op; + const struct d30v_format *form = opcode->form; insn = opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18; @@ -682,8 +682,8 @@ parallel_ok (struct d30v_insn *op1, int i, j, shift, regno, bits, ecc; unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2; unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2]; - struct d30v_format *f; - struct d30v_opcode *op; + const struct d30v_format *f; + const struct d30v_opcode *op; /* Section 4.3: Both instructions must not be IU or MU only. */ if ((op1->op->unit == IU && op2->op->unit == IU) @@ -1122,14 +1122,14 @@ write_2_short (struct d30v_insn *opcode1, It must look at all formats for an opcode and use the operands to choose the correct one. Return NULL on error. */ -static struct d30v_format * -find_format (struct d30v_opcode *opcode, +static const struct d30v_format * +find_format (const struct d30v_opcode *opcode, expressionS myops[], int fsize, int cmp_hack) { int match, opcode_index, i = 0, j, k; - struct d30v_format *fm; + const struct d30v_format *fm; if (opcode == NULL) return NULL; @@ -1145,7 +1145,7 @@ find_format (struct d30v_opcode *opcode, if (fsize == FORCE_LONG && opcode_index < LONG) continue; - fm = (struct d30v_format *) &d30v_format_table[opcode_index]; + fm = &d30v_format_table[opcode_index]; k = opcode_index; while (fm->form == opcode_index) { @@ -1266,7 +1266,7 @@ find_format (struct d30v_opcode *opcode, return fm; } - fm = (struct d30v_format *) &d30v_format_table[++k]; + fm = &d30v_format_table[++k]; } } return NULL; @@ -1339,7 +1339,7 @@ do_assemble (char *str, if (startswith (name, "cmp")) { int p, i; - char **d30v_str = (char **) d30v_cc_names; + const char **d30v_str = d30v_cc_names; if (name[3] == 'u') p = 4; @@ -1785,7 +1785,7 @@ md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS *fixp, segT sec) { - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) return 0; @@ -1888,7 +1888,7 @@ d30v_cons_align (int size) ++log_size; if (d30v_current_align < log_size) - d30v_align (log_size, (char *) NULL, NULL); + d30v_align (log_size, NULL, NULL); else if (d30v_current_align > log_size) d30v_current_align = log_size; d30v_last_label = NULL; @@ -1901,37 +1901,37 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) unsigned long insn, insn2; long value = *valP; - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* Fetch the instruction, insert the fully resolved operand value, and stuff the instruction back again. */ where = fixP->fx_frag->fr_literal + fixP->fx_where; - insn = bfd_getb32 ((unsigned char *) where); + insn = bfd_getb32 (where); switch (fixP->fx_r_type) { case BFD_RELOC_8: - *(unsigned char *) where = value; + *where = value; break; case BFD_RELOC_16: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); break; case BFD_RELOC_64: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); - bfd_putb32 (0, ((unsigned char *) where) + 4); + bfd_putb32 (value, where); + bfd_putb32 (0, where + 4); break; case BFD_RELOC_D30V_6: check_size (value, 6, fixP->fx_file, fixP->fx_line); insn |= value & 0x3F; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_9_PCREL: @@ -1944,13 +1944,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } check_size (value, 9, fixP->fx_file, fixP->fx_line); insn |= ((value >> 3) & 0x3F) << 12; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_15: check_size (value, 15, fixP->fx_file, fixP->fx_line); insn |= (value >> 3) & 0xFFF; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_15_PCREL: @@ -1963,13 +1963,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } check_size (value, 15, fixP->fx_file, fixP->fx_line); insn |= (value >> 3) & 0xFFF; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_21: check_size (value, 21, fixP->fx_file, fixP->fx_line); insn |= (value >> 3) & 0x3FFFF; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_21_PCREL: @@ -1982,29 +1982,29 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } check_size (value, 21, fixP->fx_file, fixP->fx_line); insn |= (value >> 3) & 0x3FFFF; - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); break; case BFD_RELOC_D30V_32: - insn2 = bfd_getb32 ((unsigned char *) where + 4); + insn2 = bfd_getb32 (where + 4); insn |= (value >> 26) & 0x3F; /* Top 6 bits. */ insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */ insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */ - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); - bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4); + bfd_putb32 (insn, where); + bfd_putb32 (insn2, where + 4); break; case BFD_RELOC_D30V_32_PCREL: - insn2 = bfd_getb32 ((unsigned char *) where + 4); + insn2 = bfd_getb32 (where + 4); insn |= (value >> 26) & 0x3F; /* Top 6 bits. */ insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */ insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */ - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); - bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4); + bfd_putb32 (insn, where); + bfd_putb32 (insn2, where + 4); break; case BFD_RELOC_32: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (value, where); break; default: diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c index abb283d..69c8f49 100644 --- a/gas/config/tc-dlx.c +++ b/gas/config/tc-dlx.c @@ -187,7 +187,7 @@ is_ldst_registers (char *name) /* The first character of the register name got to be either %, $, r of R. */ if ((ptr[0] == '%' || ptr[0] == '$' || ptr[0] == 'r' || ptr[0] == 'R') - && ISDIGIT ((unsigned char) ptr[1])) + && ISDIGIT (ptr[1])) return 1; /* Now check the software register representation. */ @@ -539,7 +539,7 @@ static char * fix_ld_st_operand (unsigned long opcode, char* str) { /* Check the opcode. */ - switch ((int) opcode) + switch (opcode) { case LBOP: case LBUOP: @@ -616,7 +616,7 @@ parse_operand (char *s, expressionS *operandp) /* Check for the % and $ register representation */ if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R') - && ISDIGIT ((unsigned char) s[1])) + && ISDIGIT (s[1])) { /* We have a numeric register expression. No biggy. */ s += 1; @@ -1124,7 +1124,7 @@ md_operand (expressionS* expressionP) { /* Check for the #number representation */ if (input_line_pointer[0] == '#' && - ISDIGIT ((unsigned char) input_line_pointer[1])) + ISDIGIT (input_line_pointer[1])) { /* We have a numeric number expression. No biggy. */ input_line_pointer += 1; /* Skip # */ diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 4a027e9..be23d15 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -154,7 +154,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } @@ -248,10 +248,10 @@ epiphany_PIC_related_p (symbolS *sym) void epiphany_apply_fix (fixS *fixP, valueT *valP, segT seg) { - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; - if (((int) fixP->fx_r_type < (int) BFD_RELOC_UNUSED) + if ((fixP->fx_r_type < BFD_RELOC_UNUSED) && fixP->fx_done) { /* Install EPIPHANY-dependent relocations HERE because nobody else @@ -942,7 +942,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, fixP->fx_r_type = fixP->fx_cgen.opinfo; } - md_number_to_chars (displacement, (valueT) addend, extension + 1); + md_number_to_chars (displacement, addend, extension + 1); fragP->fr_fix += (extension & -2); /* 0,2 or 4 bytes added. */ } @@ -956,7 +956,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (!S_IS_DEFINED (fixP->fx_addsy) || (S_GET_SEGMENT (fixP->fx_addsy) != sec) || S_IS_EXTERNAL (fixP->fx_addsy) @@ -1025,10 +1025,10 @@ epiphany_fix_adjustable (fixS *fixP) { bfd_reloc_code_real_type reloc_type; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = fixP->fx_cgen.insn; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (gas_cgen_cpu_desc, opindex); diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 2b135f4..e120ca5 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -156,7 +156,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -272,7 +272,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS * fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) /* The symbol is undefined (or is defined but not in this section). diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 2c33c90..900fb4a 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -175,7 +175,7 @@ static flagword frv_flags = DEFAULT_FLAGS | DEFAULT_FDPIC; static int frv_user_set_flags_p = 0; static int frv_pic_p = 0; -static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0; +static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : NULL; /* Print tomcat-specific debugging info. */ static int tomcat_debug = 0; @@ -1226,7 +1226,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -1311,7 +1311,7 @@ long md_pcrel_from_section (fixS *fixP, segT sec) { if (TC_FORCE_RELOCATION (fixP) - || (fixP->fx_addsy != (symbolS *) NULL + || (fixP->fx_addsy != NULL && S_GET_SEGMENT (fixP->fx_addsy) != sec)) { /* If we can't adjust this relocation, or if it references a @@ -1523,10 +1523,10 @@ frv_fix_adjustable (fixS *fixP) { bfd_reloc_code_real_type reloc_type; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); } @@ -1705,7 +1705,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) } else { - opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED; + opindex = fixp->fx_r_type - BFD_RELOC_UNUSED; operand = cgen_operand_lookup_by_num (cd, opindex); reloc = md_cgen_lookup_reloc (insn, operand, fixp); } @@ -1790,7 +1790,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) void frv_frob_file (void) { - bfd_map_over_sections (stdoutput, frv_frob_file_section, (void *) 0); + bfd_map_over_sections (stdoutput, frv_frob_file_section, NULL); } void diff --git a/gas/config/tc-ft32.c b/gas/config/tc-ft32.c index 83d3e1f..7e68e83 100644 --- a/gas/config/tc-ft32.c +++ b/gas/config/tc-ft32.c @@ -530,12 +530,11 @@ static valueT md_chars_to_number (char * buf, int n) { valueT result = 0; - unsigned char * where = (unsigned char *) buf; while (n--) { result <<= 8; - result |= (where[n] & 255); + result |= (buf[n] & 255); } return result; @@ -581,7 +580,7 @@ md_apply_fix (fixS *fixP ATTRIBUTE_UNUSED, } /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); switch (fixP->fx_r_type) diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 12456b2..d7bb329 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -2223,7 +2223,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & (-1U << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } void diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 5018dfc..744613f 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1200,7 +1200,7 @@ fix_new_hppa (fragS *frag, new_fix = fix_new_exp (frag, where, size, exp, pcrel, r_type); else new_fix = fix_new (frag, where, size, add_symbol, offset, pcrel, r_type); - new_fix->tc_fix_data = (void *) hppa_fix; + new_fix->tc_fix_data = hppa_fix; hppa_fix->fx_r_type = r_type; hppa_fix->fx_r_field = r_field; hppa_fix->fx_r_format = r_format; @@ -1265,8 +1265,7 @@ cons_fix_new_hppa (fragS *frag, int where, int size, expressionS *exp, hppa_field_selector = e_fsel; } - fix_new_hppa (frag, where, size, - (symbolS *) NULL, (offsetT) 0, exp, 0, rel_type, + fix_new_hppa (frag, where, size, NULL, 0, exp, 0, rel_type, hppa_field_selector, size * 8, 0, 0); } @@ -1351,7 +1350,7 @@ tc_gen_reloc (asection *section, fixS *fixp) if (fixp->fx_addsy == 0) return &no_relocs; - hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data; + hppa_fixp = fixp->tc_fix_data; gas_assert (hppa_fixp != 0); gas_assert (section != 0); @@ -1447,7 +1446,7 @@ tc_gen_reloc (asection *section, fixS *fixp) (bfd_reloc_code_real_type) code); reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; - gas_assert (reloc->howto && (unsigned int) code == reloc->howto->type); + gas_assert (reloc->howto && code == reloc->howto->type); break; } #else /* OBJ_SOM */ @@ -1563,7 +1562,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, if (fragP->fr_type == rs_machine_dependent) { - switch ((int) fragP->fr_subtype) + switch (fragP->fr_subtype) { case 0: fragP->fr_type = rs_fill; @@ -1590,7 +1589,7 @@ valueT md_section_align (asection *segment, valueT size) { int align = bfd_section_alignment (segment); - int align2 = (1 << align) - 1; + valueT align2 = ((valueT) 1 << align) - 1; return (size + align2) & ~align2; } @@ -1726,7 +1725,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) fixP->fx_done = 1; /* There should be a HPPA specific fixup associated with the GAS fixup. */ - hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data; + hppa_fixP = fixP->tc_fix_data; if (hppa_fixP == NULL) { as_bad_where (fixP->fx_file, fixP->fx_line, @@ -5762,7 +5761,7 @@ md_assemble (char *str) where = frag_more (0); u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor); fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, NULL, + NULL, 0, NULL, 0, R_HPPA_ENTRY, e_fsel, 0, 0, u); } #endif @@ -5786,7 +5785,7 @@ md_assemble (char *str) /* If necessary output more stuff. */ if (the_insn.reloc != R_HPPA_NONE) fix_new_hppa (frag_now, (to - frag_now->fr_literal), 4, NULL, - (offsetT) 0, &the_insn.exp, the_insn.pcrel, + 0, &the_insn.exp, the_insn.pcrel, (int) the_insn.reloc, the_insn.field_selector, the_insn.format, the_insn.arg_reloc, 0); @@ -5856,7 +5855,7 @@ pa_brtab (int begin ATTRIBUTE_UNUSED) char *where = frag_more (0); fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, NULL, + NULL, 0, NULL, 0, begin ? R_HPPA_BEGIN_BRTAB : R_HPPA_END_BRTAB, e_fsel, 0, 0, 0); #endif @@ -5880,7 +5879,7 @@ pa_try (int begin ATTRIBUTE_UNUSED) the beginning and end of exception handling regions). */ fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, begin ? NULL : &exp, + NULL, 0, begin ? NULL : &exp, 0, begin ? R_HPPA_BEGIN_TRY : R_HPPA_END_TRY, e_fsel, 0, 0, 0); #endif @@ -6019,10 +6018,8 @@ pa_build_unwind_subspace (struct call_info *call_info) /* Relocation info. for start offset of the function. */ md_number_to_chars (p, 0, 4); - fix_new_hppa (frag_now, p - frag_now->fr_literal, 4, - symbolP, (offsetT) 0, - (expressionS *) NULL, 0, reloc, - e_fsel, 32, 0, 0); + fix_new_hppa (frag_now, p - frag_now->fr_literal, 4, symbolP, 0, + NULL, 0, reloc, e_fsel, 32, 0, 0); /* Relocation info. for end offset of the function. @@ -6033,9 +6030,8 @@ pa_build_unwind_subspace (struct call_info *call_info) finished with its work. */ md_number_to_chars (p + 4, 0, 4); fix_new_hppa (frag_now, p + 4 - frag_now->fr_literal, 4, - call_info->end_symbol, (offsetT) 0, - (expressionS *) NULL, 0, reloc, - e_fsel, 32, 0, 0); + call_info->end_symbol, 0, + NULL, 0, reloc, e_fsel, 32, 0, 0); /* Dump the descriptor. */ unwind = UNWIND_LOW32 (&call_info->ci_unwind.descriptor); @@ -6335,8 +6331,7 @@ pa_entry (int unused ATTRIBUTE_UNUSED) where = frag_more (0); u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor); fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, NULL, - 0, R_HPPA_ENTRY, e_fsel, 0, 0, u); + NULL, 0, NULL, 0, R_HPPA_ENTRY, e_fsel, 0, 0, u); } #endif } @@ -6494,8 +6489,7 @@ process_exit (void) if we split the unwind bits up between the relocations which denote the entry and exit points. */ fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, - NULL, 0, R_HPPA_EXIT, e_fsel, 0, 0, + NULL, 0, NULL, 0, R_HPPA_EXIT, e_fsel, 0, 0, UNWIND_HIGH32 (&last_call_info->ci_unwind.descriptor)); #endif } @@ -6621,7 +6615,7 @@ pa_type_args (symbolS *symbolP, int is_export) than BFD understands. This is how we get this information to the SOM BFD backend. */ #ifdef obj_set_symbol_type - obj_set_symbol_type (bfdsym, (int) type); + obj_set_symbol_type (bfdsym, type); #else (void) type; #endif @@ -7011,8 +7005,8 @@ pa_procend (int unused ATTRIBUTE_UNUSED) where = frag_more (0); u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor); fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, - NULL, (offsetT) 0, NULL, - 0, R_HPPA_ENTRY, e_fsel, 0, 0, u); + NULL, 0, NULL, 0, R_HPPA_ENTRY, e_fsel, + 0, 0, u); } #endif } @@ -7554,7 +7548,6 @@ pa_subspace (int create_new) /* Now that all the flags are set, update an existing subspace, or create a new one. */ if (ssd) - current_subspace = update_subspace (space, ss_name, loadable, code_only, comdat, common, dup_common, sort, zero, access_ctr, @@ -7979,7 +7972,7 @@ pa_subsegment_to_subspace (asection *seg, subsegT subseg) for (subspace_chain = space_chain->sd_subspaces; subspace_chain; subspace_chain = subspace_chain->ssd_next) - if (subspace_chain->ssd_subseg == (int) subseg) + if (subspace_chain->ssd_subseg == subseg) return subspace_chain; } } @@ -8317,7 +8310,7 @@ hppa_fix_adjustable (fixS *fixp) #endif struct hppa_fix_struct *hppa_fix; - hppa_fix = (struct hppa_fix_struct *) fixp->tc_fix_data; + hppa_fix = fixp->tc_fix_data; #ifdef OBJ_ELF /* LR/RR selectors are implicitly used for a number of different relocation @@ -8436,14 +8429,14 @@ hppa_force_relocation (struct fix *fixp) { struct hppa_fix_struct *hppa_fixp; - hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data; + hppa_fixp = fixp->tc_fix_data; #ifdef OBJ_SOM - if (fixp->fx_r_type == (int) R_HPPA_ENTRY - || fixp->fx_r_type == (int) R_HPPA_EXIT - || fixp->fx_r_type == (int) R_HPPA_BEGIN_BRTAB - || fixp->fx_r_type == (int) R_HPPA_END_BRTAB - || fixp->fx_r_type == (int) R_HPPA_BEGIN_TRY - || fixp->fx_r_type == (int) R_HPPA_END_TRY + if (fixp->fx_r_type == R_HPPA_ENTRY + || fixp->fx_r_type == R_HPPA_EXIT + || fixp->fx_r_type == R_HPPA_BEGIN_BRTAB + || fixp->fx_r_type == R_HPPA_END_BRTAB + || fixp->fx_r_type == R_HPPA_BEGIN_TRY + || fixp->fx_r_type == R_HPPA_END_TRY || (fixp->fx_addsy != NULL && fixp->fx_subsy != NULL && (hppa_fixp->segment->flags & SEC_CODE) != 0)) return 1; @@ -8545,7 +8538,7 @@ pa_vtable_entry (int ignore ATTRIBUTE_UNUSED) hppa_fix->fx_r_format = 32; hppa_fix->fx_arg_reloc = 0; hppa_fix->segment = now_seg; - new_fix->tc_fix_data = (void *) hppa_fix; + new_fix->tc_fix_data = hppa_fix; new_fix->fx_r_type = (int) R_PARISC_GNU_VTENTRY; } } @@ -8566,7 +8559,7 @@ pa_vtable_inherit (int ignore ATTRIBUTE_UNUSED) hppa_fix->fx_r_format = 32; hppa_fix->fx_arg_reloc = 0; hppa_fix->segment = now_seg; - new_fix->tc_fix_data = (void *) hppa_fix; + new_fix->tc_fix_data = hppa_fix; new_fix->fx_r_type = (int) R_PARISC_GNU_VTINHERIT; } } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index b0a22bb..8fb8a7e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11408,8 +11408,8 @@ build_modrm_byte (void) i.op[op].disps = exp; exp->X_op = O_constant; exp->X_add_number = 0; - exp->X_add_symbol = (symbolS *) 0; - exp->X_op_symbol = (symbolS *) 0; + exp->X_add_symbol = NULL; + exp->X_op_symbol = NULL; } } else @@ -16439,7 +16439,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, } /* Now put displacement after opcode. */ md_number_to_chars ((char *) where_to_put_displacement, - (valueT) (displacement_from_opcode_start - extension), + displacement_from_opcode_start - extension, DISP_SIZE_FROM_RELAX_STATE (fragP->fr_subtype)); fragP->fr_fix += extension; } @@ -16825,12 +16825,12 @@ parse_real_register (const char *reg_string, char **end_op) while ((*p++ = register_chars[(unsigned char) *s]) != '\0') { if (p >= reg_name_given + MAX_REG_NAME_SIZE) - return (const reg_entry *) NULL; + return NULL; s++; } if (is_part_of_name (*s)) - return (const reg_entry *) NULL; + return NULL; *end_op = (char *) s; @@ -16843,7 +16843,7 @@ parse_real_register (const char *reg_string, char **end_op) && !cpu_arch_flags.bitfield.cpu287 && !cpu_arch_flags.bitfield.cpu387 && !allow_pseudo_reg) - return (const reg_entry *) NULL; + return NULL; if (is_whitespace (*s)) ++s; @@ -16866,7 +16866,7 @@ parse_real_register (const char *reg_string, char **end_op) } } /* We have "%st(" then garbage. */ - return (const reg_entry *) NULL; + return NULL; } } @@ -18126,7 +18126,7 @@ md_section_align (segT segment, valueT size) work. */ int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } #endif @@ -18148,7 +18148,7 @@ s_bss (int ignore ATTRIBUTE_UNUSED) int temp; temp = get_absolute_expression (); - subseg_set (bss_section, (subsegT) temp); + subseg_set (bss_section, temp); demand_empty_rest_of_line (); } @@ -18328,7 +18328,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) _("symbol size computation overflow")); fixp->fx_addsy = NULL; fixp->fx_subsy = NULL; - md_apply_fix (fixp, (valueT *) &value, NULL); + md_apply_fix (fixp, &value, NULL); return NULL; } if (!fixp->fx_addsy || fixp->fx_subsy) diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 192c093..88f9563 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -741,7 +741,7 @@ typedef struct unw_rec_list { struct unw_rec_list *next; } unw_rec_list; -#define SLOT_NUM_NOT_SET (unsigned)-1 +#define SLOT_NUM_NOT_SET -1UL /* Linked list of saved prologue counts. A very poor implementation of a map from label numbers to prologue counts. */ @@ -1045,9 +1045,9 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) const char *sec_name; char *sym_name; char c; - offsetT size; - offsetT cur_size; - offsetT temp; + valueT size; + valueT cur_size; + valueT temp; symbolS *symbolP; segT current_seg = now_seg; subsegT current_subseg = now_subseg; @@ -1109,7 +1109,7 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) temp = get_absolute_expression (); size = temp; - size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1; + size &= ((valueT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1; if (temp != size) { as_warn (_("size (%ld) out of range, ignored"), (long) temp); @@ -1150,11 +1150,9 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) record_alignment (now_seg, log_align); cur_size = bfd_section_size (now_seg); - if ((int) size > cur_size) + if (size > cur_size) { - char *pfrag - = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL, - (valueT)size - (valueT)cur_size, NULL); + char *pfrag = frag_var (rs_fill, 1, 1, 0, NULL, size - cur_size, NULL); *pfrag = 0; bfd_set_section_size (now_seg, size); } @@ -3574,7 +3572,7 @@ start_unwind_section (const segT text_seg, int sec_index) suffix += sizeof (".gnu.linkonce.t.") - 1; } - sec_name = concat (prefix, suffix, NULL); + sec_name = concat (prefix, suffix, (const char *) NULL); /* Handle COMDAT group. */ if ((text_seg->flags & SEC_LINK_ONCE) != 0 @@ -3593,7 +3591,8 @@ start_unwind_section (const segT text_seg, int sec_index) } /* We have to construct a fake section directive. */ - section = concat (sec_name, ",\"aG\",@progbits,", group_name, ",comdat", NULL); + section = concat (sec_name, ",\"aG\",@progbits,", group_name, + ",comdat", (const char *) NULL); set_section (section); free (section); } @@ -3657,7 +3656,7 @@ generate_unwind_image (const segT text_seg) unwind.info = expr_build_dot (); frag_var (rs_machine_dependent, size, size, 0, 0, - (offsetT) (long) unwind.personality_routine, + (intptr_t) unwind.personality_routine, (char *) list); /* Add the personality address to the image. */ @@ -5096,7 +5095,7 @@ dot_pred_rel (int type) if (count == 0) mask = ~(valueT) 0; clear_qp_mutex (mask); - clear_qp_implies (mask, (valueT) 0); + clear_qp_implies (mask, 0); break; case 'i': if (count != 2 || p1 == -1 || p2 == -1) @@ -11664,8 +11663,7 @@ ia64_float_to_chars_bigendian (char *lit, LITTLENUM_TYPE *words, { while (prec--) { - number_to_chars_bigendian (lit, (long) (*words++), - sizeof (LITTLENUM_TYPE)); + number_to_chars_bigendian (lit, *words++, sizeof (LITTLENUM_TYPE)); lit += sizeof (LITTLENUM_TYPE); } } @@ -11676,7 +11674,7 @@ ia64_float_to_chars_littleendian (char *lit, LITTLENUM_TYPE *words, { while (prec--) { - number_to_chars_littleendian (lit, (long) (words[prec]), + number_to_chars_littleendian (lit, words[prec], sizeof (LITTLENUM_TYPE)); lit += sizeof (LITTLENUM_TYPE); } diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index 1957235..76ff841 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -198,29 +198,29 @@ static const char * li_expn = "\n\ static iq2000_macro_defs_s iq2000_macro_defs[] = { - {"abs", (const char **) & abs_expn, (const char **) & abs_args}, - {"la", (const char **) & la_expn, (const char **) & la_args}, - {"bge", (const char **) & bge_expn, (const char **) & bxx_args}, - {"bgeu", (const char **) & bgeu_expn, (const char **) & bxx_args}, - {"bgt", (const char **) & bgt_expn, (const char **) & bxx_args}, - {"bgtu", (const char **) & bgtu_expn, (const char **) & bxx_args}, - {"ble", (const char **) & ble_expn, (const char **) & bxx_args}, - {"bleu", (const char **) & bleu_expn, (const char **) & bxx_args}, - {"blt", (const char **) & blt_expn, (const char **) & bxx_args}, - {"bltu", (const char **) & bltu_expn, (const char **) & bxx_args}, - {"sge", (const char **) & sge_expn, (const char **) & sxx_args}, - {"sgeu", (const char **) & sgeu_expn, (const char **) & sxx_args}, - {"sle", (const char **) & sle_expn, (const char **) & sxx_args}, - {"sleu", (const char **) & sleu_expn, (const char **) & sxx_args}, - {"sgt", (const char **) & sgt_expn, (const char **) & sxx_args}, - {"sgtu", (const char **) & sgtu_expn, (const char **) & sxx_args}, - {"seq", (const char **) & seq_expn, (const char **) & sxx_args}, - {"sne", (const char **) & sne_expn, (const char **) & sxx_args}, - {"neg", (const char **) & neg_expn, (const char **) & neg_args}, - {"negu", (const char **) & negu_expn, (const char **) & neg_args}, - {"li", (const char **) & li_expn, (const char **) & li_args}, - {"ori32", (const char **) & ori32_expn, (const char **) & ai32_args}, - {"andi32",(const char **) & andi32_expn,(const char **) & ai32_args}, + {"abs", &abs_expn, abs_args}, + {"la", &la_expn, la_args}, + {"bge", &bge_expn, bxx_args}, + {"bgeu", &bgeu_expn, bxx_args}, + {"bgt", &bgt_expn, bxx_args}, + {"bgtu", &bgtu_expn, bxx_args}, + {"ble", &ble_expn, bxx_args}, + {"bleu", &bleu_expn, bxx_args}, + {"blt", &blt_expn, bxx_args}, + {"bltu", &bltu_expn, bxx_args}, + {"sge", &sge_expn, sxx_args}, + {"sgeu", &sgeu_expn, sxx_args}, + {"sle", &sle_expn, sxx_args}, + {"sleu", &sleu_expn, sxx_args}, + {"sgt", &sgt_expn, sxx_args}, + {"sgtu", &sgtu_expn, sxx_args}, + {"seq", &seq_expn, sxx_args}, + {"sne", &sne_expn, sxx_args}, + {"neg", &neg_expn, neg_args}, + {"negu", &negu_expn, neg_args}, + {"li", &li_expn, li_args}, + {"ori32", &ori32_expn, ai32_args}, + {"andi32", &andi32_expn, ai32_args}, }; static void @@ -425,7 +425,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -482,7 +482,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS * fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { @@ -728,10 +728,10 @@ iq2000_fix_adjustable (fixS * fixP) { bfd_reloc_code_real_type reloc_type; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); @@ -790,7 +790,7 @@ get_symbol (void) symbolS *p; c = get_symbol_name (&name); - p = (symbolS *) symbol_find_or_make (name); + p = symbol_find_or_make (name); (void) restore_line_pointer (c); return p; } diff --git a/gas/config/tc-kvx.c b/gas/config/tc-kvx.c index 5582650..b4ca25c 100644 --- a/gas/config/tc-kvx.c +++ b/gas/config/tc-kvx.c @@ -700,7 +700,7 @@ assemble_insn (const struct kvxopc * opcode, struct token_list *tok, struct kvxi insn->immx1 = NOIMMX; struct token_list *tok_ = tok; - struct kvx_operand **format = (struct kvx_operand **) opcode->format; + struct kvx_operand *const *format = opcode->format; while (tok_) { @@ -1021,7 +1021,7 @@ kvx_print_insn (struct kvxopc * op ATTRIBUTE_UNUSED) /* This is a hack which works because the Bundling is the same for all cores for now. */ - switch ((int) op->bundling) + switch (op->bundling) { case Bundling_kv3_v1_ALL: insn_type = "ALL "; @@ -1109,7 +1109,7 @@ kvx_reorder_bundle (struct kvxinsn *bundle_insn[], int bundle_insncnt) tag = -1, exu = -1; /* This is a hack. It works because all the Bundling are the same for all cores for now. */ - switch ((int) find_bundling (kvxinsn)) + switch (find_bundling (kvxinsn)) { case Bundling_kv3_v1_ALL: if (bundle_insncnt > 1) @@ -1441,8 +1441,8 @@ kvx_set_cpu (void) static int kvxop_compar (const void *a, const void *b) { - const struct kvxopc *opa = (const struct kvxopc *) a; - const struct kvxopc *opb = (const struct kvxopc *) b; + const struct kvxopc *opa = a; + const struct kvxopc *opb = b; int res = strcmp (opa->as_op, opb->as_op); if (res) @@ -1644,7 +1644,7 @@ md_apply_fix (fixS * fixP, valueT * valueP, segT segmentP ATTRIBUTE_UNUSED) valueT image; arelent *rel; - rel = (arelent *) xmalloc (sizeof (arelent)); + rel = xmalloc (sizeof (arelent)); rel->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); if (rel->howto == NULL) diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index c101d71..2a4bbd3 100644 --- a/gas/config/tc-lm32.c +++ b/gas/config/tc-lm32.c @@ -80,7 +80,7 @@ const pseudo_typeS md_pseudo_table[] = { "hword", cons, 2 }, { "word", cons, 4 }, { "dword", cons, 8 }, - {(char *)0 , (void(*)(int))0, 0} + { NULL, NULL, 0 } }; /* Target specific command line options. */ @@ -246,8 +246,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = 0; i < prec; i++) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -255,8 +254,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = prec - 1; i >= 0; i--) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -278,7 +276,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* This function assembles the instructions. It emits the frags/bytes to the @@ -357,7 +355,7 @@ md_pcrel_from (fixS *fixP) long md_pcrel_from_section (fixS * fixP, segT sec) { - if ((fixP->fx_addsy != (symbolS *) NULL) + if ((fixP->fx_addsy != NULL) && (! S_IS_DEFINED (fixP->fx_addsy) || (S_GET_SEGMENT (fixP->fx_addsy) != sec))) { @@ -368,7 +366,7 @@ md_pcrel_from_section (fixS * fixP, segT sec) /*fprintf(stderr, "%s extern %d local %d\n", S_GET_NAME (fixP->fx_addsy), S_IS_EXTERN (fixP->fx_addsy), S_IS_LOCAL (fixP->fx_addsy));*/ /* FIXME: Weak problem? */ - if ((fixP->fx_addsy != (symbolS *) NULL) + if ((fixP->fx_addsy != NULL) && S_IS_EXTERNAL (fixP->fx_addsy)) { /* If the symbol is external, let the linker handle it. */ diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index 06fb601..7b53b6f 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -180,7 +180,6 @@ md_parse_option (int c, const char *arg) int ret = 1; char lp64[256] = ""; char ilp32[256] = ""; - unsigned char *suf = (unsigned char *)arg; lp64['s'] = lp64['S'] = EF_LOONGARCH_ABI_SOFT_FLOAT; lp64['f'] = lp64['F'] = EF_LOONGARCH_ABI_SINGLE_FLOAT; @@ -193,7 +192,7 @@ md_parse_option (int c, const char *arg) switch (c) { case OPTION_ABI: - if (strncasecmp (arg, "lp64", 4) == 0 && lp64[suf[4]] != 0) + if (strncasecmp (arg, "lp64", 4) == 0 && lp64[arg[4] & 0xff] != 0) { LARCH_opts.ase_ilp32 = 1; LARCH_opts.ase_lp64 = 1; @@ -201,11 +200,11 @@ md_parse_option (int c, const char *arg) LARCH_opts.ase_lasx = 1; LARCH_opts.ase_lvz = 1; LARCH_opts.ase_lbt = 1; - LARCH_opts.ase_abi = lp64[suf[4]]; + LARCH_opts.ase_abi = lp64[arg[4] & 0xff]; } - else if (strncasecmp (arg, "ilp32", 5) == 0 && ilp32[suf[5]] != 0) + else if (strncasecmp (arg, "ilp32", 5) == 0 && ilp32[arg[5] & 0xff] != 0) { - LARCH_opts.ase_abi = ilp32[suf[5]]; + LARCH_opts.ase_abi = ilp32[arg[5] & 0xff]; LARCH_opts.ase_ilp32 = 1; } else @@ -453,7 +452,7 @@ static hashval_t align_sec_sym_hash (const void *entry) { const align_sec_sym *e = entry; - return (hashval_t) (e->sec_id); + return e->sec_id; } static int @@ -483,7 +482,7 @@ static symbolS *get_align_symbol (segT sec) &entry, INSERT); if (slot == NULL) return NULL; - *slot = (align_sec_sym *) xmalloc (sizeof (align_sec_sym)); + *slot = xmalloc (sizeof (align_sec_sym)); if (*slot == NULL) return NULL; **slot = entry; @@ -1756,8 +1755,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) unsigned int subtype; offsetT loc; - subtype = bfd_get_8 (NULL, &((fragS *) - (fixP->fx_frag->fr_opcode))->fr_literal[fixP->fx_where]); + fragS *opfrag = (fragS *) fixP->fx_frag->fr_opcode; + subtype = bfd_get_8 (NULL, opfrag->fr_literal + fixP->fx_where); loc = fixP->fx_frag->fr_fix - (subtype & 7); switch (subtype) { @@ -1793,7 +1792,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) if (subtype < 0x80 && (subtype & 0x40)) { /* DW_CFA_advance_loc. */ - fixP->fx_frag = (fragS *) fixP->fx_frag->fr_opcode; + fixP->fx_frag = opfrag; fixP->fx_next->fx_frag = fixP->fx_frag; fixP->fx_r_type = BFD_RELOC_LARCH_ADD6; fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB6; @@ -2284,12 +2283,12 @@ loongarch_relax_frag (asection *sec, fragS *fragp, static void loongarch_convert_frag_branch (fragS *fragp) { - bfd_byte *buf; + char *buf; expressionS exp; fixS *fixp; insn_t insn; - buf = (bfd_byte *)fragp->fr_literal + fragp->fr_fix; + buf = fragp->fr_literal + fragp->fr_fix; exp.X_op = O_symbol; exp.X_add_symbol = fragp->fr_symbol; @@ -2319,17 +2318,17 @@ loongarch_convert_frag_branch (fragS *fragp) /* Add the B instruction and jump to the original target. */ bfd_putl32 (LARCH_B, buf); - fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal, + fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, false, BFD_RELOC_LARCH_B26); buf += 4; break; case RELAX_BRANCH_21: - fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal, + fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, false, BFD_RELOC_LARCH_B21); buf += 4; break; case RELAX_BRANCH_16: - fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal, + fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, false, BFD_RELOC_LARCH_B16); buf += 4; break; @@ -2341,8 +2340,7 @@ loongarch_convert_frag_branch (fragS *fragp) fixp->fx_file = fragp->fr_file; fixp->fx_line = fragp->fr_line; - gas_assert (buf == (bfd_byte *)fragp->fr_literal - + fragp->fr_fix + fragp->fr_var); + gas_assert (buf == fragp->fr_literal + fragp->fr_fix + fragp->fr_var); fragp->fr_fix += fragp->fr_var; } @@ -2352,7 +2350,7 @@ loongarch_convert_frag_branch (fragS *fragp) static void loongarch_convert_frag_align (fragS *fragp, asection *sec) { - bfd_byte *buf = (bfd_byte *)fragp->fr_literal + fragp->fr_fix; + char *buf = fragp->fr_literal + fragp->fr_fix; offsetT nop_bytes; if (NULL == fragp->fr_symbol) @@ -2371,7 +2369,7 @@ loongarch_convert_frag_align (fragS *fragp, asection *sec) exp.X_add_symbol = fragp->fr_symbol; exp.X_add_number = fragp->fr_offset; - fixS *fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal, + fixS *fixp = fix_new_exp (fragp, buf - fragp->fr_literal, nop_bytes, &exp, false, BFD_RELOC_LARCH_ALIGN); fixp->fx_file = fragp->fr_file; fixp->fx_line = fragp->fr_line; @@ -2379,8 +2377,7 @@ loongarch_convert_frag_align (fragS *fragp, asection *sec) buf += nop_bytes; } - gas_assert (buf == (bfd_byte *)fragp->fr_literal - + fragp->fr_fix + fragp->fr_var); + gas_assert (buf == fragp->fr_literal + fragp->fr_fix + fragp->fr_var); fragp->fr_fix += fragp->fr_var; } diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index 2eddf16..ff91d47 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -380,7 +380,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -845,7 +845,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS * fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) /* The symbol is undefined (or is defined but not in this section). @@ -1136,9 +1136,9 @@ m32c_fix_adjustable (fixS * fixP) /* We need the symbol name for the VTABLE entries. */ reloc = fixP->fx_r_type; - if (reloc > (int)BFD_RELOC_UNUSED) + if (reloc > BFD_RELOC_UNUSED) { - reloc -= (int)BFD_RELOC_UNUSED; + reloc -= BFD_RELOC_UNUSED; switch (reloc) { case M32C_OPERAND_DSP_32_S16: diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index ba03818..2368c9a 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -35,7 +35,7 @@ typedef struct sym_link symbolS *symbol; } sym_linkS; -static sym_linkS *debug_sym_link = (sym_linkS *) 0; +static sym_linkS *debug_sym_link = NULL; /* Structure to hold all of the different components describing an individual instruction. */ @@ -609,13 +609,13 @@ expand_debug_syms (sym_linkS *syms, int align) return; (void) frag_align_code (align, 0); - for (; syms != (sym_linkS *) 0; syms = next_syms) + for (; syms != NULL; syms = next_syms) { symbolS *symbolP = syms->symbol; next_syms = syms->next; input_line_pointer = (char *) ".\n"; pseudo_set (symbolP); - free ((char *) syms); + free (syms); } input_line_pointer = save_input_line; @@ -627,7 +627,7 @@ m32r_flush_pending_output (void) if (debug_sym_link) { expand_debug_syms (debug_sym_link, 1); - debug_sym_link = (sym_linkS *) 0; + debug_sym_link = NULL; } } @@ -653,7 +653,7 @@ m32r_fill_insn (int done) if (done && debug_sym_link) { expand_debug_syms (debug_sym_link, 1); - debug_sym_link = (sym_linkS *) 0; + debug_sym_link = NULL; } return 1; @@ -911,7 +911,7 @@ assemble_two_insns (char *str1, char *str2, int parallel_p) fill_insn (0); first.debug_sym_link = debug_sym_link; - debug_sym_link = (sym_linkS *) 0; + debug_sym_link = NULL; /* Parse the first instruction. */ if (! (first.insn = m32r_cgen_assemble_insn @@ -1215,7 +1215,7 @@ md_assemble (char *str) } insn.debug_sym_link = debug_sym_link; - debug_sym_link = (sym_linkS *) 0; + debug_sym_link = NULL; insn.insn = m32r_cgen_assemble_insn (gas_cgen_cpu_desc, str, &insn.fields, insn.buffer, & errmsg); @@ -1451,7 +1451,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -1572,8 +1572,7 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED) symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, sbss_section); @@ -1582,7 +1581,7 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED) } else { - S_SET_VALUE (symbolP, (valueT) size); + S_SET_VALUE (symbolP, size); S_SET_ALIGN (symbolP, align2); S_SET_EXTERNAL (symbolP); S_SET_SEGMENT (symbolP, &scom_section); @@ -1838,7 +1837,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec || S_IS_EXTERNAL (fixP->fx_addsy) @@ -2129,10 +2128,10 @@ m32r_fix_adjustable (fixS *fixP) { bfd_reloc_code_real_type reloc_type; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 6950c57..a9ac9c7 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -583,7 +583,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } static int @@ -989,7 +989,7 @@ print_opcode_list (void) printf ("\n"); printf ("%-5.5s ", opcodes->name); - prev_name = (char *) opcodes->name; + prev_name = opcodes->name; } if (fmt[0]) printf (" [%s]", fmt); @@ -1934,9 +1934,8 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], number_to_chars_bigendian (op, code, 1); number_to_chars_bigendian (op + 1, 0, 1); frag_variant (rs_machine_dependent, 1, 1, - ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF), - operands[0].exp.X_add_symbol, (offsetT) n, - op); + ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF), + operands[0].exp.X_add_symbol, n, op); } else if (current_architecture & cpu6812) { @@ -1945,7 +1944,7 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], number_to_chars_bigendian (op + 1, 0, 1); frag_var (rs_machine_dependent, 2, 2, ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_UNDF), - operands[0].exp.X_add_symbol, (offsetT) n, op); + operands[0].exp.X_add_symbol, n, op); } else { @@ -1954,7 +1953,7 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], number_to_chars_bigendian (op + 1, 0, 1); frag_var (rs_machine_dependent, 3, 3, ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF), - operands[0].exp.X_add_symbol, (offsetT) n, op); + operands[0].exp.X_add_symbol, n, op); } } } @@ -2044,7 +2043,7 @@ build_dbranch_insn (struct m68hc11_opcode *opcode, operand operands[], number_to_chars_bigendian (f + 1, 0, 1); frag_var (rs_machine_dependent, 3, 3, ENCODE_RELAX (STATE_XBCC_BRANCH, STATE_UNDF), - operands[1].exp.X_add_symbol, (offsetT) n, f); + operands[1].exp.X_add_symbol, n, f); } } } @@ -3836,7 +3835,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_16); else reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _("Relocation %d is not supported by object file format."), @@ -4327,11 +4326,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) char *where; long value = * valP; - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* Patch the instruction with the resolved operand. Elf relocation @@ -4348,19 +4347,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) switch (fixP->fx_r_type) { case BFD_RELOC_32: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (value, where); break; case BFD_RELOC_24: case BFD_RELOC_M68HC11_24: - bfd_putb16 ((bfd_vma) (value & 0x0ffff), (unsigned char *) where); - ((bfd_byte*) where)[2] = ((value >> 16) & 0x0ff); + bfd_putb16 (value & 0x0ffff, where); + where[2] = (value >> 16) & 0xff; break; case BFD_RELOC_16: case BFD_RELOC_16_PCREL: case BFD_RELOC_M68HC11_LO16: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); if (value < -65537 || value > 65535) as_bad_where (fixP->fx_file, fixP->fx_line, _("Value out of 16-bit range.")); @@ -4377,11 +4376,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_M68HC11_LO8: case BFD_RELOC_8: case BFD_RELOC_M68HC11_PAGE: - ((bfd_byte *) where)[0] = (bfd_byte) value; + where[0] = value & 0xff; break; case BFD_RELOC_8_PCREL: - ((bfd_byte *) where)[0] = (bfd_byte) value; + where[0] = value & 0xff; if (value < -128 || value > 127) as_bad_where (fixP->fx_file, fixP->fx_line, @@ -4391,8 +4390,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) /* These next two are for XGATE. */ case BFD_RELOC_M68HC12_9_PCREL: - ((bfd_byte *) where)[0] |= (bfd_byte) ((value >>9) & 0x01); - ((bfd_byte *) where)[1] = (bfd_byte) ((value>>1) & 0xff); + where[0] |= (value >> 9) & 0x01; + where[1] = (value >> 1) & 0xff; if (value < -512 || value > 511) as_bad_where (fixP->fx_file, fixP->fx_line, _("Value %ld too large for 9-bit PC-relative branch."), @@ -4400,8 +4399,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) break; case BFD_RELOC_M68HC12_10_PCREL: - ((bfd_byte *) where)[0] |= (bfd_byte) ((value >>9) & 0x03); - ((bfd_byte *) where)[1] = (bfd_byte) ((value>>1) & 0xff); + where[0] |= (value >> 9) & 0x03; + where[1] = (value>> 1) & 0xff; if (value < -1024 || value > 1023) as_bad_where (fixP->fx_file, fixP->fx_line, _("Value %ld too large for 10-bit PC-relative branch."), diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 510a1bc..e5c8f5c 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -4410,7 +4410,7 @@ md_assemble (char *str) fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix; } (void) frag_var (rs_machine_dependent, FRAG_VAR_SIZE, 0, - (relax_substateT) (the_ins.fragb[n].fragty), + the_ins.fragb[n].fragty, the_ins.fragb[n].fadd, the_ins.fragb[n].foff, to_beg_P); } gas_assert (the_ins.nfrag >= 1); @@ -6417,7 +6417,7 @@ parse_mri_control_expression (char *stop, int qual, const char *truelab, flab = mri_control_label (); build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart, - rightstop, (const char *) NULL, flab, extent); + rightstop, NULL, flab, extent); input_line_pointer += 3; if (*input_line_pointer != '.' @@ -6452,7 +6452,7 @@ parse_mri_control_expression (char *stop, int qual, const char *truelab, tlab = mri_control_label (); build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart, - rightstop, tlab, (const char *) NULL, extent); + rightstop, tlab, NULL, extent); input_line_pointer += 2; if (*input_line_pointer != '.' @@ -6554,7 +6554,7 @@ s_mri_if (int qual) n = push_mri_control (mri_if); - parse_mri_control_expression (s - 3, qual, (const char *) NULL, + parse_mri_control_expression (s - 3, qual, NULL, n->next, s[1] == '.' ? s[2] : '\0'); if (s[1] == '.') @@ -7043,7 +7043,7 @@ s_mri_until (int qual) for (s = input_line_pointer; ! is_end_of_stmt (*s); s++) ; - parse_mri_control_expression (s, qual, (const char *) NULL, + parse_mri_control_expression (s, qual, NULL, mri_control_stack->top, '\0'); colon (mri_control_stack->bottom); @@ -7100,7 +7100,7 @@ s_mri_while (int qual) colon (n->next); - parse_mri_control_expression (s - 1, qual, (const char *) NULL, n->bottom, + parse_mri_control_expression (s - 1, qual, NULL, n->bottom, s[1] == '.' ? s[2] : '\0'); input_line_pointer = s + 1; @@ -7333,7 +7333,7 @@ m68k_set_extension (char const *name, int allow_m, int silent) if (negated) not_current_architecture |= (ext->control_regs - ? *(unsigned *)ext->control_regs: ext->arch); + ? *ext->control_regs: ext->arch); else current_architecture |= ext->arch; return 1; @@ -7904,7 +7904,7 @@ m68k_elf_cons (int nbytes /* 4=.long */) } } else - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } while (*input_line_pointer++ == ','); diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c index 8688bfa..f20f0d3 100644 --- a/gas/config/tc-mcore.c +++ b/gas/config/tc-mcore.c @@ -2139,7 +2139,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) /* If the symbol is undefined or defined in another section we leave the add number alone for the linker to fix it later. Only account for the PC pre-bump (which is 2 bytes on the MCore). */ - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (! S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index 5e53421..1469186 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -1381,7 +1381,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } @@ -1807,7 +1807,7 @@ mep_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_IS_WEAK (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) @@ -2051,10 +2051,10 @@ mep_fix_adjustable (fixS *fixP) { bfd_reloc_code_real_type reloc_type; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c index bb8e897..968c88d 100644 --- a/gas/config/tc-metag.c +++ b/gas/config/tc-metag.c @@ -267,7 +267,7 @@ parse_gp_reg (const char *name) entry.name = name; - reg = (const metag_reg *) htab_find (reg_htab, &entry); + reg = htab_find (reg_htab, &entry); return reg; } @@ -4112,7 +4112,7 @@ __parse_dsp_reg (const char *line, const metag_reg **reg, htab_t dsp_regtab) name[len] = '\0'; entry.name = name; - _reg = (const metag_reg *) htab_find (dsp_regtab, &entry); + _reg = htab_find (dsp_regtab, &entry); if (!_reg) return NULL; @@ -6003,7 +6003,7 @@ parse_split_condition (const char *line, metag_insn *insn) entry.name = buf; - scond = (const split_condition *) htab_find (scond_htab, &entry); + scond = htab_find (scond_htab, &entry); if (!scond) return NULL; @@ -6263,10 +6263,9 @@ find_insn_templates (const char *mnemonic) insn_templates *slot; entry.template = &template; + template.name = mnemonic; - memcpy ((void *)&entry.template->name, &mnemonic, sizeof (char *)); - - slot = (insn_templates *) htab_find (mnemonic_htab, &entry); + slot = htab_find (mnemonic_htab, &entry); if (slot) return slot; @@ -6307,8 +6306,8 @@ hash_templates (const void *p) static int eq_templates (const void *a, const void *b) { - insn_templates *ta = (insn_templates *)a; - insn_templates *tb = (insn_templates *)b; + const insn_templates *ta = a; + const insn_templates *tb = b; return strcasecmp (ta->template->name, tb->template->name) == 0; } @@ -6324,7 +6323,7 @@ create_mnemonic_htab (void) for (i = 0; i < num_templates; i++) { const insn_template *template = &metag_optab[i]; - insn_templates **slot = NULL; + void **slot; insn_templates *new_entry; new_entry = XNEW (insn_templates); @@ -6332,8 +6331,7 @@ create_mnemonic_htab (void) new_entry->template = template; new_entry->next = NULL; - slot = (insn_templates **) htab_find_slot (mnemonic_htab, new_entry, - INSERT); + slot = htab_find_slot (mnemonic_htab, new_entry, INSERT); if (*slot) { @@ -6355,7 +6353,7 @@ create_mnemonic_htab (void) static hashval_t hash_regs (const void *p) { - metag_reg *rp = (metag_reg *)p; + const metag_reg *rp = p; char buf[MAX_REG_LEN]; strupper (buf, rp->name); @@ -6367,8 +6365,8 @@ hash_regs (const void *p) static int eq_regs (const void *a, const void *b) { - metag_reg *ra = (metag_reg *)a; - metag_reg *rb = (metag_reg *)b; + const metag_reg *ra = a; + const metag_reg *rb = b; return strcasecmp (ra->name, rb->name) == 0; } @@ -6457,8 +6455,8 @@ hash_scond (const void *p) static int eq_scond (const void *a, const void *b) { - split_condition *ra = (split_condition *)a; - split_condition *rb = (split_condition *)b; + const split_condition *ra = a; + const split_condition *rb = b; return strcasecmp (ra->name, rb->name) == 0; } @@ -6738,8 +6736,7 @@ md_atof (int type, char * litP, int * sizeP) for (i = 0; i < prec; i++) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index 917b8f6..055d9ee 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -244,8 +244,7 @@ microblaze_s_lcomm (int xxx ATTRIBUTE_UNUSED) if (S_GET_SEGMENT (symbolP) == current_seg) symbol_get_frag (symbolP)->fr_symbol = 0; symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, current_seg); @@ -485,7 +484,7 @@ parse_reg (char * s, unsigned * reg) } else as_bad (_("register expected, but saw '%.6s'"), s); - if ((int) tmpreg >= MIN_PVR_REGNUM && tmpreg <= MAX_PVR_REGNUM) + if (tmpreg - MIN_PVR_REGNUM <= MAX_PVR_REGNUM - MIN_PVR_REGNUM) *reg = REG_PVR + tmpreg; else { @@ -514,7 +513,7 @@ parse_reg (char * s, unsigned * reg) else as_bad (_("register expected, but saw '%.6s'"), s); - if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM) + if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM) *reg = tmpreg; else { @@ -551,7 +550,7 @@ parse_reg (char * s, unsigned * reg) else as_bad (_("register expected, but saw '%.6s'"), s); - if ((int)tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM) + if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM) *reg = tmpreg; else { @@ -1873,17 +1872,15 @@ md_atof (int type, char * litP, int * sizeP) { for (i = prec - 1; i >= 0; i--) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); } } else for (i = 0; i < prec; i++) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); } return NULL; @@ -2445,7 +2442,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) we leave the add number alone for the linker to fix it later. Only account for the PC pre-bump (No PC-pre-bump on the Microblaze). */ - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) return 0; diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 5e602a4..7d0d855 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1135,8 +1135,7 @@ static bool mips_ignore_branch_isa; but it's not clear that it would actually improve performance. */ #define RELAX_BRANCH_ENCODE(at, pic, \ uncond, likely, link, toofar) \ - ((relax_substateT) \ - (0xc0000000 \ + ((0xc0000000 \ | ((at) & 0x1f) \ | ((pic) ? 0x20 : 0) \ | ((toofar) ? 0x40 : 0) \ @@ -2407,9 +2406,9 @@ static unsigned long read_insn (char *buf) { if (target_big_endian) - return bfd_getb32 ((bfd_byte *) buf); + return bfd_getb32 (buf); else - return bfd_getl32 ((bfd_byte *) buf); + return bfd_getl32 (buf); } /* Write standard MIPS instruction INSN to BUF. Return a pointer to @@ -2436,9 +2435,9 @@ read_compressed_insn (char *buf, unsigned int length) { insn <<= 16; if (target_big_endian) - insn |= bfd_getb16 ((char *) buf); + insn |= bfd_getb16 (buf); else - insn |= bfd_getl16 ((char *) buf); + insn |= bfd_getl16 (buf); buf += 2; } return insn; @@ -2617,7 +2616,7 @@ set_insn_error_ss (int argnum, const char *msg, const char *s1, const char *s2) static void report_insn_error (const char *str) { - const char *msg = concat (insn_error.msg, " `%s'", NULL); + const char *msg = concat (insn_error.msg, " `%s'", (const char *) NULL); switch (insn_error.format) { @@ -3384,7 +3383,7 @@ mips_parse_arguments (char *s, char float_format) SKIP_SPACE_TABS (s); } mips_add_token (&token, OT_END); - return (struct mips_operand_token *) obstack_finish (&mips_operand_tokens); + return obstack_finish (&mips_operand_tokens); } /* Return TRUE if opcode MO is valid on the currently selected ISA, ASE @@ -3881,7 +3880,7 @@ md_begin (void) if (mips_abi != N64_ABI) { - sec = subseg_new (".reginfo", (subsegT) 0); + sec = subseg_new (".reginfo", 0); bfd_set_section_flags (sec, flags); bfd_set_section_alignment (sec, HAVE_NEWABI ? 3 : 2); @@ -3892,7 +3891,7 @@ md_begin (void) { /* The 64-bit ABI uses a .MIPS.options section rather than .reginfo section. */ - sec = subseg_new (".MIPS.options", (subsegT) 0); + sec = subseg_new (".MIPS.options", 0); bfd_set_section_flags (sec, flags); bfd_set_section_alignment (sec, 3); @@ -3914,7 +3913,7 @@ md_begin (void) } } - sec = subseg_new (".MIPS.abiflags", (subsegT) 0); + sec = subseg_new (".MIPS.abiflags", 0); bfd_set_section_flags (sec, SEC_READONLY | SEC_DATA | SEC_ALLOC | SEC_LOAD); bfd_set_section_alignment (sec, 3); @@ -3922,13 +3921,13 @@ md_begin (void) if (ECOFF_DEBUGGING) { - sec = subseg_new (".mdebug", (subsegT) 0); + sec = subseg_new (".mdebug", 0); bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); bfd_set_section_alignment (sec, 2); } else if (mips_flag_pdr) { - pdr_seg = subseg_new (".pdr", (subsegT) 0); + pdr_seg = subseg_new (".pdr", 0); bfd_set_section_flags (pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); bfd_set_section_alignment (pdr_seg, 2); @@ -4329,14 +4328,16 @@ got16_reloc_p (bfd_reloc_code_real_type reloc) static inline bool hi16_reloc_p (bfd_reloc_code_real_type reloc) { - return (reloc == BFD_RELOC_HI16_S || reloc == BFD_RELOC_MIPS16_HI16_S + return (reloc == BFD_RELOC_HI16_S || reloc == BFD_RELOC_HI16_S_PCREL + || reloc == BFD_RELOC_MIPS16_HI16_S || reloc == BFD_RELOC_MICROMIPS_HI16_S); } static inline bool lo16_reloc_p (bfd_reloc_code_real_type reloc) { - return (reloc == BFD_RELOC_LO16 || reloc == BFD_RELOC_MIPS16_LO16 + return (reloc == BFD_RELOC_LO16 || reloc == BFD_RELOC_LO16_PCREL + || reloc == BFD_RELOC_MIPS16_LO16 || reloc == BFD_RELOC_MICROMIPS_LO16); } @@ -4403,8 +4404,9 @@ static inline bfd_reloc_code_real_type matching_lo_reloc (bfd_reloc_code_real_type reloc) { return (mips16_reloc_p (reloc) ? BFD_RELOC_MIPS16_LO16 - : (micromips_reloc_p (reloc) ? BFD_RELOC_MICROMIPS_LO16 - : BFD_RELOC_LO16)); + : micromips_reloc_p (reloc) ? BFD_RELOC_MICROMIPS_LO16 + : reloc == BFD_RELOC_HI16_S_PCREL ? BFD_RELOC_LO16_PCREL + : BFD_RELOC_LO16); } /* Return true if the given fixup is followed by a matching R_MIPS_LO16 @@ -4416,7 +4418,12 @@ fixup_has_matching_lo_p (fixS *fixp) return (fixp->fx_next != NULL && fixp->fx_next->fx_r_type == matching_lo_reloc (fixp->fx_r_type) && fixp->fx_addsy == fixp->fx_next->fx_addsy - && fixp->fx_offset == fixp->fx_next->fx_offset); + && (fixp->fx_r_type == BFD_RELOC_HI16_S_PCREL + ? (fixp->fx_next->fx_offset - fixp->fx_offset + == ((fixp->fx_next->fx_frag->fr_address + + fixp->fx_next->fx_where) + - (fixp->fx_frag->fr_address + fixp->fx_where))) + : fixp->fx_offset == fixp->fx_next->fx_offset)); } /* Move all labels in LABELS to the current insertion point. TEXT_P @@ -6170,7 +6177,7 @@ match_float_constant (struct mips_arg_info *arg, expressionS *imm, newname = ".lit8"; } - new_seg = subseg_new (newname, (subsegT) 0); + new_seg = subseg_new (newname, 0); bfd_set_section_flags (new_seg, SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA); frag_align (length == 4 ? 2 : 3, 0, 0); @@ -7728,17 +7735,16 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, && delayed_branch_p (ip)) { relaxed_branch = true; - add_relaxed_insn (ip, (relaxed_branch_length - (NULL, NULL, - uncond_branch_p (ip) ? -1 - : branch_likely_p (ip) ? 1 - : 0)), 4, - RELAX_BRANCH_ENCODE - (AT, mips_pic != NO_PIC, - uncond_branch_p (ip), - branch_likely_p (ip), - pinfo & INSN_WRITE_GPR_31, - 0), + add_relaxed_insn (ip, + relaxed_branch_length (NULL, NULL, + uncond_branch_p (ip) ? -1 + : branch_likely_p (ip) ? 1 + : 0), + 4, + RELAX_BRANCH_ENCODE (AT, mips_pic != NO_PIC, + uncond_branch_p (ip), + branch_likely_p (ip), + pinfo & INSN_WRITE_GPR_31, 0), address_expr->X_add_symbol, address_expr->X_add_number); *reloc_type = BFD_RELOC_UNUSED; @@ -7814,15 +7820,15 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, offset = 0; } add_relaxed_insn (ip, 12, 0, - RELAX_MIPS16_ENCODE - (*reloc_type - BFD_RELOC_UNUSED, - mips_opts.ase & ASE_MIPS16E2, - mips_pic != NO_PIC, - HAVE_32BIT_SYMBOLS, - mips_opts.warn_about_macros, - require_unextended, require_extended, - delayed_branch_p (&history[0]), - history[0].mips16_absolute_jump_p), + RELAX_MIPS16_ENCODE (*reloc_type - BFD_RELOC_UNUSED, + mips_opts.ase & ASE_MIPS16E2, + mips_pic != NO_PIC, + HAVE_32BIT_SYMBOLS, + mips_opts.warn_about_macros, + require_unextended, + require_extended, + delayed_branch_p (&history[0]), + history[0].mips16_absolute_jump_p), symbol, offset); } else if (mips_opts.mips16 && insn_length (ip) == 2) @@ -8438,7 +8444,7 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, case 'D': case 'E': if (!forced_insn_length) - *offset_reloc = (int) BFD_RELOC_UNUSED + c; + *offset_reloc = BFD_RELOC_UNUSED + c; else if (c == 'D') *offset_reloc = BFD_RELOC_MICROMIPS_10_PCREL_S1; else @@ -8566,7 +8572,7 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, } } else if (relax_char) - *offset_reloc = (int) BFD_RELOC_UNUSED + relax_char; + *offset_reloc = BFD_RELOC_UNUSED + relax_char; check_completed_insn (&arg); return true; @@ -8988,11 +8994,11 @@ macro_read_relocs (va_list *args, bfd_reloc_code_real_type *r) next = va_arg (*args, int); if (next >= 0) - r[0] = (bfd_reloc_code_real_type) next; + r[0] = next; else { for (i = 0; i < 3; i++) - r[i] = (bfd_reloc_code_real_type) va_arg (*args, int); + r[i] = va_arg (*args, int); /* This function is only used for 16-bit relocation fields. To make the macro code simpler, treat an unrelocated value in the same way as BFD_RELOC_LO16. */ @@ -9240,7 +9246,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt, gas_assert (ep != NULL); if (ep->X_op != O_constant) - *r = (int) BFD_RELOC_UNUSED + c; + *r = BFD_RELOC_UNUSED + c; else if (calculate_reloc (*r, ep->X_add_number, &value)) { mips16_immed (NULL, 0, c, *r, value, 0, &insn.insn_opcode); @@ -11120,7 +11126,7 @@ macro (struct mips_cl_insn *ip, char *str) } else if (!mips_big_got && !HAVE_NEWABI) { - int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16; + int lw_reloc_type = BFD_RELOC_MIPS_GOT16; /* If this is a reference to an external symbol, and there is no constant, we want @@ -11157,7 +11163,7 @@ macro (struct mips_cl_insn *ip, char *str) if (mips_pic == SVR4_PIC && breg == 0 && (call || tempreg == PIC_CALL_REG)) - lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; + lw_reloc_type = BFD_RELOC_MIPS_CALL16; relax_start (offset_expr.X_add_symbol); macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, @@ -11319,9 +11325,9 @@ macro (struct mips_cl_insn *ip, char *str) else if (mips_big_got && !HAVE_NEWABI) { int gpdelay; - int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; - int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16; - int local_reloc_type = (int) BFD_RELOC_MIPS_GOT16; + int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16; + int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16; + int local_reloc_type = BFD_RELOC_MIPS_GOT16; /* This is the large GOT case. If this is a reference to an external symbol, and there is no constant, we want @@ -11371,8 +11377,8 @@ macro (struct mips_cl_insn *ip, char *str) if (expr1.X_add_number == 0 && breg == 0 && (call || tempreg == PIC_CALL_REG)) { - lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16; - lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16; + lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16; + lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16; } macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type); macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", @@ -11474,8 +11480,8 @@ macro (struct mips_cl_insn *ip, char *str) } else if (mips_big_got && HAVE_NEWABI) { - int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; - int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16; + int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16; + int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16; int add_breg_early = 0; /* This is the large GOT case. If this is a reference to an @@ -11517,8 +11523,8 @@ macro (struct mips_cl_insn *ip, char *str) if (expr1.X_add_number == 0 && breg == 0 && (call || tempreg == PIC_CALL_REG)) { - lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16; - lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16; + lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16; + lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16; } macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type); macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", @@ -12532,7 +12538,7 @@ macro (struct mips_cl_insn *ip, char *str) } else if (!mips_big_got) { - int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16; + int lw_reloc_type = BFD_RELOC_MIPS_GOT16; /* If this is a reference to an external symbol, we want lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT16) @@ -15415,6 +15421,13 @@ mips_frob_file_before_adjust (void) if the user knows that adding 2 to "foo" will not induce a carry to the high 16 bits. + A %pcrel_lo() expression matches a %pcrel_hi() expression if: + + (a) it refers to the same symbol; and + (b) the offset applied in the %pcrel_lo() expression equals + the offset applied in the %pcrel_hi() expression plus the + distance from the location of %pcrel_hi() to %pcrel_lo(). + When several %lo()s match a particular %got() or %hi(), we use the following rules to distinguish them: @@ -15486,9 +15499,14 @@ mips_frob_file (void) if ((*pos)->fx_r_type == looking_for_rtype && symbol_same_p ((*pos)->fx_addsy, l->fixp->fx_addsy) - && (*pos)->fx_offset >= l->fixp->fx_offset + && (l->fixp->fx_r_type == BFD_RELOC_HI16_S_PCREL + ? ((*pos)->fx_offset - l->fixp->fx_offset + == (((*pos)->fx_frag->fr_address + (*pos)->fx_where) + - (l->fixp->fx_frag->fr_address + l->fixp->fx_where))) + : (*pos)->fx_offset >= l->fixp->fx_offset) && (lo_pos == NULL - || (*pos)->fx_offset < (*lo_pos)->fx_offset + || (l->fixp->fx_r_type != BFD_RELOC_HI16_S_PCREL + && (*pos)->fx_offset < (*lo_pos)->fx_offset) || (!matched_lo_p && (*pos)->fx_offset == (*lo_pos)->fx_offset))) lo_pos = pos; @@ -15499,15 +15517,20 @@ mips_frob_file (void) /* If we found a match, remove the high-part relocation from its current position and insert it before the low-part relocation. - Make the offsets match so that fixup_has_matching_lo_p() - will return true. + + For absolute relocations make the offsets match so that + fixup_has_matching_lo_p() will return true. For PC-relative + relocations the distance between the offsets is retained + according to expectations in `fixup_has_matching_lo_p', + `_bfd_mips_elf_lo16_reloc' and `mips_elf_add_lo16_rel_addend'. We don't warn about unmatched high-part relocations since some versions of gcc have been known to emit dead "lui ...%hi(...)" instructions. */ if (lo_pos != NULL) { - l->fixp->fx_offset = (*lo_pos)->fx_offset; + if (l->fixp->fx_r_type != BFD_RELOC_HI16_S_PCREL) + l->fixp->fx_offset = (*lo_pos)->fx_offset; if (l->fixp->fx_next != *lo_pos) { *hi_pos = l->fixp->fx_next; @@ -16228,7 +16251,7 @@ get_symbol (void) symbolS *p; c = get_symbol_name (&name); - p = (symbolS *) symbol_find_or_make (name); + p = symbol_find_or_make (name); (void) restore_line_pointer (c); return p; } @@ -16338,13 +16361,12 @@ s_change_sec (int sec) s_data (0); break; case 'b': - subseg_set (bss_section, (subsegT) get_absolute_expression ()); + subseg_set (bss_section, get_absolute_expression ()); demand_empty_rest_of_line (); break; case 'r': - seg = subseg_new (RDATA_SECTION_NAME, - (subsegT) get_absolute_expression ()); + seg = subseg_new (RDATA_SECTION_NAME, get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (!startswith (TARGET_OS, "elf")) @@ -16353,7 +16375,7 @@ s_change_sec (int sec) break; case 's': - seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); + seg = subseg_new (".sdata", get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_SMALL_DATA)); if (!startswith (TARGET_OS, "elf")) @@ -16362,7 +16384,7 @@ s_change_sec (int sec) break; case 'B': - seg = subseg_new (".sbss", (subsegT) get_absolute_expression ()); + seg = subseg_new (".sbss", get_absolute_expression ()); bfd_set_section_flags (seg, SEC_ALLOC | SEC_SMALL_DATA); if (!startswith (TARGET_OS, "elf")) record_alignment (seg, 4); @@ -17632,7 +17654,7 @@ md_section_align (asection *seg, valueT addr) if (align > 4) align = 4; - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* Utility routine, called from above as well. If called while the @@ -17657,7 +17679,7 @@ nopic_need_relax (symbolS *sym, int before_relaxing) not be referenced off the $gp, although it appears as though they can. */ symname = S_GET_NAME (sym); - if (symname != (const char *) NULL + if (symname != NULL && (strcmp (symname, "eprol") == 0 || strcmp (symname, "etext") == 0 || strcmp (symname, "_gp") == 0 @@ -19916,7 +19938,7 @@ s_mips_frame (int ignore ATTRIBUTE_UNUSED) { long val; - if (cur_proc_ptr == (procS *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".frame outside of .ent")); demand_empty_rest_of_line (); @@ -19957,7 +19979,7 @@ s_mips_mask (int reg_type) { long mask, off; - if (cur_proc_ptr == (procS *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".mask/.fmask outside of .ent")); demand_empty_rest_of_line (); diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index dea9181..88b7bc4 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -504,7 +504,7 @@ get_operands (int max_operands, char *s, expressionS *exp) /* Mark the end of the valid operands with an illegal expression. */ exp[numexp].X_op = O_illegal; - return (numexp); + return numexp; } /* Get the value of a special register, or -1 if the name does not match @@ -1912,7 +1912,7 @@ mmix_assemble_return_nonzero (char *str) /* Normal instruction handling downcases, so we must too. */ while (ISALNUM (*s2)) { - if (ISUPPER ((unsigned char) *s2)) + if (ISUPPER (*s2)) *s2 = TOLOWER (*s2); s2++; } @@ -2489,8 +2489,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment) case BFD_RELOC_MMIX_PUSHJ_STUBBABLE: /* If this fixup is out of range, punt to the linker to emit an error. This should only happen with -no-expand. */ - if (val < -(((offsetT) 1 << 19)/2) - || val >= ((offsetT) 1 << 19)/2 - 1 + if (val < -((1 << 19) / 2) + || val >= (1 << 19) / 2 - 1 || (val & 3) != 0) { if (warn_on_expansion) @@ -2513,8 +2513,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment) case BFD_RELOC_MMIX_JMP: /* If this fixup is out of range, punt to the linker to emit an error. This should only happen with -no-expand. */ - if (val < -(((offsetT) 1 << 27)/2) - || val >= ((offsetT) 1 << 27)/2 - 1 + if (val < -((1 << 27) / 2) + || val >= (1 << 27) / 2 - 1 || (val & 3) != 0) { if (warn_on_expansion) @@ -2773,7 +2773,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) && (bfd_vma) val + 256 > lowest_data_loc && bfd_is_abs_section (addsec)) { - val -= (offsetT) lowest_data_loc; + val -= lowest_data_loc; addsy = section_symbol (data_section); } /* Likewise text section. */ @@ -2781,7 +2781,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) && (bfd_vma) val + 256 > lowest_text_loc && bfd_is_abs_section (addsec)) { - val -= (offsetT) lowest_text_loc; + val -= lowest_text_loc; addsy = section_symbol (text_section); } } @@ -3282,7 +3282,7 @@ mmix_force_relocation (fixS *fixP) long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { @@ -3437,9 +3437,8 @@ mmix_md_relax_frag (segT seg, fragS *fragP, long stretch) if (fragP == seginfo->tc_segment_info_data.last_stubfrag) seginfo->tc_segment_info_data.nstubs = 0; - return - (mmix_relax_table[fragP->fr_subtype].rlx_length - - mmix_relax_table[prev_type].rlx_length); + return (mmix_relax_table[fragP->fr_subtype].rlx_length + - mmix_relax_table[prev_type].rlx_length); } case ENCODE_RELAX (STATE_PUSHJ, STATE_MAX): @@ -3634,7 +3633,7 @@ mmix_md_finish (void) if (! merge_gregs) continue; - osymval = (offsetT) S_GET_VALUE (symbolP); + osymval = S_GET_VALUE (symbolP); osymfrag = symbol_get_frag (symbolP); /* If the symbol isn't defined, we can't say that another symbol @@ -3686,10 +3685,8 @@ mmix_md_finish (void) static int cmp_greg_symbol_fixes (const void *parg, const void *qarg) { - const struct mmix_symbol_greg_fixes *p - = (const struct mmix_symbol_greg_fixes *) parg; - const struct mmix_symbol_greg_fixes *q - = (const struct mmix_symbol_greg_fixes *) qarg; + const struct mmix_symbol_greg_fixes *p = parg; + const struct mmix_symbol_greg_fixes *q = qarg; return p->offs > q->offs ? 1 : p->offs < q->offs ? -1 : 0; } @@ -3727,7 +3724,7 @@ mmix_frob_file (void) } sym = fixP->fx_addsy; - offs = (offsetT) fixP->fx_offset; + offs = fixP->fx_offset; /* If the symbol is defined, then it must be resolved to a section symbol at this time, or else we don't know how to handle it. */ @@ -3750,7 +3747,7 @@ mmix_frob_file (void) && (bfd_vma) offs + 256 > lowest_data_loc && bfd_is_abs_section (S_GET_SEGMENT (sym))) { - offs -= (offsetT) lowest_data_loc; + offs -= lowest_data_loc; sym = section_symbol (data_section); } /* Likewise text section. */ @@ -3758,7 +3755,7 @@ mmix_frob_file (void) && (bfd_vma) offs + 256 > lowest_text_loc && bfd_is_abs_section (S_GET_SEGMENT (sym))) { - offs -= (offsetT) lowest_text_loc; + offs -= lowest_text_loc; sym = section_symbol (text_section); } @@ -4086,7 +4083,7 @@ s_loc (int ignore ATTRIBUTE_UNUSED) loc_asserts->frag = frag_now; } - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0); + p = frag_var (rs_org, 1, 1, 0, sym, off, NULL); *p = 0; } @@ -4256,7 +4253,7 @@ mmix_cons (int nbytes) exp.X_unsigned = 0; exp.X_add_symbol = NULL; exp.X_op_symbol = NULL; - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } else do @@ -4274,7 +4271,7 @@ mmix_cons (int nbytes) exp.X_op = O_constant; exp.X_add_number = c; exp.X_unsigned = 1; - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } if (input_line_pointer[-1] != '\"') @@ -4291,7 +4288,7 @@ mmix_cons (int nbytes) default: { expression (&exp); - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); SKIP_WHITESPACE (); } break; diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index db66e20..fe54d21 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -328,7 +328,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, static unsigned long label_count = 0; char buf[40]; - subseg_change (sec, 0); if (fragP->fr_subtype == 0) { fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, @@ -676,7 +675,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return ((addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align)); } void @@ -697,7 +696,7 @@ md_begin (void) { if (strcmp (prev_name, op->name)) { - prev_name = (char *) op->name; + prev_name = op->name; str_hash_insert (mn10200_hash, op->name, op, 0); } op++; @@ -734,7 +733,7 @@ check_operand (unsigned long insn ATTRIBUTE_UNUSED, test = val; - if (test < (offsetT) min || test > (offsetT) max) + if (test < min || test > max) return 0; else return 1; @@ -828,8 +827,7 @@ mn10200_insert_operand (unsigned long *insnp, if (operand->bits < 24 && (operand->flags & MN10200_OPERAND_NOCHECK) == 0) { - long min, max; - offsetT test; + offsetT min, max; if ((operand->flags & MN10200_OPERAND_SIGNED) != 0) { @@ -842,19 +840,17 @@ mn10200_insert_operand (unsigned long *insnp, min = 0; } - test = val; - - if (test < (offsetT) min || test > (offsetT) max) - as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line); + if (val < min || val > max) + as_warn_value_out_of_range (_("operand"), val, min, max, file, line); } if ((operand->flags & MN10200_OPERAND_EXTENDED) == 0) { - *insnp |= (((long) val & ((1 << operand->bits) - 1)) + *insnp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift)); if ((operand->flags & MN10200_OPERAND_REPEATED) != 0) - *insnp |= (((long) val & ((1 << operand->bits) - 1)) + *insnp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift + 2)); } else @@ -900,7 +896,6 @@ md_assemble (char *str) for (;;) { const char *errmsg = NULL; - int op_idx; char *hold; int extra_shift = 0; @@ -910,9 +905,9 @@ md_assemble (char *str) next_opindex = 0; insn = opcode->opcode; extension = 0; - for (op_idx = 1, opindex_ptr = opcode->operands; + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; - opindex_ptr++, op_idx++) + opindex_ptr++) { const struct mn10200_operand *operand; expressionS ex; @@ -1318,7 +1313,7 @@ md_assemble (char *str) fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, reloc_size, &fixups[i].exp, pcrel, - ((bfd_reloc_code_real_type) reloc)); + reloc); /* PC-relative offsets are from the first byte of the next instruction, not from the start of the current diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index c4cf804..db87d52 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -466,7 +466,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, static unsigned long label_count = 0; char buf[40]; - subseg_change (sec, 0); if (fragP->fr_subtype == 0) { fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, @@ -902,7 +901,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } void @@ -923,7 +922,7 @@ md_begin (void) { if (strcmp (prev_name, op->name)) { - prev_name = (char *) op->name; + prev_name = op->name; str_hash_insert (mn10300_hash, op->name, op, 0); } op++; @@ -1103,7 +1102,7 @@ check_operand (const struct mn10300_operand *operand, test = val; - if (test < (offsetT) min || test > (offsetT) max) + if (test < min || test > max) return false; } return true; @@ -1146,8 +1145,9 @@ mn10300_insert_operand (unsigned long *insnp, test = val; - if (test < (offsetT) min || test > (offsetT) max) - as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line); + if (test < min || test > max) + as_warn_value_out_of_range (_("operand"), test, (offsetT) min, + (offsetT) max, file, line); } if ((operand->flags & MN10300_OPERAND_SPLIT) != 0) @@ -1209,20 +1209,20 @@ mn10300_insert_operand (unsigned long *insnp, } else if ((operand->flags & MN10300_OPERAND_EXTENDED) == 0) { - *insnp |= (((long) val & ((1 << operand->bits) - 1)) + *insnp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift)); if ((operand->flags & MN10300_OPERAND_REPEATED) != 0) - *insnp |= (((long) val & ((1 << operand->bits) - 1)) + *insnp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift + operand->bits)); } else { - *extensionp |= (((long) val & ((1 << operand->bits) - 1)) + *extensionp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift)); if ((operand->flags & MN10300_OPERAND_REPEATED) != 0) - *extensionp |= (((long) val & ((1 << operand->bits) - 1)) + *extensionp |= ((val & ((1 << operand->bits) - 1)) << (operand->shift + shift + operand->bits)); } } @@ -2145,7 +2145,7 @@ md_assemble (char *str) fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, reloc_size / 8, &fixups[i].exp, pcrel, - ((bfd_reloc_code_real_type) reloc)); + reloc); if (pcrel) fixP->fx_offset += offset; @@ -2312,7 +2312,7 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg) long md_pcrel_from (fixS *fixp) { - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))) /* The symbol is undefined or weak. Let the linker figure it out. */ return 0; diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c index 3c47699..cb8adfb 100644 --- a/gas/config/tc-moxie.c +++ b/gas/config/tc-moxie.c @@ -590,7 +590,7 @@ md_atof (int type, char *litP, int *sizeP) for (i = prec - 1; i >= 0; i--) { - md_number_to_chars (litP, (valueT) words[i], 2); + md_number_to_chars (litP, words[i], 2); litP += 2; } @@ -731,14 +731,13 @@ static valueT md_chars_to_number (char * buf, int n) { valueT result = 0; - unsigned char * where = (unsigned char *) buf; if (target_big_endian) { while (n--) { result <<= 8; - result |= (*where++ & 255); + result |= (*buf++ & 255); } } else @@ -746,7 +745,7 @@ md_chars_to_number (char * buf, int n) while (n--) { result <<= 8; - result |= (where[n] & 255); + result |= (buf[n] & 255); } } diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 563365f..0127a2a 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -2454,15 +2454,15 @@ try_encode_mova (bool imm_op, if (op1->exp.X_op == O_constant) { bin |= ((op1->exp.X_add_number >> 16) & 0xf) << 8; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); bfd_putl16 (op1->exp.X_add_number & 0xffff, frag + 2); } else { - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); fix_new_exp (frag_now, where, 4, &(op1->exp), false, BFD_RELOC_MSP430X_ABS20_ADR_SRC); - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (ZEROS, frag + 2); } return 4; @@ -2473,7 +2473,7 @@ try_encode_mova (bool imm_op, bin |= 0x30 | (op1->reg << 8) | op2->reg; frag = frag_more (4); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); if (op1->exp.X_op == O_constant) { if (op1->exp.X_add_number > 0xffff @@ -2487,7 +2487,7 @@ try_encode_mova (bool imm_op, } else { - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (ZEROS, frag + 2); fix_new_exp (frag_now, where + 2, 2, &(op1->exp), false, op1->reg == 0 ? BFD_RELOC_MSP430X_PCR16 : @@ -2508,7 +2508,7 @@ try_encode_mova (bool imm_op, bin |= 0xc0 | (op1->reg << 8) | op2->reg; frag = frag_more (2); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); return 2; } else if (op2->am == 1) @@ -2522,13 +2522,13 @@ try_encode_mova (bool imm_op, if (op2->exp.X_op == O_constant) { bin |= (op2->exp.X_add_number >> 16) & 0xf; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); bfd_putl16 (op2->exp.X_add_number & 0xffff, frag + 2); } else { - bfd_putl16 ((bfd_vma) bin, frag); - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (bin, frag); + bfd_putl16 (ZEROS, frag + 2); fix_new_exp (frag_now, where, 4, &(op2->exp), false, BFD_RELOC_MSP430X_ABS20_ADR_DST); } @@ -2539,7 +2539,7 @@ try_encode_mova (bool imm_op, bin |= 0x70 | (op1->reg << 8) | op2->reg; frag = frag_more (4); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); if (op2->exp.X_op == O_constant) { if (op2->exp.X_add_number > 0xffff @@ -2553,7 +2553,7 @@ try_encode_mova (bool imm_op, } else { - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (ZEROS, frag + 2); fix_new_exp (frag_now, where + 2, 2, &(op2->exp), false, op2->reg == 0 ? BFD_RELOC_MSP430X_PCR16 : @@ -2593,13 +2593,13 @@ try_encode_mova (bool imm_op, if (op1->exp.X_op == O_constant) { bin |= ((op1->exp.X_add_number >> 16) & 0xf) << 8; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); bfd_putl16 (op1->exp.X_add_number & 0xffff, frag + 2); } else { - bfd_putl16 ((bfd_vma) bin, frag); - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (bin, frag); + bfd_putl16 (ZEROS, frag + 2); fix_new_exp (frag_now, where, 4, &(op1->exp), false, BFD_RELOC_MSP430X_ABS20_ADR_SRC); } @@ -2634,7 +2634,7 @@ try_encode_mova (bool imm_op, bin |= 0x10 | (op1->reg << 8) | op2->reg; frag = frag_more (2); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); return 2; } else if (op1->am == 2) @@ -2664,7 +2664,7 @@ try_encode_mova (bool imm_op, bin |= (op1->reg << 8) | op2->reg; frag = frag_more (2); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); return 2; } } @@ -2715,7 +2715,7 @@ gen_nop (void) { char *frag; frag = frag_more (2); - bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag); + bfd_putl16 (0x4303 /* NOP */, frag); dwarf2_emit_insn (2); } @@ -3046,7 +3046,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) insn_length += 2; frag = frag_more (2); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); dwarf2_emit_insn (insn_length); break; @@ -3124,7 +3124,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) where += 2; } - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); frag += 2; where += 2; @@ -3136,7 +3136,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -3241,7 +3241,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } bin |= (op2.reg | (op1.reg << 8) | (op1.am << 4) | (op2.am << 7)); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); frag += 2; where += 2; @@ -3253,7 +3253,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -3277,7 +3277,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -3313,7 +3313,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) op_length = 2 + 2 * op1.ol; frag = frag_more (op_length); where = frag - frag_now->fr_literal; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); if (op1.mode == OP_EXP) { @@ -3325,7 +3325,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) { where += 2; - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (ZEROS, frag + 2); if (op1.reg || op1.am == 3) fix_new_exp (frag_now, where, 2, @@ -3396,7 +3396,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) else if (op1.am == 3) bin |= 0x70 | op1.reg; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); if (op1.mode == OP_EXP) { @@ -3406,7 +3406,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) break; } - bfd_putl16 ((bfd_vma) ZEROS, frag + 2); + bfd_putl16 (ZEROS, frag + 2); if (! fix_emitted) fix_new_exp (frag_now, where + 2, 2, @@ -3481,7 +3481,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) bin |= (reg - n + 1); } - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); dwarf2_emit_insn (op_length); break; } @@ -3549,7 +3549,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) bin |= (n - 1) << 10; bin |= reg; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); dwarf2_emit_insn (op_length); break; } @@ -3634,9 +3634,9 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) fix_new_exp (frag_now, where, 4, &(op1.exp), false, BFD_RELOC_MSP430X_ABS20_ADR_SRC); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); if (op_length == 4) - bfd_putl16 ((bfd_vma) (n & 0xffff), frag + 2); + bfd_putl16 (n & 0xffff, frag + 2); dwarf2_emit_insn (op_length); break; } @@ -3926,7 +3926,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) frag += 2; } - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); where += 2; frag += 2; @@ -3938,7 +3938,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -3963,7 +3963,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -3992,7 +3992,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) /* reti instruction. */ insn_length += 2; frag = frag_more (2); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); dwarf2_emit_insn (insn_length); break; } @@ -4079,7 +4079,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } bin |= op1.reg | (op1.am << 4); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); frag += 2; where += 2; @@ -4091,7 +4091,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) } else { - bfd_putl16 ((bfd_vma) ZEROS, frag); + bfd_putl16 (ZEROS, frag); if (!extended_op) { @@ -4172,7 +4172,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) frag = frag_more (2); /* Instr size is 1 word. */ bin |= x & 0x3ff; - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); } else if (exp.X_op == O_symbol && *l1 != '$') { @@ -4182,7 +4182,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) fix_new_exp (frag_now, where, 2, &exp, true, BFD_RELOC_MSP430_10_PCREL); - bfd_putl16 ((bfd_vma) bin, frag); + bfd_putl16 (bin, frag); } else if (*l1 == '$') { @@ -4239,7 +4239,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) insn_length += 8; frag = frag_more (8); dwarf2_emit_insn (0); - bfd_putl16 ((bfd_vma) rc.sop, frag); + bfd_putl16 (rc.sop, frag); frag = frag_variant (rs_machine_dependent, 8, 2, /* Wild guess. */ ENCODE_RELAX (rc.lpos, STATE_BITS10), @@ -4286,8 +4286,8 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line) insn_length += 8; frag = frag_more (8); dwarf2_emit_insn (0); - bfd_putl16 ((bfd_vma) hc.op0, frag); - bfd_putl16 ((bfd_vma) hc.op1, frag+2); + bfd_putl16 (hc.op0, frag); + bfd_putl16 (hc.op1, frag + 2); frag = frag_variant (rs_machine_dependent, 8, 2, ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */ @@ -4384,7 +4384,7 @@ md_section_align (asection * seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* If you define this macro, it should return the offset between the @@ -4396,7 +4396,7 @@ md_section_align (asection * seg, valueT addr) long md_pcrel_from_section (fixS * fixp, segT sec) { - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (!S_IS_DEFINED (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) return 0; @@ -4431,7 +4431,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg) unsigned long insn; long value; - if (fixp->fx_addsy == (symbolS *) NULL) + if (fixp->fx_addsy == NULL) { value = *valuep; fixp->fx_done = 1; @@ -4464,7 +4464,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg) { value = fixp->fx_offset; - if (fixp->fx_subsy != (symbolS *) NULL) + if (fixp->fx_subsy != NULL) { if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section) { @@ -4512,7 +4512,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg) _("operand out of range: %ld"), value); value &= 0x3ff; /* get rid of extended sign */ - bfd_putl16 ((bfd_vma) (value | insn), where); + bfd_putl16 (value | insn, where); break; case BFD_RELOC_MSP430X_PCR16: @@ -4535,66 +4535,66 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg) case BFD_RELOC_16: case BFD_RELOC_MSP430_16_BYTE: value &= 0xffff; /* Get rid of extended sign. */ - bfd_putl16 ((bfd_vma) value, where); + bfd_putl16 (value, where); break; case BFD_RELOC_MSP430_ABS_HI16: value >>= 16; value &= 0xffff; /* Get rid of extended sign. */ - bfd_putl16 ((bfd_vma) value, where); + bfd_putl16 (value, where); break; case BFD_RELOC_32: - bfd_putl32 ((bfd_vma) value, where); + bfd_putl32 (value, where); break; case BFD_RELOC_MSP430_ABS8: case BFD_RELOC_8: - bfd_put_8 (NULL, (bfd_vma) value, where); + bfd_put_8 (NULL, value, where); break; case BFD_RELOC_MSP430X_ABS20_EXT_SRC: case BFD_RELOC_MSP430X_PCR20_EXT_SRC: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 4); + bfd_putl16 (value & 0xffff, where + 4); value >>= 16; - bfd_putl16 ((bfd_vma) (((value & 0xf) << 7) | insn), where); + bfd_putl16 (((value & 0xf) << 7) | insn, where); break; case BFD_RELOC_MSP430X_ABS20_ADR_SRC: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2); + bfd_putl16 (value & 0xffff, where + 2); value >>= 16; - bfd_putl16 ((bfd_vma) (((value & 0xf) << 8) | insn), where); + bfd_putl16 (((value & 0xf) << 8) | insn, where); break; case BFD_RELOC_MSP430X_ABS20_EXT_ODST: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 6); + bfd_putl16 (value & 0xffff, where + 6); value >>= 16; - bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where); + bfd_putl16 ((value & 0xf) | insn, where); break; case BFD_RELOC_MSP430X_PCR20_CALL: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2); + bfd_putl16 (value & 0xffff, where + 2); value >>= 16; - bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where); + bfd_putl16 ((value & 0xf) | insn, where); break; case BFD_RELOC_MSP430X_ABS20_EXT_DST: case BFD_RELOC_MSP430X_PCR20_EXT_DST: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 4); + bfd_putl16 (value & 0xffff, where + 4); value >>= 16; - bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where); + bfd_putl16 ((value & 0xf) | insn, where); break; case BFD_RELOC_MSP430X_PCR20_EXT_ODST: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 6); + bfd_putl16 (value & 0xffff, where + 6); value >>= 16; - bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where); + bfd_putl16 ((value & 0xf) | insn, where); break; case BFD_RELOC_MSP430X_ABS20_ADR_DST: - bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2); + bfd_putl16 (value & 0xffff, where + 2); value >>= 16; - bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where); + bfd_putl16 ((value & 0xf) | insn, where); break; default: diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h index 47da4aa..fc39a59 100644 --- a/gas/config/tc-msp430.h +++ b/gas/config/tc-msp430.h @@ -20,6 +20,7 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef TC_MSP430 #define TC_MSP430 /* By convention, you should define this macro in the `.h' file. For example, `tc-m68k.h' defines `TC_M68K'. You might have to use this @@ -172,3 +173,5 @@ extern bool msp430_allow_local_subtract (expressionS *, expressionS *, segT); #define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING)) #define DWARF2_ADDR_SIZE(bfd) 4 + +#endif /* TC_MSP430 */ diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index 0cfc82d..a795bdc 100644 --- a/gas/config/tc-mt.c +++ b/gas/config/tc-mt.c @@ -335,7 +335,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -372,7 +372,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (!S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) /* The symbol is undefined (or is defined but not in this section). @@ -461,10 +461,10 @@ mt_apply_fix (fixS *fixP, valueT *valueP, segT seg) bool mt_fix_adjustable (fixS * fixP) { - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand; operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index a159ddb..d107555 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -3452,8 +3452,9 @@ nds32_lookup_pseudo_opcode (const char *str) for (i = 0; i < maxlen; i++) { - if (is_whitespace (op[i] = str[i])) + if (is_end_of_stmt (str[i]) || is_whitespace (str[i])) break; + op[i] = str[i]; } op[i] = '\0'; @@ -3896,7 +3897,7 @@ nds32_adjust_label (int n) /* Only frag by alignment when needed. Otherwise, it will fail to optimize labels on 4-byte boundary. (bug8454) See md_convert_frag () and RELAX_SET_RELAXABLE (frag) for details. */ - if (frag_now_fix () & ((1 << n) -1 )) + if (frag_now_fix () & (((addressT) 1 << n) - 1)) { if (subseg_text_p (now_seg)) { @@ -3921,7 +3922,7 @@ nds32_adjust_label (int n) old_frag = symbol_get_frag (label); old_value = S_GET_VALUE (label); - new_value = (valueT) frag_now_fix (); + new_value = frag_now_fix (); /* Multiple labels may be on the same address. And the last symbol may not be a label at all, e.g., register name, external function names, @@ -4015,7 +4016,7 @@ add_mapping_symbol (enum mstate state, unsigned int padding_byte, /* start adding mapping symbol */ seg_info (now_seg)->tc_segment_info_data.mapstate = state; - make_mapping_symbol (state, (valueT) frag_now_fix () + padding_byte, + make_mapping_symbol (state, frag_now_fix () + padding_byte, frag_now, align); } @@ -4093,7 +4094,8 @@ nds32_relax_relocs (int relax) {"", "",}; name = input_line_pointer; - while (*input_line_pointer && !is_whitespace (*input_line_pointer)) + while (!is_end_of_stmt (*input_line_pointer) + && !is_whitespace (*input_line_pointer)) input_line_pointer++; saved_char = *input_line_pointer; *input_line_pointer = 0; @@ -4208,8 +4210,6 @@ struct relax_hint_id *record_id_head = NULL; /* Is the buffer large enough? */ #define MAX_BUFFER 12 -static char *nds_itoa (int n); - static char * nds_itoa (int n) { @@ -4230,7 +4230,8 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED) struct relax_hint_id *record_id; name = input_line_pointer; - while (*input_line_pointer && !is_whitespace (*input_line_pointer)) + while (!is_end_of_stmt (*input_line_pointer) + && !is_whitespace (*input_line_pointer)) input_line_pointer++; saved_char = *input_line_pointer; *input_line_pointer = 0; @@ -4363,7 +4364,8 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED) /* Skip whitespaces. */ name = input_line_pointer; - while (*input_line_pointer && !is_whitespace (*input_line_pointer)) + while (!is_end_of_stmt (*input_line_pointer) + && !is_whitespace (*input_line_pointer)) input_line_pointer++; saved_char = *input_line_pointer; *input_line_pointer = 0; @@ -4400,7 +4402,8 @@ ict_model (int ignore ATTRIBUTE_UNUSED) /* Skip whitespaces. */ name = input_line_pointer; - while (*input_line_pointer && !is_whitespace (*input_line_pointer)) + while (!is_end_of_stmt (*input_line_pointer) + && !is_whitespace (*input_line_pointer)) input_line_pointer++; saved_char = *input_line_pointer; *input_line_pointer = 0; @@ -5209,7 +5212,7 @@ static struct nds32_relax_hint_table relax_ls_table[] = elimination itself or not, we have to return the next instruction range. */ static int -nds32_elf_sethi_range (struct nds32_relocs_pattern *pattern) +nds32_elf_sethi_range (const struct nds32_relocs_pattern *pattern) { int range = 0; while (pattern) @@ -5658,12 +5661,12 @@ static struct nds32_hint_map hint_map [] = /* Find the relaxation pattern according to instructions. */ static bool -nds32_find_reloc_table (struct nds32_relocs_pattern *relocs_pattern, +nds32_find_reloc_table (const struct nds32_relocs_pattern *relocs_pattern, struct nds32_relax_hint_table *hint_info) { unsigned int opcode, seq_size; enum nds32_br_range range; - struct nds32_relocs_pattern *pattern, *hi_pattern = NULL; + const struct nds32_relocs_pattern *pattern, *hi_pattern = NULL; const char *opc = NULL; relax_info_t *relax_info = NULL; nds32_relax_fixup_info_t *fixup_info, *hint_fixup; @@ -5928,9 +5931,8 @@ nds32_match_hint_insn (struct nds32_opcode *opcode, uint32_t seq) static void nds32_elf_append_relax_relocs (const char *key, const void *value) { - struct nds32_relocs_pattern *relocs_pattern = - (struct nds32_relocs_pattern *) value; - struct nds32_relocs_pattern *pattern_temp, *pattern_now; + const struct nds32_relocs_pattern *relocs_pattern = value; + const struct nds32_relocs_pattern *pattern_temp, *pattern_now; symbolS *sym, *hi_sym = NULL; expressionS exp; fragS *fragP; @@ -5947,7 +5949,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value) char *where; int pcrel; - if (!relocs_pattern) + if (!relocs_pattern || !relocs_pattern->opcode) return; if (!nds32_find_reloc_table (relocs_pattern, &hint_info)) @@ -6265,7 +6267,7 @@ static int nds32_elf_append_relax_relocs_traverse (void **slot, void *arg ATTRIBUTE_UNUSED) { string_tuple_t *tuple = *((string_tuple_t **) slot); - nds32_elf_append_relax_relocs (tuple->key, (void *) tuple->value); + nds32_elf_append_relax_relocs (tuple->key, (const void *) tuple->value); return 1; } @@ -6609,7 +6611,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & ((valueT) -1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* GAS will call this function when a symbol table lookup fails, before it @@ -7353,8 +7355,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = 0; i < prec; i++) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -7362,8 +7363,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = prec - 1; i >= 0; i--) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -7687,10 +7687,10 @@ nds32_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) return; } - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) { /* HOW DIFF RELOCATION WORKS. @@ -7831,7 +7831,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) code = fixP->fx_r_type; reloc->howto = bfd_reloc_type_lookup (stdoutput, code); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixP->fx_file, fixP->fx_line, _("internal error: can't export reloc type %d (`%s')"), diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c index 13907f2..dcabf5f 100644 --- a/gas/config/tc-ns32k.c +++ b/gas/config/tc-ns32k.c @@ -1577,13 +1577,13 @@ md_number_to_field (char *buf, long val, bit_fixS *field_ptr) #ifdef ENDIAN *mem_ptr = object; #else - mem_ptr[0] = (char) object; + mem_ptr[0] = object; object >>= 8; - mem_ptr[1] = (char) object; + mem_ptr[1] = object; object >>= 8; - mem_ptr[2] = (char) object; + mem_ptr[2] = object; object >>= 8; - mem_ptr[3] = (char) object; + mem_ptr[3] = object; #endif } else @@ -1723,26 +1723,26 @@ convert_iif (void) { case 4: gen_to_words (words, 2, 8); - md_number_to_imm (memP, (long) words[0], + md_number_to_imm (memP, words[0], sizeof (LITTLENUM_TYPE)); md_number_to_imm (memP + sizeof (LITTLENUM_TYPE), - (long) words[1], + words[1], sizeof (LITTLENUM_TYPE)); break; case 8: gen_to_words (words, 4, 11); - md_number_to_imm (memP, (long) words[0], + md_number_to_imm (memP, words[0], sizeof (LITTLENUM_TYPE)); md_number_to_imm (memP + sizeof (LITTLENUM_TYPE), - (long) words[1], + words[1], sizeof (LITTLENUM_TYPE)); md_number_to_imm ((memP + 2 * sizeof (LITTLENUM_TYPE)), - (long) words[2], + words[2], sizeof (LITTLENUM_TYPE)); md_number_to_imm ((memP + 3 * sizeof (LITTLENUM_TYPE)), - (long) words[3], + words[3], sizeof (LITTLENUM_TYPE)); break; } @@ -1758,7 +1758,7 @@ convert_iif (void) the object later. */ exprP.X_add_number += iif.iifP[i].object_adjust; fix_new_ns32k_exp (frag_now, - (long) (memP - frag_now->fr_literal), + memP - frag_now->fr_literal, size, &exprP, iif.iifP[i].pcrel, @@ -1806,12 +1806,12 @@ convert_iif (void) size = default_disp_size; /* Normally 4 bytes. */ memP = frag_more (size); fix_new_ns32k_exp (frag_now, - (long) (memP - frag_now->fr_literal), + memP - frag_now->fr_literal, size, &exprP, 0, /* never iif.iifP[i].pcrel, */ 1, /* always iif.iifP[i].im_disp */ - (bit_fixS *) 0, 0, + 0, 0, inst_frag, inst_offset); break; /* Exit this absolute hack. */ @@ -2035,7 +2035,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, disp = (S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset) - object_address; disp += md_pcrel_adjust (fragP); - md_number_to_disp (buffer_address, (long) disp, (int) ext); + md_number_to_disp (buffer_address, disp, ext); fragP->fr_fix += ext; } @@ -2053,7 +2053,7 @@ md_estimate_size_before_relax (fragS *fragP, segT segment) /* We don't relax symbols defined in another segment. The thing to do is to assume the object will occupy 4 bytes. */ fix_new_ns32k (fragP, - (int) (fragP->fr_fix), + fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, @@ -2093,8 +2093,8 @@ md_create_short_jump (char *ptr, valueT offset; offset = to_addr - from_addr; - md_number_to_chars (ptr, (valueT) 0xEA, 1); - md_number_to_disp (ptr + 1, (valueT) offset, 2); + *ptr++ = 0xEA; + md_number_to_disp (ptr, offset, 2); } void @@ -2107,8 +2107,8 @@ md_create_long_jump (char *ptr, valueT offset; offset = to_addr - from_addr; - md_number_to_chars (ptr, (valueT) 0xEA, 1); - md_number_to_disp (ptr + 1, (valueT) offset, 4); + *ptr++ = 0xEA; + md_number_to_disp (ptr, offset, 4); } const char md_shortopts[] = "m:"; diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c index 5b3e013..33975fe 100644 --- a/gas/config/tc-or1k.c +++ b/gas/config/tc-or1k.c @@ -164,7 +164,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } symbolS * @@ -223,7 +223,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS * fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || (S_GET_SEGMENT (fixP->fx_addsy) != sec) || S_IS_EXTERNAL (fixP->fx_addsy) @@ -391,4 +391,3 @@ or1k_cfi_frame_initial_instructions (void) { cfi_add_CFA_def_cfa_register (1); } - diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 714dfca..9b3aaab 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1951,7 +1951,7 @@ ppc_cleanup (void) char *p; asection *seg = now_seg; subsegT subseg = now_subseg; - asection *apuinfo_secp = (asection *) NULL; + asection *apuinfo_secp = NULL; unsigned int i; /* Create the .PPC.EMB.apuinfo section. */ @@ -1959,13 +1959,13 @@ ppc_cleanup (void) bfd_set_section_flags (apuinfo_secp, SEC_HAS_CONTENTS | SEC_READONLY); p = frag_more (4); - md_number_to_chars (p, (valueT) 8, 4); + md_number_to_chars (p, 8, 4); p = frag_more (4); - md_number_to_chars (p, (valueT) ppc_apuinfo_num * 4, 4); + md_number_to_chars (p, ppc_apuinfo_num * 4, 4); p = frag_more (4); - md_number_to_chars (p, (valueT) 2, 4); + md_number_to_chars (p, 2, 4); p = frag_more (8); strcpy (p, APUINFO_LABEL); @@ -1973,7 +1973,7 @@ ppc_cleanup (void) for (i = 0; i < ppc_apuinfo_num; i++) { p = frag_more (4); - md_number_to_chars (p, (valueT) ppc_apuinfo_list[i], 4); + md_number_to_chars (p, ppc_apuinfo_list[i], 4); } frag_align (2, 0, 0); @@ -2071,7 +2071,7 @@ ppc_insert_operand (uint64_t insn, errmsg = NULL; insn = (*operand->insert) (insn, val, cpu, &errmsg); - if (errmsg != (const char *) NULL) + if (errmsg != NULL) as_bad_where (file, line, "%s", errmsg); } else @@ -2298,7 +2298,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p) } *str_p = str; - if (reloc == (int) BFD_RELOC_PPC64_TOC + if (reloc == BFD_RELOC_PPC64_TOC && exp_p->X_op == O_symbol && strcmp (S_GET_NAME (exp_p->X_add_symbol), ".TOC.") == 0) { @@ -2311,7 +2311,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p) && (ppc_cpu & PPC_OPCODE_POWER10) == 0) reloc = BFD_RELOC_PPC64_REL24_P9NOTOC; - return (bfd_reloc_code_real_type) reloc; + return reloc; } return BFD_RELOC_NONE; @@ -2470,8 +2470,7 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED) if (S_GET_SEGMENT (symbolP) == bss_section) symbol_get_frag (symbolP)->fr_symbol = 0; symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, bss_section); @@ -2780,7 +2779,7 @@ ppc_xcoff_suffix (char **str_p) && (ppc_obj64 ? ptr->valid64 : ptr->valid32)) { *str_p = str; - return (bfd_reloc_code_real_type) ptr->reloc; + return ptr->reloc; } return BFD_RELOC_NONE; @@ -2948,7 +2947,7 @@ ppc_frob_label (symbolS *sym) /* Set the class of a label based on where it is defined. This handles symbols without suffixes. Also, move the symbol so that it follows the csect symbol. */ - if (ppc_current_csect != (symbolS *) NULL) + if (ppc_current_csect != NULL) { if (symbol_get_tc (sym)->symbol_class == -1) symbol_get_tc (sym)->symbol_class = symbol_get_tc (ppc_current_csect)->symbol_class; @@ -3453,7 +3452,7 @@ md_assemble (char *str) if (operand->insert) { insn = (*operand->insert) (insn, val, ppc_cpu, &errmsg); - if (errmsg != (const char *) NULL) + if (errmsg != NULL) as_bad ("%s", errmsg); } else if (operand->shift >= 0) @@ -3496,7 +3495,7 @@ md_assemble (char *str) && (operand->flags & PPC_OPERAND_GPR_0) != 0)) as_warn (_("invalid register expression")); insn = ppc_insert_operand (insn, operand, ex.X_add_number, - ppc_cpu, (char *) NULL, 0); + ppc_cpu, NULL, 0); } else if (ex.X_op == O_constant || (ex.X_op == O_big && ex.X_add_number > 0)) @@ -3694,7 +3693,7 @@ md_assemble (char *str) else insn = ppc_insert_operand (insn, operand, ppc_obj64 ? 13 : 2, - ppc_cpu, (char *) NULL, 0); + ppc_cpu, NULL, 0); break; /* We'll only use the 32 (or 64) bit form of these relocations @@ -4465,8 +4464,7 @@ ppc_comm (int lcomm) frag_align (align, 0, 0); symbol_set_frag (def_sym, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, def_sym, - def_size, (char *) NULL); + pfrag = frag_var (rs_org, 1, 1, 0, def_sym, def_size, NULL); *pfrag = 0; S_SET_SEGMENT (def_sym, section->segment); symbol_get_tc (def_sym)->align = align; @@ -4642,14 +4640,14 @@ ppc_change_csect (symbolS *sym, offsetT align) frag_align (align, 0, 0); symbol_set_frag (sym, frag_now); - S_SET_VALUE (sym, (valueT) frag_now_fix ()); + S_SET_VALUE (sym, frag_now_fix ()); symbol_get_tc (sym)->align = align; symbol_get_tc (sym)->output = 1; symbol_get_tc (sym)->within = sym; for (list = section->csects; - symbol_get_tc (list)->next != (symbolS *) NULL; + symbol_get_tc (list)->next != NULL; list = symbol_get_tc (list)->next) ; symbol_get_tc (list)->next = sym; @@ -5122,7 +5120,7 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED) exp.X_add_number = 0; /* Fall through. */ case O_constant: - S_SET_VALUE (sym, (valueT) exp.X_add_number); + S_SET_VALUE (sym, exp.X_add_number); symbol_set_frag (sym, &zero_address_frag); break; @@ -5290,7 +5288,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED) /* Ignore any [PR] suffix. */ name = ppc_canonicalize_symbol_name (name); s = strchr (name, '['); - if (s != (char *) NULL + if (s != NULL && strcmp (s + 1, "PR]") == 0) *s = '\0'; @@ -5391,7 +5389,6 @@ ppc_bf (int ignore ATTRIBUTE_UNUSED) saved_bi_sym = 0; } - symbol_get_tc (sym)->output = 1; ppc_frob_label (sym); @@ -5461,13 +5458,13 @@ ppc_biei (int ei) saved_bi_sym = sym; for (look = last_biei ? last_biei : symbol_rootP; - (look != (symbolS *) NULL + (look != NULL && (S_GET_STORAGE_CLASS (look) == C_FILE || S_GET_STORAGE_CLASS (look) == C_BINCL || S_GET_STORAGE_CLASS (look) == C_EINCL)); look = symbol_next (look)) ; - if (look != (symbolS *) NULL) + if (look != NULL) { symbol_remove (sym, &symbol_rootP, &symbol_lastP); symbol_insert (sym, look, &symbol_rootP, &symbol_lastP); @@ -5633,7 +5630,7 @@ ppc_ec (int ignore ATTRIBUTE_UNUSED) static void ppc_toc (int ignore ATTRIBUTE_UNUSED) { - if (ppc_toc_csect != (symbolS *) NULL) + if (ppc_toc_csect != NULL) subseg_set (data_section, symbol_get_tc (ppc_toc_csect)->subseg); else { @@ -5650,7 +5647,7 @@ ppc_toc (int ignore ATTRIBUTE_UNUSED) sym = symbol_find_or_make ("TOC[TC0]"); symbol_set_frag (sym, frag_now); S_SET_SEGMENT (sym, data_section); - S_SET_VALUE (sym, (valueT) frag_now_fix ()); + S_SET_VALUE (sym, frag_now_fix ()); symbol_get_tc (sym)->subseg = subseg; symbol_get_tc (sym)->output = 1; symbol_get_tc (sym)->within = sym; @@ -5658,7 +5655,7 @@ ppc_toc (int ignore ATTRIBUTE_UNUSED) ppc_toc_csect = sym; for (list = ppc_xcoff_data_section.csects; - symbol_get_tc (list)->next != (symbolS *) NULL; + symbol_get_tc (list)->next != NULL; list = symbol_get_tc (list)->next) ; symbol_get_tc (list)->next = sym; @@ -5766,7 +5763,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED) char endc; symbolS *sym; - if (ppc_toc_csect == (symbolS *) NULL + if (ppc_toc_csect == NULL || ppc_toc_csect != ppc_current_csect) { as_bad (_(".tc not in .toc section")); @@ -5804,7 +5801,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED) S_SET_SEGMENT (sym, now_seg); symbol_set_frag (sym, frag_now); - S_SET_VALUE (sym, (valueT) frag_now_fix ()); + S_SET_VALUE (sym, frag_now_fix ()); /* AIX assembler seems to allow any storage class to be set in .tc. But for now, only XMC_TC and XMC_TE are supported by us. */ @@ -6010,7 +6007,7 @@ ppc_symbol_new_hook (symbolS *sym) return; s = strchr (S_GET_NAME (sym), '['); - if (s == (const char *) NULL) + if (s == NULL) { /* There is no suffix. */ return; @@ -6111,7 +6108,7 @@ ppc_frob_symbol (symbolS *sym) if (sym == abs_section_sym) return 1; - if (symbol_get_tc (sym)->real_name != (char *) NULL) + if (symbol_get_tc (sym)->real_name != NULL) S_SET_NAME (sym, symbol_get_tc (sym)->real_name); else { @@ -6120,7 +6117,7 @@ ppc_frob_symbol (symbolS *sym) name = S_GET_NAME (sym); s = strchr (name, '['); - if (s != (char *) NULL) + if (s != NULL) { unsigned int len; char *snew; @@ -6132,7 +6129,7 @@ ppc_frob_symbol (symbolS *sym) } } - if (set_end != (symbolS *) NULL) + if (set_end != NULL) { SA_SET_SYM_ENDNDX (set_end, sym); set_end = NULL; @@ -6141,11 +6138,10 @@ ppc_frob_symbol (symbolS *sym) if (SF_GET_FUNCTION (sym)) { ppc_last_function = sym; - if (symbol_get_tc (sym)->u.size != (symbolS *) NULL) + if (symbol_get_tc (sym)->u.size != NULL) { resolve_symbol_value (symbol_get_tc (sym)->u.size); - SA_SET_SYM_FSIZE (sym, - (long) S_GET_VALUE (symbol_get_tc (sym)->u.size)); + SA_SET_SYM_FSIZE (sym, S_GET_VALUE (symbol_get_tc (sym)->u.size)); } else { @@ -6161,7 +6157,7 @@ ppc_frob_symbol (symbolS *sym) else if (S_GET_STORAGE_CLASS (sym) == C_FCN && strcmp (S_GET_NAME (sym), ".ef") == 0) { - if (ppc_last_function == (symbolS *) NULL) + if (ppc_last_function == NULL) as_bad (_(".ef with no preceding .function")); else { @@ -6204,7 +6200,7 @@ ppc_frob_symbol (symbolS *sym) { /* This is a csect symbol. x_scnlen is the size of the csect. */ - if (symbol_get_tc (sym)->next == (symbolS *) NULL) + if (symbol_get_tc (sym)->next == NULL) a->u.auxent.x_csect.x_scnlen.u64 = bfd_section_size (S_GET_SEGMENT (sym)) - S_GET_VALUE (sym); else @@ -6259,10 +6255,10 @@ ppc_frob_symbol (symbolS *sym) next = symbol_next (sym); while (symbol_get_tc (next)->symbol_class == XMC_TC0) next = symbol_next (next); - if (next == (symbolS *) NULL + if (next == NULL || (!ppc_is_toc_sym (next))) { - if (ppc_after_toc_frag == (fragS *) NULL) + if (ppc_after_toc_frag == NULL) a->u.auxent.x_csect.x_scnlen.u64 = bfd_section_size (data_section) - S_GET_VALUE (sym); else @@ -6295,14 +6291,14 @@ ppc_frob_symbol (symbolS *sym) /* Skip the initial dummy symbol. */ csect = symbol_get_tc (csect)->next; - if (csect == (symbolS *) NULL) + if (csect == NULL) { as_warn (_("warning: symbol %s has no csect"), S_GET_NAME (sym)); a->u.auxent.x_csect.x_scnlen.u64 = 0; } else { - while (symbol_get_tc (csect)->next != (symbolS *) NULL) + while (symbol_get_tc (csect)->next != NULL) { resolve_symbol_value (symbol_get_tc (csect)->next); if (S_GET_VALUE (symbol_get_tc (csect)->next) @@ -6338,7 +6334,7 @@ ppc_frob_symbol (symbolS *sym) asymbol *bsym = symbol_get_bfdsym (symbol_get_tc (sym)->within); combined_entry_type *c = coffsymbol (bsym)->native; - S_SET_VALUE (sym, (valueT) (size_t) c); + S_SET_VALUE (sym, (uintptr_t) c); coffsymbol (symbol_get_bfdsym (sym))->native->fix_value = 1; } else if (S_GET_STORAGE_CLASS (sym) == C_STSYM) @@ -6497,7 +6493,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr) #else int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); #endif } @@ -6600,17 +6596,17 @@ ppc_fix_adjustable (fixS *fix) if (bfd_section_flags (symseg) & SEC_DEBUGGING) return 1; - if (ppc_toc_csect != (symbolS *) NULL + if (ppc_toc_csect != NULL && fix->fx_addsy != ppc_toc_csect && symseg == data_section && val >= ppc_toc_frag->fr_address - && (ppc_after_toc_frag == (fragS *) NULL + && (ppc_after_toc_frag == NULL || val < ppc_after_toc_frag->fr_address)) { symbolS *sy; for (sy = symbol_next (ppc_toc_csect); - sy != (symbolS *) NULL; + sy != NULL; sy = symbol_next (sy)) { TC_SYMFIELD_TYPE *sy_tc = symbol_get_tc (sy); @@ -6991,7 +6987,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) use *valP, and must use fx_offset instead. If the relocation is PC-relative, we then need to re-apply md_pcrel_from_section to this new relocation value. */ - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; else @@ -7765,7 +7761,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_PPC_NEG); reloc->addend = fixp->fx_addnumber; - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_subtract (fixp); relocs[0] = NULL; diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index 97e2f4e..e568c42 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -19,6 +19,7 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef TC_PPC #define TC_PPC #include "opcode/ppc.h" @@ -367,3 +368,5 @@ extern int ppc_dwarf2_line_min_insn_length; #define DWARF2_DEFAULT_RETURN_COLUMN 0x41 #define DWARF2_CIE_DATA_ALIGNMENT ppc_cie_data_alignment #define EH_FRAME_ALIGNMENT 2 + +#endif /* TC_PPC */ diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c index 00208e4..dcc23ba 100644 --- a/gas/config/tc-pru.c +++ b/gas/config/tc-pru.c @@ -255,7 +255,7 @@ pru_align (int log_size, const char *pfill, symbolS *label) old_frag = symbol_get_frag (label); old_value = S_GET_VALUE (label); - new_value = (valueT) frag_now_fix (); + new_value = frag_now_fix (); /* It is possible to have more than one label at a particular address, especially if debugging is enabled, so we must @@ -341,10 +341,10 @@ s_pru_align (int ignore ATTRIBUTE_UNUSED) { input_line_pointer++; fill = get_absolute_expression (); - pfill = (const char *) &fill; + pfill = &fill; } else if (subseg_text_p (now_seg)) - pfill = (const char *) &nop; + pfill = nop; else { pfill = NULL; @@ -680,7 +680,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) /* In general, fix instructions with immediate constants. But leave LDI32 for the linker, which is prepared to shorten insns. */ - if (fixP->fx_addsy == (symbolS *) NULL + if (fixP->fx_addsy == NULL && fixP->fx_r_type != BFD_RELOC_PRU_LDI32) fixP->fx_done = 1; @@ -751,7 +751,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) fixP->fx_subsy = NULL; } /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* For the DIFF relocs, write the value into the object file while still @@ -765,11 +765,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) break; case BFD_RELOC_PRU_GNU_DIFF16: case BFD_RELOC_PRU_GNU_DIFF16_PMEM: - bfd_putl16 ((bfd_vma) value, where); + bfd_putl16 (value, where); break; case BFD_RELOC_PRU_GNU_DIFF32: case BFD_RELOC_PRU_GNU_DIFF32_PMEM: - bfd_putl32 ((bfd_vma) value, where); + bfd_putl32 (value, where); break; default: break; @@ -949,7 +949,7 @@ pru_assemble_expression (const char *exprstr, if (pru_mode == PRU_MODE_TEST && ep->X_op == O_constant) value = ep->X_add_number; - return (unsigned long) value; + return value; } /* Try to parse a non-relocatable expression. */ @@ -1100,7 +1100,6 @@ pru_assemble_arg_b (pru_insn_infoS *insn_info, const char *argstr) SET_INSN_FIELD (RS2, insn_info->insn_code, src2->index); SET_INSN_FIELD (RS2SEL, insn_info->insn_code, src2->regsel); } - } static void @@ -1554,7 +1553,6 @@ md_show_usage (FILE *stream) " -mlink-relax generate relocations for linker relaxation (default).\n" " -mno-link-relax don't generate relocations for linker relaxation.\n" )); - } /* This function is called once, at assembler startup time. @@ -1817,7 +1815,7 @@ pru_frob_label (symbolS *lab) /* Update the label's address with the current output pointer. */ symbol_set_frag (lab, frag_now); - S_SET_VALUE (lab, (valueT) frag_now_fix ()); + S_SET_VALUE (lab, frag_now_fix ()); /* Record this label for future adjustment after we find out what kind of data it references, and the required alignment therewith. */ diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index d0030de..8a33568 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -332,6 +332,7 @@ struct riscv_option_stack struct riscv_option_stack *next; struct riscv_set_options options; riscv_subset_list_t *subset_list; + unsigned xlen; }; static struct riscv_option_stack *riscv_opts_stack = NULL; @@ -537,7 +538,7 @@ make_mapping_symbol (enum riscv_seg_mstate state, { /* Store current $x+arch into tc_segment_info. */ seg_info (now_seg)->tc_segment_info_data.arch_map_symbol = symbol; - xfree ((void *) buff); + xfree (buff); } /* If .fill or other data filling directive generates zero sized data, @@ -1885,15 +1886,13 @@ riscv_record_pcrel_fixup (htab_t p, const asection *sec, bfd_vma address, symbolS *symbol, bfd_vma target) { riscv_pcrel_hi_fixup entry = {sec, address, symbol, target}; - riscv_pcrel_hi_fixup **slot = - (riscv_pcrel_hi_fixup **) htab_find_slot (p, &entry, INSERT); + void **slot = htab_find_slot (p, &entry, INSERT); if (slot == NULL) return false; - *slot = (riscv_pcrel_hi_fixup *) xmalloc (sizeof (riscv_pcrel_hi_fixup)); - if (*slot == NULL) - return false; - **slot = entry; + riscv_pcrel_hi_fixup *pent = xmalloc (sizeof (*pent)); + *slot = pent; + *pent = entry; return true; } @@ -4323,12 +4322,12 @@ riscv_ip_hardcode (char *str, switch (imm_expr->X_op) { case O_constant: - values[num++] = (insn_t) imm_expr->X_add_number; + values[num++] = imm_expr->X_add_number; break; case O_big: /* Extract lower 32-bits of a big number. Assume that generic_bignum_to_int32 work on such number. */ - values[num++] = (insn_t) generic_bignum_to_int32 (); + values[num++] = generic_bignum_to_int32 (); break; default: /* The first value isn't constant, so it should be @@ -4617,7 +4616,7 @@ bool riscv_parse_name (const char *name, struct expressionS *ep, gas_assert (mode == expr_normal); regno = reg_lookup_internal (name, RCLASS_GPR); - if (regno == (unsigned int)-1) + if (regno == -1u) return false; if (symbol_find (name) != NULL) @@ -4936,7 +4935,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) /* Record PCREL_HI20. */ if (!riscv_record_pcrel_fixup (riscv_pcrel_hi_fixup_hash, - (const asection *) seg, + seg, md_pcrel_from (fixP), fixP->fx_addsy, target)) @@ -4965,8 +4964,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) and set fx_done for -mno-relax. */ { bfd_vma location_pcrel_hi = S_GET_VALUE (fixP->fx_addsy) + *valP; - riscv_pcrel_hi_fixup search = - {(const asection *) seg, location_pcrel_hi, 0, 0}; + riscv_pcrel_hi_fixup search = {seg, location_pcrel_hi, 0, 0}; riscv_pcrel_hi_fixup *entry = htab_find (riscv_pcrel_hi_fixup_hash, &search); if (entry && entry->symbol @@ -5075,7 +5073,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED) } else if (strcmp (name, "norvc") == 0) { - riscv_update_subset (&riscv_rps_as, "-c"); + riscv_update_subset_norvc (&riscv_rps_as); riscv_arch_str (xlen, riscv_rps_as.subset_list, true/* update */); riscv_set_rvc (false); } @@ -5113,6 +5111,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED) s->next = riscv_opts_stack; s->options = riscv_opts; s->subset_list = riscv_rps_as.subset_list; + s->xlen = xlen; riscv_opts_stack = s; riscv_rps_as.subset_list = riscv_copy_subset_list (s->subset_list); } @@ -5129,6 +5128,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED) riscv_opts_stack = s->next; riscv_opts = s->options; riscv_rps_as.subset_list = s->subset_list; + xlen = s->xlen; riscv_release_subset_list (release_subsets); free (s); } @@ -5752,7 +5752,7 @@ riscv_insert_uleb128_fixes (bfd *abfd ATTRIBUTE_UNUSED, exp_dup->X_add_number = 0; /* Set addend of SUB_ULEB128 to zero. */ fix_new_exp (fragP, fragP->fr_fix, 0, exp_dup, 0, BFD_RELOC_RISCV_SUB_ULEB128); - free ((void *) exp_dup); + free (exp_dup); } } @@ -5779,7 +5779,7 @@ riscv_md_end (void) void riscv_adjust_symtab (void) { - bfd_map_over_sections (stdoutput, riscv_check_mapping_symbols, (char *) 0); + bfd_map_over_sections (stdoutput, riscv_check_mapping_symbols, NULL); elf_adjust_symtab (); } diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 3593b00..36ccacd 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -705,7 +705,7 @@ rl78_cons_fix_new (fragS * frag, type = BFD_RELOC_RL78_DIFF; } - fixP = fix_new_exp (frag, where, (int) size, exp, 0, type); + fixP = fix_new_exp (frag, where, size, exp, 0, type); switch (exp->X_md) { /* These are intended to have values larger than the container, @@ -1508,5 +1508,5 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); - return ((size + (1 << align) - 1) & -(1 << align)); + return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 0ecda64..8685df1 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -2252,7 +2252,7 @@ rx_cons_fix_new (fragS * frag, type = BFD_RELOC_RX_DIFF; } - fix_new_exp (frag, where, (int) size, exp, 0, type); + fix_new_exp (frag, where, size, exp, 0, type); } void diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c index 9c8fcfe..5110470 100644 --- a/gas/config/tc-s12z.c +++ b/gas/config/tc-s12z.c @@ -186,7 +186,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } void @@ -579,9 +579,7 @@ lex_opr (uint8_t *buffer, int *n_bytes, expressionS *exp, } else if (lex_reg_name (REG_BIT_Dn, ®2)) { - if (c >= -1 * (long) (0x1u << 17) - && - c < (long) (0x1u << 17) - 1) + if (c >= -1 * (1L << 17) && c < (1L << 17) - 1) { *n_bytes = 3; *xb = 0x80; @@ -3891,7 +3889,7 @@ tc_gen_reloc (asection *section, fixS *fixp) *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _("Relocation %d is not supported by object file format."), @@ -3930,11 +3928,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) { long value = *valP; - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); /* @@ -3946,23 +3944,23 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) switch (fixP->fx_r_type) { case BFD_RELOC_8: - ((bfd_byte *) where)[0] = (bfd_byte) value; + where[0] = value; break; case BFD_RELOC_16: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); break; case BFD_RELOC_24: - bfd_putb24 ((bfd_vma) value, (unsigned char *) where); + bfd_putb24 (value, where); break; case BFD_RELOC_S12Z_OPR: { switch (fixP->fx_size) { case 3: - bfd_putb24 ((bfd_vma) value, (unsigned char *) where); + bfd_putb24 (value, where); break; case 2: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); break; default: abort (); @@ -3970,14 +3968,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } break; case BFD_RELOC_32: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (value, where); break; case BFD_RELOC_16_PCREL: if (value < -0x4000 || value > 0x3FFF) as_bad_where (fixP->fx_file, fixP->fx_line, _("Value out of 16-bit range.")); - bfd_putb16 ((bfd_vma) value | 0x8000, (unsigned char *) where); + bfd_putb16 (value | 0x8000, where); break; default: diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 6e9dca0..b073d8e 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -24,6 +24,8 @@ #include "subsegs.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" +#include "sframe.h" +#include "gen-sframe.h" #include "opcode/s390.h" #include "elf/s390.h" @@ -97,6 +99,17 @@ const char FLT_CHARS[] = "dD"; /* The dwarf2 data alignment, adjusted for 32 or 64 bit. */ int s390_cie_data_alignment; +/* Register numbers used for SFrame stack trace info. */ + +/* Designated stack pointer DWARF register number according to s390x ELF ABI. */ +const unsigned int s390_sframe_cfa_sp_reg = 15; + +/* Preferred frame pointer DWARF register number according to s390x ELF ABI. */ +const unsigned int s390_sframe_cfa_fp_reg = 11; + +/* Designated return address DWARF register number according to s390x ELF ABI. */ +const unsigned int s390_sframe_cfa_ra_reg = DWARF2_DEFAULT_RETURN_COLUMN; + /* The target specific pseudo-ops which we support. */ /* Define the prototypes for the pseudo-ops */ @@ -727,9 +740,9 @@ s390_insert_operand (unsigned char *insn, { if (operand->flags & S390_OPERAND_PCREL) { - val = (offsetT) ((addressT) val << 1); - min = (offsetT) ((addressT) min << 1); - max = (offsetT) ((addressT) max << 1); + val = (addressT) val << 1; + min = (addressT) min << 1; + max = (addressT) max << 1; } s390_bad_operand_out_of_range (operand_number, val, min, max, @@ -738,7 +751,7 @@ s390_insert_operand (unsigned char *insn, return; } /* val is ok, now restrict it to operand->bits bits. */ - uval = (addressT) val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1); + uval = val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1); /* val is restrict, now check for special case. */ if (operand->bits == 20 && operand->shift == 20) uval = (uval >> 12) | ((uval & 0xfff) << 8); @@ -748,8 +761,8 @@ s390_insert_operand (unsigned char *insn, addressT min, max; max = (((addressT) 1 << (operand->bits - 1)) << 1) - 1; - min = (offsetT) 0; - uval = (addressT) val; + min = 0; + uval = val; /* Vector register operands have an additional bit in the RXB field. */ @@ -1316,7 +1329,7 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */) as_bad (_("relocation not applicable")); } else - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } while (*input_line_pointer++ == ','); @@ -1906,8 +1919,7 @@ md_gather_operands (char *str, fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, &fixups[i].exp, (operand->flags & S390_OPERAND_PCREL) != 0, - ((bfd_reloc_code_real_type) - (fixups[i].opindex + (int) BFD_RELOC_UNUSED))); + fixups[i].opindex + BFD_RELOC_UNUSED); /* s390_insert_operand () does the range checking. */ if (operand->flags & S390_OPERAND_PCREL) fixP->fx_no_overflow = 1; @@ -2084,7 +2096,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED) /* Emit symbol for start of literal pool. */ S_SET_SEGMENT (lp_sym, now_seg); - S_SET_VALUE (lp_sym, (valueT) frag_now_fix ()); + S_SET_VALUE (lp_sym, frag_now_fix ()); symbol_set_frag (lp_sym, frag_now); while (lpe_list) @@ -2092,7 +2104,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED) lpe = lpe_list; lpe_list = lpe_list->next; S_SET_SEGMENT (lpe->sym, now_seg); - S_SET_VALUE (lpe->sym, (valueT) frag_now_fix ()); + S_SET_VALUE (lpe->sym, frag_now_fix ()); symbol_set_frag (lpe->sym, frag_now); /* Emit literal pool entry. */ @@ -2490,19 +2502,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) else fixP->fx_done = 1; - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { const struct s390_operand *operand; int opindex; - opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; operand = &s390_operands[opindex]; if (fixP->fx_done) { /* Insert the fully resolved operand value. */ s390_insert_operand ((unsigned char *) where, operand, - (offsetT) value, fixP->fx_file, fixP->fx_line, 0); + value, fixP->fx_file, fixP->fx_line, 0); return; } @@ -2631,9 +2643,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) if (fixP->fx_pcrel) value >>= 1; - mop = bfd_getb16 ((unsigned char *) where); - mop |= (unsigned short) (value & 0xfff); - bfd_putb16 ((bfd_vma) mop, (unsigned char *) where); + mop = bfd_getb16 (where); + mop |= value & 0xfff; + bfd_putb16 (mop, where); } break; @@ -2643,10 +2655,10 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) if (fixP->fx_done) { unsigned int mop; - mop = bfd_getb32 ((unsigned char *) where); - mop |= (unsigned int) ((value & 0xfff) << 8 | - (value & 0xff000) >> 12); - bfd_putb32 ((bfd_vma) mop, (unsigned char *) where); + mop = bfd_getb32 (where); + mop |= ((value & 0xfff) << 8 + | (value & 0xff000) >> 12); + bfd_putb32 (mop, where); } break; @@ -2686,9 +2698,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) unsigned int mop; value >>= 1; - mop = bfd_getb32 ((unsigned char *) where - 1); - mop |= (unsigned int) (value & 0xffffff); - bfd_putb32 ((bfd_vma) mop, (unsigned char *) where - 1); + mop = bfd_getb32 (where - 1); + mop |= value & 0xffffff; + bfd_putb32 (mop, where - 1); } break; @@ -2866,6 +2878,48 @@ tc_s390_regname_to_dw2regnum (char *regname) return regnum; } +/* Whether SFrame stack trace info is supported. */ + +bool +s390_support_sframe_p (void) +{ + /* At this time, SFrame is supported for s390x (64-bit) only. */ + return (s390_arch_size == 64); +} + +/* Specify if RA tracking is needed. */ + +bool +s390_sframe_ra_tracking_p (void) +{ + return true; +} + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ + +offsetT +s390_sframe_cfa_ra_offset (void) +{ + return (offsetT) SFRAME_CFA_FIXED_RA_INVALID; +} + +/* Get the abi/arch identifier for SFrame. */ + +unsigned char +s390_sframe_get_abi_arch (void) +{ + unsigned char sframe_abi_arch = 0; + + if (s390_support_sframe_p ()) + { + gas_assert (target_big_endian); + sframe_abi_arch = SFRAME_ABI_S390X_ENDIAN_BIG; + } + + return sframe_abi_arch; +} + void s390_elf_final_processing (void) { diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h index 9206c02..0c62125 100644 --- a/gas/config/tc-s390.h +++ b/gas/config/tc-s390.h @@ -19,6 +19,7 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef TC_S390 #define TC_S390 struct fix; @@ -98,3 +99,36 @@ extern int s390_cie_data_alignment; extern void s390_elf_final_processing (void); #define elf_tc_final_processing s390_elf_final_processing + +/* SFrame. */ + +/* Whether SFrame stack trace info is supported. */ +extern bool s390_support_sframe_p (void); +#define support_sframe_p s390_support_sframe_p + +/* The stack pointer DWARF register number for SFrame CFA tracking. */ +extern const unsigned int s390_sframe_cfa_sp_reg; +#define SFRAME_CFA_SP_REG s390_sframe_cfa_sp_reg + +/* The frame pointer DWARF register number for SFrame CFA and FP tracking. */ +extern const unsigned int s390_sframe_cfa_fp_reg; +#define SFRAME_CFA_FP_REG s390_sframe_cfa_fp_reg + +/* The return address DWARF register number for SFrame RA tracking. */ +extern const unsigned int s390_sframe_cfa_ra_reg; +#define SFRAME_CFA_RA_REG s390_sframe_cfa_ra_reg + +/* Whether SFrame return address tracking is needed. */ +extern bool s390_sframe_ra_tracking_p (void); +#define sframe_ra_tracking_p s390_sframe_ra_tracking_p + +/* The fixed offset from CFA for SFrame to recover the return address. + (useful only when SFrame RA tracking is not needed). */ +extern offsetT s390_sframe_cfa_ra_offset (void); +#define sframe_cfa_ra_offset s390_sframe_cfa_ra_offset + +/* The abi/arch identifier for SFrame. */ +unsigned char s390_sframe_get_abi_arch (void); +#define sframe_get_abi_arch s390_sframe_get_abi_arch + +#endif /* TC_S390 */ diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 79dcf77..f3f1b2a 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -244,7 +244,7 @@ const size_t md_longopts_size = sizeof (md_longopts); #define s3_GP 28 #define s3_PIC_CALL_REG 29 #define s3_MAX_LITERAL_POOL_SIZE 1024 -#define s3_FAIL 0x80000000 +#define s3_FAIL -2147483648 #define s3_SUCCESS 0 #define s3_INSN48_SIZE 6 #define s3_INSN_SIZE 4 @@ -1013,7 +1013,7 @@ s3_end_of_line (char *str) s3_skip_whitespace (str); if (*str != '\0') { - retval = (int) s3_FAIL; + retval = s3_FAIL; if (!s3_inst.error) s3_inst.error = s3_BAD_GARBAGE; @@ -1032,7 +1032,7 @@ s3_score_reg_parse (char **ccp, htab_t htab) p = start; if (!ISALPHA (*p) || !is_name_beginner (*p)) - return (int) s3_FAIL; + return s3_FAIL; c = *p++; @@ -1048,7 +1048,7 @@ s3_score_reg_parse (char **ccp, htab_t htab) *ccp = p; return reg->number; } - return (int) s3_FAIL; + return s3_FAIL; } /* If shift <= 0, only return reg. */ @@ -1057,10 +1057,10 @@ static int s3_reg_required_here (char **str, int shift, enum s3_score_reg_type reg_type) { static char buff[s3_MAX_LITERAL_POOL_SIZE]; - int reg = (int) s3_FAIL; + int reg = s3_FAIL; char *start = *str; - if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[reg_type].htab)) != (int) s3_FAIL) + if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[reg_type].htab)) != s3_FAIL) { if (reg_type == s3_REG_TYPE_SCORE) { @@ -1105,18 +1105,18 @@ s3_skip_past_comma (char **str) if (c == ',' && comma++) { s3_inst.error = s3_BAD_SKIP_COMMA; - return (int) s3_FAIL; + return s3_FAIL; } } if ((c == '\0') || (comma == 0)) { s3_inst.error = s3_BAD_SKIP_COMMA; - return (int) s3_FAIL; + return s3_FAIL; } *str = p; - return comma ? s3_SUCCESS : (int) s3_FAIL; + return comma ? s3_SUCCESS : s3_FAIL; } static void @@ -1125,12 +1125,12 @@ s3_do_rdrsrs (char *str) int reg; s3_skip_whitespace (str); - if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -1192,7 +1192,7 @@ s3_my_get_expression (expressionS * ep, char **str) *str = input_line_pointer; input_line_pointer = save_in; s3_inst.error = _("illegal expression"); - return (int) s3_FAIL; + return s3_FAIL; } /* Get rid of any bignums now, so that we don't generate an error for which we can't establish a line number later on. Big numbers are never valid @@ -1205,7 +1205,7 @@ s3_my_get_expression (expressionS * ep, char **str) s3_inst.error = _("invalid constant"); *str = input_line_pointer; input_line_pointer = save_in; - return (int) s3_FAIL; + return s3_FAIL; } if ((ep->X_add_symbol != NULL) @@ -1224,7 +1224,7 @@ s3_my_get_expression (expressionS * ep, char **str) s3_inst.error = s3_BAD_ARGS; *str = input_line_pointer; input_line_pointer = save_in; - return (int) s3_FAIL; + return s3_FAIL; } *str = input_line_pointer; @@ -1263,14 +1263,14 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x2000 && val <= 0x3fff)) { - return (int) s3_FAIL; + return s3_FAIL; } } else { if (!(val >= -8192 && val <= 8191)) { - return (int) s3_FAIL; + return s3_FAIL; } } @@ -1282,14 +1282,14 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x7fff && val <= 0xffff && val != 0x8000)) { - return (int) s3_FAIL; + return s3_FAIL; } } else { if (!(val >= -32767 && val <= 32768)) { - return (int) s3_FAIL; + return s3_FAIL; } } @@ -1304,7 +1304,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) val = 0; return val; } - return (int) s3_FAIL; + return s3_FAIL; case _IMM32: if (val >= 0 && val <= 0xffffffff) @@ -1313,7 +1313,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) } else { - return (int) s3_FAIL; + return s3_FAIL; } default: @@ -1327,7 +1327,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) break; } - return (int) s3_FAIL; + return s3_FAIL; } static int @@ -1358,18 +1358,18 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) if (*dataptr == '|') /* process PCE */ { - if (s3_my_get_expression (&s3_inst.reloc.exp, &pp) == (int) s3_FAIL) - return (int) s3_FAIL; + if (s3_my_get_expression (&s3_inst.reloc.exp, &pp) == s3_FAIL) + return s3_FAIL; s3_end_of_line (pp); if (s3_inst.error != 0) - return (int) s3_FAIL; /* to ouptut_inst to printf out the error */ + return s3_FAIL; /* to ouptut_inst to printf out the error */ *str = dataptr; } else /* process 16 bit */ { - if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, str) == s3_FAIL) { - return (int) s3_FAIL; + return s3_FAIL; } dataptr = (char *)data_exp; @@ -1424,7 +1424,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) || ((*dataptr == '-') && (*(dataptr + 1) != '0')))) { s3_inst.error = s3_BAD_ARGS; - return (int) s3_FAIL; + return s3_FAIL; } } @@ -1444,7 +1444,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) || (data_type == _IMM4))) { s3_inst.error = s3_BAD_ARGS; - return (int) s3_FAIL; + return s3_FAIL; } if (s3_inst.reloc.exp.X_add_symbol) @@ -1452,7 +1452,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) switch (data_type) { case _SIMM16_LA: - return (int) s3_FAIL; + return s3_FAIL; case _VALUE_HI16: s3_inst.reloc.type = BFD_RELOC_HI16_S; s3_inst.reloc.pc_rel = 0; @@ -1487,7 +1487,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) if (data_type == _SIMM16_LA && s3_inst.reloc.exp.X_unsigned == 1) { value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _SIMM16_LA_POS, hex_p); - if (value == (int) s3_FAIL) /* for advance to check if this is ldis */ + if (value == s3_FAIL) /* for advance to check if this is ldis */ if ((s3_inst.reloc.exp.X_add_number & 0xffff) == 0) { s3_inst.instruction |= 0x8000000; @@ -1500,14 +1500,14 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, hex_p); } - if (value == (int) s3_FAIL) + if (value == s3_FAIL) { if (data_type == _IMM32) { sprintf (s3_err_msg, _("invalid constant: %d bit expression not in range %u..%u"), s3_score_df_range[data_type].bits, - 0, (unsigned)0xffffffff); + 0, 0xffffffff); } else if (data_type == _IMM5_MULTI_LOAD) { @@ -1531,7 +1531,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) } s3_inst.error = s3_err_msg; - return (int) s3_FAIL; + return s3_FAIL; } if (((s3_score_df_range[data_type].range[0] != 0) || (data_type == _IMM5_RANGE_8_31)) @@ -1551,7 +1551,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type) && (((s3_inst.instruction >> 20) & 0x1F) != 0x10)) { s3_inst.error = _("invalid constant: bit expression not defined"); - return (int) s3_FAIL; + return s3_FAIL; } } @@ -1564,10 +1564,10 @@ s3_do_rdsi16 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 1, _SIMM16) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 1, _SIMM16) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; /* ldi.->ldiu! only for imm5 */ @@ -1632,10 +1632,10 @@ s3_do_ldis (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 1, _IMM16) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -1645,9 +1645,9 @@ s3_do_sub_rdsi16 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _SIMM16_NEG) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _SIMM16_NEG) != s3_FAIL) s3_end_of_line (str); } @@ -1657,9 +1657,9 @@ s3_do_sub_rdi16 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _IMM16_NEG) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _IMM16_NEG) != s3_FAIL) s3_end_of_line (str); } @@ -1669,10 +1669,10 @@ s3_do_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */ { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL) s3_data_op2 (&str, 1, _SIMM14); } @@ -1682,11 +1682,11 @@ s3_do_sub_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */ { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _SIMM14_NEG) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _SIMM14_NEG) != s3_FAIL) s3_end_of_line (str); } @@ -1697,12 +1697,12 @@ s3_do_rdrsi5 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 10, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((((s3_inst.instruction >> 20) & 0x1f) == ((s3_inst.instruction >> 15) & 0x1f)) @@ -1722,11 +1722,11 @@ s3_do_rdrsi14 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _IMM14) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _IMM14) != s3_FAIL) s3_end_of_line (str); } @@ -1736,10 +1736,10 @@ s3_do_xrsi5 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 10, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 15) & 0x10) == 0)) @@ -1757,10 +1757,10 @@ s3_do_rdi16 (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 1, _IMM16) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; /* ldis */ @@ -1806,8 +1806,8 @@ s3_do_macro_rdi32hi (char *str) s3_skip_whitespace (str); /* Do not handle s3_end_of_line(). */ - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL) s3_data_op2 (&str, 1, _VALUE_HI16); } @@ -1817,8 +1817,8 @@ s3_do_macro_rdi32lo (char *str) s3_skip_whitespace (str); /* Do not handle s3_end_of_line(). */ - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL) s3_data_op2 (&str, 1, _VALUE_LO16); } @@ -1828,9 +1828,9 @@ s3_do_rdi16_pic (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _IMM16_pic) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _IMM16_pic) != s3_FAIL) s3_end_of_line (str); } @@ -1840,9 +1840,9 @@ s3_do_addi_s_pic (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _SIMM16_pic) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _SIMM16_pic) != s3_FAIL) s3_end_of_line (str); } @@ -1852,9 +1852,9 @@ s3_do_addi_u_pic (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_data_op2 (&str, 1, _IMM16_LO16_pic) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_data_op2 (&str, 1, _IMM16_LO16_pic) != s3_FAIL) s3_end_of_line (str); } @@ -1864,7 +1864,7 @@ s3_do_rd (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL) s3_end_of_line (str); } @@ -1874,8 +1874,8 @@ s3_do_rs (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) ) @@ -1892,7 +1892,7 @@ s3_do_i15 (char *str) { s3_skip_whitespace (str); - if (s3_data_op2 (&str, 10, _IMM15) != (int) s3_FAIL) + if (s3_data_op2 (&str, 10, _IMM15) != s3_FAIL) s3_end_of_line (str); } @@ -1901,7 +1901,7 @@ s3_do_xi5x (char *str) { s3_skip_whitespace (str); - if (s3_data_op2 (&str, 15, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_data_op2 (&str, 15, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.relax_inst != 0x8000) @@ -1916,10 +1916,10 @@ s3_do_rdrs (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.relax_inst != 0x8000) @@ -1949,9 +1949,9 @@ s3_do_rdcrs (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) != s3_FAIL) s3_end_of_line (str); } @@ -1964,15 +1964,15 @@ s3_do_rdsrs (char *str) /* mfsr */ if ((s3_inst.instruction & 0xff) == 0x50) { - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL - && s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL + && s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR) != s3_FAIL) s3_end_of_line (str); } else { - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL - && s3_skip_past_comma (&str) != (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL + && s3_skip_past_comma (&str) != s3_FAIL) s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR); } } @@ -1983,10 +1983,10 @@ s3_do_rdxrs (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 10) & 0x10) == 0) @@ -2005,10 +2005,10 @@ s3_do_rsrs (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) ) @@ -2028,23 +2028,23 @@ s3_do_ceinst (char *str) strbak = str; s3_skip_whitespace (str); - if (s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_data_op2 (&str, 20, _IMM5) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 5, _IMM5) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } else { str = strbak; - if (s3_data_op2 (&str, 0, _IMM25) == (int) s3_FAIL) + if (s3_data_op2 (&str, 0, _IMM25) == s3_FAIL) return; } } @@ -2056,7 +2056,7 @@ s3_reglow_required_here (char **str, int shift) int reg; char *start = *str; - if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[s3_REG_TYPE_SCORE].htab)) != (int) s3_FAIL) + if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[s3_REG_TYPE_SCORE].htab)) != s3_FAIL) { if ((reg == 1) && (s3_nor1 == 1) && (s3_inst.bwarn == 0)) { @@ -2076,7 +2076,7 @@ s3_reglow_required_here (char **str, int shift) *str = start; sprintf (buff, _("low register (r0-r15) expected, not '%.100s'"), start); s3_inst.error = buff; - return (int) s3_FAIL; + return s3_FAIL; } /* Handle add!/and!/or!/sub!. */ @@ -2085,10 +2085,10 @@ s3_do16_rdrs2 (char *str) { s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reglow_required_here (&str, 0) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 4) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reglow_required_here (&str, 0) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2100,8 +2100,8 @@ s3_do16_br (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2115,8 +2115,8 @@ s3_do16_brr (char *str) s3_skip_whitespace (str); - if ((rd = s3_reg_required_here (&str, 0,s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((rd = s3_reg_required_here (&str, 0,s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2127,8 +2127,8 @@ static void s3_do_ltb (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) { return; } @@ -2140,9 +2140,9 @@ s3_do_ltb (char *str) return; } - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL) { return; } @@ -2394,7 +2394,7 @@ s3_handle_dependency (struct s3_score_it *theinst) static enum insn_class s3_get_insn_class_from_type (enum score_insn_type type) { - enum insn_class retval = (int) s3_FAIL; + enum insn_class retval = s3_FAIL; switch (type) { @@ -2741,7 +2741,7 @@ s3_append_insn (char *str, bool gen_frag_p) if (s3_inst.error) { - retval = (int) s3_FAIL; + retval = s3_FAIL; as_bad (_("%s -- `%s'"), s3_inst.error, s3_inst.str); s3_inst.error = NULL; } @@ -2754,10 +2754,10 @@ s3_do16_mv_cmp (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2768,10 +2768,10 @@ s3_do16_cmpi (char *str) { s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _SIMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _SIMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2782,10 +2782,10 @@ s3_do16_addi (char *str) { s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 6) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _SIMM6) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 6) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _SIMM6) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -2797,10 +2797,10 @@ s3_do16_rdi5 (char *str) { s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 5) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 5) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; else { @@ -2817,7 +2817,7 @@ s3_do16_xi5 (char *str) { s3_skip_whitespace (str); - if (s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_data_op2 (&str, 0, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL) return; } @@ -2831,7 +2831,7 @@ s3_validate_immediate_align (int val, unsigned int data_type) if (val % 2) { s3_inst.error = _("address offset must be half word alignment"); - return (int) s3_FAIL; + return s3_FAIL; } } else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2)) @@ -2839,7 +2839,7 @@ s3_validate_immediate_align (int val, unsigned int data_type) if (val % 4) { s3_inst.error = _("address offset must be word alignment"); - return (int) s3_FAIL; + return s3_FAIL; } } @@ -2871,19 +2871,19 @@ s3_exp_ldst_offset (char **str, int shift, unsigned int data_type) data_type += 24; } - if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL) - return (int) s3_FAIL; + if (s3_my_get_expression (&s3_inst.reloc.exp, str) == s3_FAIL) + return s3_FAIL; if (s3_inst.reloc.exp.X_op == O_constant) { /* Need to check the immediate align. */ int value = s3_validate_immediate_align (s3_inst.reloc.exp.X_add_number, data_type); - if (value == (int) s3_FAIL) - return (int) s3_FAIL; + if (value == s3_FAIL) + return s3_FAIL; value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0); - if (value == (int) s3_FAIL) + if (value == s3_FAIL) { if (data_type < 30) sprintf (s3_err_msg, @@ -2896,7 +2896,7 @@ s3_exp_ldst_offset (char **str, int shift, unsigned int data_type) s3_score_df_range[data_type - 24].bits, s3_score_df_range[data_type - 24].range[0], s3_score_df_range[data_type - 24].range[1]); s3_inst.error = s3_err_msg; - return (int) s3_FAIL; + return s3_FAIL; } if (data_type == _IMM5_RSHIFT_1) @@ -2936,8 +2936,8 @@ s3_do_ldst_insn (char *str) s3_skip_whitespace (str); - if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) return; /* ld/sw rD, [rA, simm15] ld/sw rD, [rA]+, simm12 ld/sw rD, [rA, simm12]+. */ @@ -2946,7 +2946,7 @@ s3_do_ldst_insn (char *str) str++; s3_skip_whitespace (str); - if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL) return; /* Conflicts can occur on stores as well as loads. */ @@ -2964,8 +2964,8 @@ s3_do_ldst_insn (char *str) /* ld/sw rD, [rA]+, simm12. */ if (s3_skip_past_comma (&str) == s3_SUCCESS) { - if ((s3_exp_ldst_offset (&str, 3, _SIMM12) == (int) s3_FAIL) - || (s3_end_of_line (str) == (int) s3_FAIL)) + if ((s3_exp_ldst_offset (&str, 3, _SIMM12) == s3_FAIL) + || (s3_end_of_line (str) == s3_FAIL)) return; if (conflict_reg) @@ -3005,7 +3005,7 @@ s3_do_ldst_insn (char *str) else { s3_SET_INSN_ERROR (NULL); - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) { return; } @@ -3024,7 +3024,7 @@ s3_do_ldst_insn (char *str) /* ld/sw rD, [rA] convert to ld/sw rD, [rA, simm15]. */ else { - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK; @@ -3083,13 +3083,13 @@ s3_do_ldst_insn (char *str) /* ld/sw rD, [rA, simm15] ld/sw rD, [rA, simm12]+. */ else { - if (s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_skip_past_comma (&str) == s3_FAIL) { s3_inst.error = _("pre-indexed expression expected"); return; } - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL) return; s3_skip_whitespace (str); @@ -3121,7 +3121,7 @@ s3_do_ldst_insn (char *str) } } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.reloc.exp.X_op == O_constant) @@ -3153,7 +3153,7 @@ s3_do_ldst_insn (char *str) } value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0); - if (value == (int) s3_FAIL) + if (value == s3_FAIL) { if (data_type < 30) sprintf (s3_err_msg, @@ -3269,7 +3269,7 @@ s3_do_cache (char *str) { s3_skip_whitespace (str); - if ((s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_data_op2 (&str, 20, _IMM5) == s3_FAIL) || (s3_skip_past_comma (&str) == s3_FAIL)) { return; } @@ -3286,13 +3286,13 @@ s3_do_cache (char *str) str++; s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL) return; s3_skip_whitespace (str); /* cache op, [rA] */ - if (s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_skip_past_comma (&str) == s3_FAIL) { s3_SET_INSN_ERROR (NULL); if (*str != ']') @@ -3305,7 +3305,7 @@ s3_do_cache (char *str) /* cache op, [rA, simm15] */ else { - if (s3_exp_ldst_offset (&str, 0, _SIMM15) == (int) s3_FAIL) + if (s3_exp_ldst_offset (&str, 0, _SIMM15) == s3_FAIL) { return; } @@ -3318,7 +3318,7 @@ s3_do_cache (char *str) } } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; } else @@ -3335,21 +3335,21 @@ s3_do_crdcrscrsimm5 (char *str) strbak = str; s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE_CR) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_CR) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) { str = strbak; /* cop1 cop_code20. */ - if (s3_data_op2 (&str, 5, _IMM20) == (int) s3_FAIL) + if (s3_data_op2 (&str, 5, _IMM20) == s3_FAIL) return; } else { - if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL) + if (s3_data_op2 (&str, 5, _IMM5) == s3_FAIL) return; } @@ -3362,8 +3362,8 @@ s3_do_ldst_cop (char *str) { s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) return; if (*str == '[') @@ -3371,14 +3371,14 @@ s3_do_ldst_cop (char *str) str++; s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL) return; s3_skip_whitespace (str); if (*str++ != ']') { - if (s3_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == (int) s3_FAIL) + if (s3_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == s3_FAIL) return; s3_skip_whitespace (str); @@ -3401,7 +3401,7 @@ s3_do16_ldst_insn (char *str) int conflict_reg = 0; s3_skip_whitespace (str); - if ((s3_reglow_required_here (&str, 8) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_reglow_required_here (&str, 8) == s3_FAIL) || (s3_skip_past_comma (&str) == s3_FAIL)) return; if (*str == '[') @@ -3410,7 +3410,7 @@ s3_do16_ldst_insn (char *str) str++; s3_skip_whitespace (str); - if ((conflict_reg = s3_reglow_required_here (&str, 5)) == (int) s3_FAIL) + if ((conflict_reg = s3_reglow_required_here (&str, 5)) == s3_FAIL) return; if (conflict_reg&0x8) { @@ -3424,17 +3424,17 @@ s3_do16_ldst_insn (char *str) if (*str == ']') { str++; - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; } else { - if (s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_skip_past_comma (&str) == s3_FAIL) { s3_inst.error = _("comma is expected"); return; } - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL) return; s3_skip_whitespace (str); if (*str++ != ']') @@ -3442,7 +3442,7 @@ s3_do16_ldst_insn (char *str) s3_inst.error = _("missing ]"); return; } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.reloc.exp.X_op == O_constant) { @@ -3450,7 +3450,7 @@ s3_do16_ldst_insn (char *str) unsigned int data_type; data_type = _IMM5_RSHIFT_2; value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0); - if (value == (int) s3_FAIL) + if (value == s3_FAIL) { if (data_type < 30) sprintf (s3_err_msg, @@ -3487,12 +3487,12 @@ s3_do_lw48 (char *str) s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) return; - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -3530,12 +3530,12 @@ s3_do_sw48 (char *str) s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) return; - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -3572,12 +3572,12 @@ s3_do_ldi48 (char *str) s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) return; - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -3602,7 +3602,7 @@ s3_do_sdbbp48 (char *str) { s3_skip_whitespace (str); - if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_data_op2 (&str, 5, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL) return; } @@ -3611,12 +3611,12 @@ s3_do_and48 (char *str) { s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reglow_required_here (&str, 34) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 38) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reglow_required_here (&str, 34) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 2, _IMM32) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -3625,12 +3625,12 @@ s3_do_or48 (char *str) { s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reglow_required_here (&str, 34) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 38) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reglow_required_here (&str, 34) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 2, _IMM32) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -3650,9 +3650,9 @@ s3_do_mbitclr (char *str) s3_inst.instruction &= 0x0; - if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL) - || (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL) + || (s3_data_op2 (&str, 0, _IMM11) == s3_FAIL)) return; /* Get imm11 and refill opcode. */ @@ -3669,8 +3669,8 @@ s3_do_mbitclr (char *str) } str++; - if ((s3_skip_past_comma (&str) == (int) s3_FAIL) - || (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL)) + if ((s3_skip_past_comma (&str) == s3_FAIL) + || (s3_data_op2 (&str, 10, _IMM5) == s3_FAIL)) return; /* Set imm11 to opcode. */ @@ -3695,9 +3695,9 @@ s3_do_mbitset (char *str) s3_inst.instruction &= 0x0; - if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL) - || (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL) + || (s3_data_op2 (&str, 0, _IMM11) == s3_FAIL)) return; /* Get imm11 and refill opcode. */ @@ -3714,8 +3714,8 @@ s3_do_mbitset (char *str) } str++; - if ((s3_skip_past_comma (&str) == (int) s3_FAIL) - || (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL)) + if ((s3_skip_past_comma (&str) == s3_FAIL) + || (s3_data_op2 (&str, 10, _IMM5) == s3_FAIL)) return; /* Set imm11 to opcode. */ @@ -3729,10 +3729,10 @@ s3_do16_slli_srli (char *str) { s3_skip_whitespace (str); - if ((s3_reglow_required_here (&str, 5) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL) - || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((s3_reglow_required_here (&str, 5) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL) + || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -3741,10 +3741,10 @@ s3_do16_ldiu (char *str) { s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 5,s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL) - || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((s3_reg_required_here (&str, 5,s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL) + || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -3752,8 +3752,8 @@ static void s3_do16_push_pop (char *str) { s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; } @@ -3763,10 +3763,10 @@ s3_do16_rpush (char *str) int reg; int val; s3_skip_whitespace (str); - if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; /* 0: indicate 32. @@ -3791,10 +3791,10 @@ s3_do16_rpop (char *str) int reg; int val; s3_skip_whitespace (str); - if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; /* 0: indicate 32. @@ -3844,7 +3844,7 @@ s3_do_ldst_unalign (char *str) str++; s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL) return; if (*str++ == ']') @@ -3861,14 +3861,14 @@ s3_do_ldst_unalign (char *str) return; } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; } /* lcw/lce/scb/sce rD, [rA]+. */ else { - if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) { return; } @@ -3879,7 +3879,7 @@ s3_do_ldst_unalign (char *str) int reg; s3_skip_whitespace (str); - if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL) { return; } @@ -3906,7 +3906,7 @@ s3_do_ldst_unalign (char *str) return; } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; } else @@ -3935,8 +3935,8 @@ s3_do_ldst_atomic (char *str) s3_skip_whitespace (str); - if ((s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL)) + if ((s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL)) { return; } @@ -3949,7 +3949,7 @@ s3_do_ldst_atomic (char *str) int reg; s3_skip_whitespace (str); - if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL) { return; } @@ -4092,7 +4092,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) For an external symbol: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; if (reg_rd == s3_PIC_CALL_REG) @@ -4106,7 +4106,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15; memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it)); sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it)); @@ -4116,7 +4116,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) { /* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, true) == (int) s3_FAIL) + if (s3_append_insn (tmp, true) == s3_FAIL) return; /* Insn 2 */ @@ -4124,8 +4124,8 @@ s3_build_la_pic (int reg_rd, expressionS exp) var_num = 1; /* Fix part For an external symbol: addi rD, <constant> */ - sprintf (tmp, "addi r%d, %d", reg_rd, (int)add_number); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + sprintf (tmp, "addi r%d, %d", reg_rd, (int) add_number); + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4134,7 +4134,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */ sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd, S_GET_NAME (add_symbol), (int) add_number); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4147,7 +4147,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) /* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, true) == (int) s3_FAIL) + if (s3_append_insn (tmp, true) == s3_FAIL) return; /* Insn 2 */ @@ -4156,7 +4156,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) /* Fix part For an external symbol: ldis r1, HI%<constant> */ sprintf (tmp, "ldis r1, %d", hi); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4169,7 +4169,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) hi += 1; } sprintf (tmp, "ldis_pic r1, %d", hi); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4181,7 +4181,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) /* Fix part For an external symbol: ori r1, LO%<constant> */ sprintf (tmp, "ori r1, %d", lo); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4189,7 +4189,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) /* Var part For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */ sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4197,7 +4197,7 @@ s3_build_la_pic (int reg_rd, expressionS exp) /* Insn 4: add rD, rD, r1 */ sprintf (tmp, "add r%d, r%d, r1", reg_rd, reg_rd); - if (s3_append_insn (tmp, true) == (int) s3_FAIL) + if (s3_append_insn (tmp, true) == s3_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4214,8 +4214,8 @@ s3_do_macro_la_rdi32 (char *str) int reg_rd; s3_skip_whitespace (str); - if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) { return; } @@ -4226,13 +4226,13 @@ s3_do_macro_la_rdi32 (char *str) char append_str[s3_MAX_LITERAL_POOL_SIZE]; /* Check immediate value. */ - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL) { s3_inst.error = _("expression error"); return; } else if ((s3_inst.reloc.exp.X_add_symbol == NULL) - && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _IMM32, 0) == (int) s3_FAIL)) + && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _IMM32, 0) == s3_FAIL)) { s3_inst.error = _("value not in range [0, 0xffffffff]"); return; @@ -4242,7 +4242,7 @@ s3_do_macro_la_rdi32 (char *str) str = keep_data; /* la rd, simm16. */ - if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL) + if (s3_data_op2 (&str, 1, _SIMM16_LA) != s3_FAIL) { s3_end_of_line (str); return; @@ -4253,8 +4253,8 @@ s3_do_macro_la_rdi32 (char *str) s3_SET_INSN_ERROR (NULL); /* Reset str. */ str = keep_data; - if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL) - || (s3_end_of_line (str) == (int) s3_FAIL)) + if ((s3_data_op2 (&str, 1, _VALUE_HI16) == s3_FAIL) + || (s3_end_of_line (str) == s3_FAIL)) { return; } @@ -4263,11 +4263,11 @@ s3_do_macro_la_rdi32 (char *str) if ((s3_score_pic == s3_NO_PIC) || (!s3_inst.reloc.exp.X_add_symbol)) { sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) return; sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) return; } else @@ -4291,8 +4291,8 @@ s3_do_macro_li_rdi32 (char *str) int reg_rd; s3_skip_whitespace (str); - if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) { return; } @@ -4302,7 +4302,7 @@ s3_do_macro_li_rdi32 (char *str) char *keep_data = str; /* Check immediate value. */ - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL) { s3_inst.error = _("expression error"); return; @@ -4318,7 +4318,7 @@ s3_do_macro_li_rdi32 (char *str) str = keep_data; /* li rd, simm16. */ - if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL) + if (s3_data_op2 (&str, 1, _SIMM16_LA) != s3_FAIL) { s3_end_of_line (str); return; @@ -4331,8 +4331,8 @@ s3_do_macro_li_rdi32 (char *str) /* Reset str. */ str = keep_data; - if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL) - || (s3_end_of_line (str) == (int) s3_FAIL)) + if ((s3_data_op2 (&str, 1, _VALUE_HI16) == s3_FAIL) + || (s3_end_of_line (str) == s3_FAIL)) { return; } @@ -4345,12 +4345,12 @@ s3_do_macro_li_rdi32 (char *str) { sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) return; else { sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4377,15 +4377,15 @@ s3_do_macro_mul_rdrsrs (char *str) strcpy (append_str, str); backupstr = append_str; s3_skip_whitespace (backupstr); - if (((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) - || (s3_skip_past_comma (&backupstr) == (int) s3_FAIL) - || ((reg_rs1 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)) + if (((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) + || (s3_skip_past_comma (&backupstr) == s3_FAIL) + || ((reg_rs1 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)) { s3_inst.error = s3_BAD_ARGS; return; } - if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL) + if (s3_skip_past_comma (&backupstr) == s3_FAIL) { /* rem/remu rA, rB is error format. */ if (strcmp (s3_inst.name, "rem") == 0 || strcmp (s3_inst.name, "remu") == 0) @@ -4402,8 +4402,8 @@ s3_do_macro_mul_rdrsrs (char *str) else { s3_SET_INSN_ERROR (NULL); - if (((reg_rs2 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) - || (s3_end_of_line (backupstr) == (int) s3_FAIL)) + if (((reg_rs2 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) + || (s3_end_of_line (backupstr) == s3_FAIL)) { return; } @@ -4428,11 +4428,11 @@ s3_do_macro_mul_rdrsrs (char *str) } /* Output mul/mulu or div/divu or rem/remu. */ - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) return; /* Output mfcel or mfceh. */ - if (s3_append_insn (append_str1, true) == (int) s3_FAIL) + if (s3_append_insn (append_str1, true) == s3_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4458,11 +4458,11 @@ s3_exp_macro_ldst_abs (char *str) strcpy (verifystr, str); backupstr = verifystr; s3_skip_whitespace (backupstr); - if ((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) return; tmp = backupstr; - if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL) + if (s3_skip_past_comma (&backupstr) == s3_FAIL) return; backupstr = tmp; @@ -4489,19 +4489,19 @@ s3_do_macro_bcmp (char *str) memset (inst_expand, 0, sizeof inst_expand); s3_skip_whitespace (str); - if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - ||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + ||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) return; keep_data_size = strlen (str) + 1; keep_data = xmalloc (keep_data_size * 2 + 14); memcpy (keep_data, str, keep_data_size); - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL ||reg_b == 0 - || s3_end_of_line (str) == (int) s3_FAIL) + || s3_end_of_line (str) == s3_FAIL) goto out; else if (s3_inst.reloc.exp.X_add_symbol == 0) { @@ -4530,14 +4530,14 @@ s3_do_macro_bcmp (char *str) if (s3_score_pic == s3_NO_PIC) { sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) goto out; if ((inst_main.instruction & 0x3e00007e) == 0x0000004c) memcpy (append_str, "beq ", 4); else memcpy (append_str, "bne ", 4); memmove (append_str + 4, keep_data, strlen (keep_data) + 1); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) goto out; } else @@ -4562,7 +4562,7 @@ s3_do_macro_bcmp (char *str) if (s3_score_pic == s3_NO_PIC) { sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b); - if (s3_append_insn (append_str, false) == (int) s3_FAIL) + if (s3_append_insn (append_str, false) == s3_FAIL) goto out; memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4571,7 +4571,7 @@ s3_do_macro_bcmp (char *str) else memcpy (append_str, "bne ", 4); memmove (append_str + 4, keep_data, strlen (keep_data) + 1); - if (s3_append_insn (append_str, false) == (int) s3_FAIL) + if (s3_append_insn (append_str, false) == s3_FAIL) goto out; memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it)); } @@ -4646,16 +4646,16 @@ s3_do_macro_bcmpz (char *str) memset (inst_expand, 0, sizeof inst_expand); s3_skip_whitespace (str); - if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL) + if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL) return; keep_data_size = strlen (str) + 1; keep_data = xmalloc (keep_data_size * 2 + 13); memcpy (keep_data, str, keep_data_size); - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) goto out; else if (s3_inst.reloc.exp.X_add_symbol == 0) { @@ -4680,14 +4680,14 @@ s3_do_macro_bcmpz (char *str) if (s3_score_pic == s3_NO_PIC) { sprintf (append_str, "cmpi! r%d, 0", reg_a); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) goto out; if ((inst_main.instruction & 0x3e00007e) == 0x0000004c) memcpy (append_str, "beq ", 4); else memcpy (append_str, "bne ", 4); memmove (append_str + 4, keep_data, strlen (keep_data) + 1); - if (s3_append_insn (append_str, true) == (int) s3_FAIL) + if (s3_append_insn (append_str, true) == s3_FAIL) goto out; } else @@ -4712,7 +4712,7 @@ s3_do_macro_bcmpz (char *str) if (s3_score_pic == s3_NO_PIC) { sprintf (append_str, "cmpi! r%d, 0", reg_a); - if (s3_append_insn (append_str, false) == (int) s3_FAIL) + if (s3_append_insn (append_str, false) == s3_FAIL) goto out; memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it)); if ((inst_main.instruction & 0x3e00007e) == 0x0000004c) @@ -4720,7 +4720,7 @@ s3_do_macro_bcmpz (char *str) else memcpy (append_str, "bne ", 4); memmove (append_str + 4, keep_data, strlen (keep_data) + 1); - if (s3_append_insn (append_str, false) == (int) s3_FAIL) + if (s3_append_insn (append_str, false) == s3_FAIL) goto out; memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it)); } @@ -4798,7 +4798,7 @@ s3_nopic_need_relax (symbolS * sym, int before_relaxing) not be referenced off the $gp, although it appears as though they can. */ symname = S_GET_NAME (sym); - if (symname != (const char *)NULL + if (symname != NULL && (strcmp (symname, "eprol") == 0 || strcmp (symname, "etext") == 0 || strcmp (symname, "_gp") == 0 @@ -4811,13 +4811,15 @@ s3_nopic_need_relax (symbolS * sym, int before_relaxing) { return 1; } - else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym)) && (0 - /* We must defer this decision until after the whole file has been read, - since there might be a .extern after the first use of this symbol. */ - || (before_relaxing - && S_GET_VALUE (sym) == 0) - || (S_GET_VALUE (sym) != 0 - && S_GET_VALUE (sym) <= s3_g_switch_value))) + else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym)) + && (0 + /* We must defer this decision until after the + whole file has been read, since there might be a + .extern after the first use of this symbol. */ + || (before_relaxing + && S_GET_VALUE (sym) == 0) + || (S_GET_VALUE (sym) != 0 + && S_GET_VALUE (sym) <= s3_g_switch_value))) { return 0; } @@ -4861,7 +4863,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) For an external symbol: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it)); @@ -4873,7 +4875,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15; memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it)); sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol)); - if (s3_append_insn (tmp, false) == (int) s3_FAIL) + if (s3_append_insn (tmp, false) == s3_FAIL) return; memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it)); @@ -4881,7 +4883,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) /* Insn 2 or Insn 3: lw/st rD, [r1, constant] */ sprintf (tmp, "%s r%d, [r1, %d]", insn_name, reg_rd, add_number); - if (s3_append_insn (tmp, true) == (int) s3_FAIL) + if (s3_append_insn (tmp, true) == s3_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4917,10 +4919,10 @@ s3_do_macro_ldst_label (char *str) backup_str = verifystr; s3_skip_whitespace (backup_str); - if ((reg_rd = s3_reg_required_here (&backup_str, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg_rd = s3_reg_required_here (&backup_str, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) return; - if (s3_skip_past_comma (&backup_str) == (int) s3_FAIL) + if (s3_skip_past_comma (&backup_str) == s3_FAIL) return; label_str = backup_str; @@ -4937,18 +4939,18 @@ s3_do_macro_ldst_label (char *str) absolute_value = backup_str; s3_inst.type = Rd_rvalueRs_SI15; - if (s3_my_get_expression (&s3_inst.reloc.exp, &backup_str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &backup_str) == s3_FAIL) { s3_inst.error = _("expression error"); return; } else if ((s3_inst.reloc.exp.X_add_symbol == NULL) - && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _VALUE, 0) == (int) s3_FAIL)) + && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _VALUE, 0) == s3_FAIL)) { s3_inst.error = _("value not in range [0, 0x7fffffff]"); return; } - else if (s3_end_of_line (backup_str) == (int) s3_FAIL) + else if (s3_end_of_line (backup_str) == s3_FAIL) { s3_inst.error = _("end on line error"); return; @@ -4966,8 +4968,8 @@ s3_do_macro_ldst_label (char *str) /* Ld/st rD, label. */ s3_inst.type = Rd_rvalueRs_SI15; backup_str = absolute_value; - if ((s3_data_op2 (&backup_str, 1, _GP_IMM15) == (int) s3_FAIL) - || (s3_end_of_line (backup_str) == (int) s3_FAIL)) + if ((s3_data_op2 (&backup_str, 1, _GP_IMM15) == s3_FAIL) + || (s3_end_of_line (backup_str) == s3_FAIL)) { return; } @@ -5025,7 +5027,7 @@ s3_do_macro_ldst_label (char *str) ld/st rd, [r1, 0] */ for (i = 0; i < 3; i++) { - if (s3_append_insn (append_str[i], false) == (int) s3_FAIL) + if (s3_append_insn (append_str[i], false) == s3_FAIL) return; memcpy (&inst_expand[i], &s3_inst, sizeof (struct s3_score_it)); @@ -5118,10 +5120,10 @@ s3_do_lw_pic (char *str) int reg_rd; s3_skip_whitespace (str); - if (((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) - || (s3_skip_past_comma (&str) == (int) s3_FAIL) - || (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL) - || (s3_end_of_line (str) == (int) s3_FAIL)) + if (((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL) + || (s3_skip_past_comma (&str) == s3_FAIL) + || (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL) + || (s3_end_of_line (str) == s3_FAIL)) { return; } @@ -5155,7 +5157,7 @@ s3_do_empty (char *str) return; } } - if (s3_end_of_line (str) == (int) s3_FAIL) + if (s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.relax_inst != 0x8000) @@ -5184,8 +5186,8 @@ s3_do_jump (char *str) char *save_in; s3_skip_whitespace (str); - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if (s3_inst.reloc.exp.X_add_symbol == 0) @@ -5211,8 +5213,8 @@ s3_do_jump (char *str) static void s3_do_branch (char *str) { - if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -5250,8 +5252,8 @@ s3_do_branch (char *str) static void s3_do16_branch (char *str) { - if ((s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL)) + if ((s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL)) { ; } @@ -5381,8 +5383,8 @@ s3_do16_dsp (char *str) s3_skip_whitespace (str); - if ((rd = s3_reglow_required_here (&str, 0)) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((rd = s3_reglow_required_here (&str, 0)) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -5405,10 +5407,10 @@ s3_do16_dsp2 (char *str) s3_skip_whitespace (str); - if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reglow_required_here (&str, 0) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reglow_required_here (&str, 4) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reglow_required_here (&str, 0) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -5432,10 +5434,10 @@ s3_do_dsp (char *str) s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) ) @@ -5461,12 +5463,12 @@ s3_do_dsp2 (char *str) s3_skip_whitespace (str); - if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) { return; } @@ -5510,10 +5512,10 @@ s3_do_dsp3 (char *str) s3_skip_whitespace (str); - if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_skip_past_comma (&str) == (int) s3_FAIL - || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL - || s3_end_of_line (str) == (int) s3_FAIL) + if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_skip_past_comma (&str) == s3_FAIL + || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL + || s3_end_of_line (str) == s3_FAIL) return; if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) ) @@ -5551,7 +5553,7 @@ s3_s_change_sec (int sec) switch (sec) { case 'r': - seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); + seg = subseg_new (s3_RDATA_SECTION_NAME, get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) @@ -5559,7 +5561,7 @@ s3_s_change_sec (int sec) demand_empty_rest_of_line (); break; case 's': - seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); + seg = subseg_new (".sdata", get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_SMALL_DATA)); if (strcmp (TARGET_OS, "elf") != 0) @@ -5574,7 +5576,7 @@ s3_s_score_mask (int reg_type ATTRIBUTE_UNUSED) { long mask, off; - if (s3_cur_proc_ptr == (s3_procS *) NULL) + if (s3_cur_proc_ptr == NULL) { as_warn (_(".mask outside of .ent")); demand_empty_rest_of_line (); @@ -5601,7 +5603,7 @@ s3_get_symbol (void) symbolS *p; c = get_symbol_name (&name); - p = (symbolS *) symbol_find_or_make (name); + p = symbol_find_or_make (name); (void) restore_line_pointer (c); return p; } @@ -5708,7 +5710,7 @@ s3_s_score_frame (int ignore ATTRIBUTE_UNUSED) backupstr = input_line_pointer; #ifdef OBJ_ELF - if (s3_cur_proc_ptr == (s3_procS *) NULL) + if (s3_cur_proc_ptr == NULL) { as_warn (_(".frame outside of .ent")); demand_empty_rest_of_line (); @@ -5813,13 +5815,13 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED) exp.X_add_number = 0; emit_expr (&exp, 4); fragp = frag_more (7 * 4); - md_number_to_chars (fragp, (valueT) s3_cur_proc_ptr->reg_mask, 4); - md_number_to_chars (fragp + 4, (valueT) s3_cur_proc_ptr->reg_offset, 4); - md_number_to_chars (fragp + 8, (valueT) s3_cur_proc_ptr->fpreg_mask, 4); - md_number_to_chars (fragp + 12, (valueT) s3_cur_proc_ptr->leaf, 4); - md_number_to_chars (fragp + 16, (valueT) s3_cur_proc_ptr->frame_offset, 4); - md_number_to_chars (fragp + 20, (valueT) s3_cur_proc_ptr->frame_reg, 4); - md_number_to_chars (fragp + 24, (valueT) s3_cur_proc_ptr->pc_reg, 4); + md_number_to_chars (fragp, s3_cur_proc_ptr->reg_mask, 4); + md_number_to_chars (fragp + 4, s3_cur_proc_ptr->reg_offset, 4); + md_number_to_chars (fragp + 8, s3_cur_proc_ptr->fpreg_mask, 4); + md_number_to_chars (fragp + 12, s3_cur_proc_ptr->leaf, 4); + md_number_to_chars (fragp + 16, s3_cur_proc_ptr->frame_offset, 4); + md_number_to_chars (fragp + 20, s3_cur_proc_ptr->frame_reg, 4); + md_number_to_chars (fragp + 24, s3_cur_proc_ptr->pc_reg, 4); subseg_set (saved_seg, saved_subseg); } @@ -5903,21 +5905,21 @@ s3_s_score_cpload (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) return; demand_empty_rest_of_line (); sprintf (insn_str, "ld_i32hi r%d, %s", s3_GP, GP_DISP_LABEL); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; sprintf (insn_str, "ld_i32lo r%d, %s", s3_GP, GP_DISP_LABEL); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; sprintf (insn_str, "add r%d, r%d, r%d", s3_GP, s3_GP, reg); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; } @@ -5938,8 +5940,8 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL - || s3_skip_past_comma (&input_line_pointer) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL + || s3_skip_past_comma (&input_line_pointer) == s3_FAIL) { return; } @@ -5949,7 +5951,7 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) if (cprestore_offset <= 0x3fff) { sprintf (insn_str, "sw r%d, [r%d, %d]", s3_GP, reg, cprestore_offset); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; } else @@ -5960,15 +5962,15 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) s3_nor1 = 0; sprintf (insn_str, "li r1, %d", cprestore_offset); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; sprintf (insn_str, "add r1, r1, r%d", reg); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; sprintf (insn_str, "sw r%d, [r1]", s3_GP); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; s3_nor1 = r1_bak; @@ -6018,7 +6020,7 @@ s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL) + if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL) { return; } @@ -6026,7 +6028,7 @@ s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED) /* Add $gp to the register named as an argument. */ sprintf (insn_str, "add r%d, r%d, r%d", reg, reg, s3_GP); - if (s3_append_insn (insn_str, true) == (int) s3_FAIL) + if (s3_append_insn (insn_str, true) == s3_FAIL) return; } @@ -6189,7 +6191,7 @@ s3_s_score_lcomm (int bytes_p) symbol_get_frag (symbolP)->fr_symbol = NULL; symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, (offsetT) temp, NULL); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, temp, NULL); *pfrag = 0; @@ -6449,7 +6451,7 @@ s3_begin (void) s3_build_dependency_insn_hsh (); - for (i = (int)s3_REG_TYPE_FIRST; i < (int)s3_REG_TYPE_MAX; i++) + for (i = s3_REG_TYPE_FIRST; i < s3_REG_TYPE_MAX; i++) s3_build_reg_hsh (s3_all_reg_maps + i); /* Initialize dependency vector. */ @@ -6458,7 +6460,7 @@ s3_begin (void) bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0); seg = now_seg; subseg = now_subseg; - s3_pdr_seg = subseg_new (".pdr", (subsegT) 0); + s3_pdr_seg = subseg_new (".pdr", 0); bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); bfd_set_section_alignment (s3_pdr_seg, 2); subseg_set (seg, subseg); @@ -6477,17 +6479,16 @@ s3_number_to_chars (char *buf, valueT val, int n) } static valueT -s3_normal_chars_to_number (char *buf, int n) +s3_normal_chars_to_number (const char *buf, int n) { valueT result = 0; - unsigned char *where = (unsigned char *)buf; if (target_big_endian) { while (n--) { result <<= 8; - result |= (*where++ & 255); + result |= (*buf++ & 255); } } else @@ -6495,7 +6496,7 @@ s3_normal_chars_to_number (char *buf, int n) while (n--) { result <<= 8; - result |= (where[n] & 255); + result |= (buf[n] & 255); } } @@ -6505,7 +6506,7 @@ s3_normal_chars_to_number (char *buf, int n) static void s3_number_to_chars_littleendian (void *p, valueT data, int n) { - char *buf = (char *) p; + char *buf = p; switch (n) { @@ -6528,7 +6529,7 @@ s3_number_to_chars_littleendian (void *p, valueT data, int n) static valueT s3_chars_to_number_littleendian (const void *p, int n) { - char *buf = (char *) p; + const char *buf = p; valueT result = 0; switch (n) @@ -6614,19 +6615,19 @@ s3_atof (int type, char *litP, int *sizeP) if (target_big_endian) { for (i = 0; i < prec; i++) - { - s3_md_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } + { + s3_md_number_to_chars (litP, words[i], 2); + litP += 2; + } } else { for (i = 0; i < prec; i += 2) - { - s3_md_number_to_chars (litP, (valueT) words[i + 1], 2); - s3_md_number_to_chars (litP + 2, (valueT) words[i], 2); - litP += 4; - } + { + s3_md_number_to_chars (litP, words[i + 1], 2); + s3_md_number_to_chars (litP + 2, words[i], 2); + litP += 4; + } } return 0; @@ -6768,7 +6769,7 @@ s3_relax_branch_inst16 (fragS * fragp) if (s == NULL) frag_addr = 0; else - symbol_address = (addressT) symbol_get_frag (s)->fr_address; + symbol_address = symbol_get_frag (s)->fr_address; inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE); offset = (inst_value & 0x1ff) << 1; @@ -6811,7 +6812,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp) if (s == NULL) frag_addr = 0; else - symbol_address = (addressT) symbol_get_frag (s)->fr_address; + symbol_address = symbol_get_frag (s)->fr_address; inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE); offset = (inst_value & 0x1) diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index b11f69f..7b6b685 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -90,7 +90,7 @@ static void s7_do_lw_pic (char *); #define s7_GP 28 #define s7_PIC_CALL_REG 29 #define s7_MAX_LITERAL_POOL_SIZE 1024 -#define s7_FAIL 0x80000000 +#define s7_FAIL -2147483648 #define s7_SUCCESS 0 #define s7_INSN_SIZE 4 #define s7_INSN16_SIZE 2 @@ -1102,7 +1102,7 @@ s7_end_of_line (char *str) s7_skip_whitespace (str); if (*str != '\0') { - retval = (int) s7_FAIL; + retval = s7_FAIL; if (!s7_inst.error) s7_inst.error = s7_BAD_GARBAGE; @@ -1121,7 +1121,7 @@ s7_score_reg_parse (char **ccp, htab_t htab) p = start; if (!ISALPHA (*p) || !is_name_beginner (*p)) - return (int) s7_FAIL; + return s7_FAIL; c = *p++; @@ -1137,7 +1137,7 @@ s7_score_reg_parse (char **ccp, htab_t htab) *ccp = p; return reg->number; } - return (int) s7_FAIL; + return s7_FAIL; } /* If shift <= 0, only return reg. */ @@ -1145,10 +1145,10 @@ static int s7_reg_required_here (char **str, int shift, enum s7_score_reg_type reg_type) { static char buff[s7_MAX_LITERAL_POOL_SIZE]; - int reg = (int) s7_FAIL; + int reg = s7_FAIL; char *start = *str; - if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[reg_type].htab)) != (int) s7_FAIL) + if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[reg_type].htab)) != s7_FAIL) { if (reg_type == s7_REG_TYPE_SCORE) { @@ -1193,18 +1193,18 @@ s7_skip_past_comma (char **str) if (c == ',' && comma++) { s7_inst.error = s7_BAD_SKIP_COMMA; - return (int) s7_FAIL; + return s7_FAIL; } } if ((c == '\0') || (comma == 0)) { s7_inst.error = s7_BAD_SKIP_COMMA; - return (int) s7_FAIL; + return s7_FAIL; } *str = p; - return comma ? s7_SUCCESS : (int) s7_FAIL; + return comma ? s7_SUCCESS : s7_FAIL; } static void @@ -1212,12 +1212,12 @@ s7_do_rdrsrs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -1271,7 +1271,7 @@ s7_my_get_expression (expressionS * ep, char **str) *str = input_line_pointer; input_line_pointer = save_in; s7_inst.error = _("illegal expression"); - return (int) s7_FAIL; + return s7_FAIL; } /* Get rid of any bignums now, so that we don't generate an error for which we can't establish a line number later on. Big numbers are never valid @@ -1284,7 +1284,7 @@ s7_my_get_expression (expressionS * ep, char **str) s7_inst.error = _("invalid constant"); *str = input_line_pointer; input_line_pointer = save_in; - return (int) s7_FAIL; + return s7_FAIL; } if ((ep->X_add_symbol != NULL) @@ -1300,7 +1300,7 @@ s7_my_get_expression (expressionS * ep, char **str) s7_inst.error = s7_BAD_ARGS; *str = input_line_pointer; input_line_pointer = save_in; - return (int) s7_FAIL; + return s7_FAIL; } *str = input_line_pointer; @@ -1340,14 +1340,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x800 && val <= 0xfff)) { - return (int) s7_FAIL; + return s7_FAIL; } } else { if (!(val >= -2048 && val <= 2047)) { - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1359,14 +1359,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x2000 && val <= 0x3fff)) { - return (int) s7_FAIL; + return s7_FAIL; } } else { if (!(val >= -8192 && val <= 8191)) { - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1378,14 +1378,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x4000 && val <= 0x7fff)) { - return (int) s7_FAIL; + return s7_FAIL; } } else { if (!(val >= -16384 && val <= 16383)) { - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1397,14 +1397,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x8000 && val <= 0xffff)) { - return (int) s7_FAIL; + return s7_FAIL; } } else { if (!(val >= -32768 && val <= 32767)) { - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1416,14 +1416,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) { if (!(val >= -0x7fff && val <= 0xffff && val != 0x8000)) { - return (int) s7_FAIL; + return s7_FAIL; } } else { if (!(val >= -32767 && val <= 32768)) { - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1438,7 +1438,7 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) } else { - return (int) s7_FAIL; + return s7_FAIL; } default: @@ -1452,7 +1452,7 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p) break; } - return (int) s7_FAIL; + return s7_FAIL; } static int @@ -1483,18 +1483,18 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) if (*dataptr == '|') /* process PCE */ { - if (s7_my_get_expression (&s7_inst.reloc.exp, &pp) == (int) s7_FAIL) - return (int) s7_FAIL; + if (s7_my_get_expression (&s7_inst.reloc.exp, &pp) == s7_FAIL) + return s7_FAIL; s7_end_of_line (pp); if (s7_inst.error != 0) - return (int) s7_FAIL; /* to ouptut_inst to printf out the error */ + return s7_FAIL; /* to ouptut_inst to printf out the error */ *str = dataptr; } else /* process 16 bit */ { - if (s7_my_get_expression (&s7_inst.reloc.exp, str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, str) == s7_FAIL) { - return (int) s7_FAIL; + return s7_FAIL; } dataptr = (char *) data_exp; @@ -1546,7 +1546,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) || ((*dataptr == '-') && (*(dataptr + 1) != '0')))) { s7_inst.error = s7_BAD_ARGS; - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1564,7 +1564,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) || (data_type == _IMM4))) { s7_inst.error = s7_BAD_ARGS; - return (int) s7_FAIL; + return s7_FAIL; } if (s7_inst.reloc.exp.X_add_symbol) @@ -1572,7 +1572,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) switch (data_type) { case _SIMM16_LA: - return (int) s7_FAIL; + return s7_FAIL; case _VALUE_HI16: s7_inst.reloc.type = BFD_RELOC_HI16_S; s7_inst.reloc.pc_rel = 0; @@ -1607,7 +1607,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) if (data_type == _SIMM16_LA && s7_inst.reloc.exp.X_unsigned == 1) { value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _SIMM16_LA_POS, hex_p); - if (value == (int) s7_FAIL) /* for advance to check if this is ldis */ + if (value == s7_FAIL) /* for advance to check if this is ldis */ if ((s7_inst.reloc.exp.X_add_number & 0xffff) == 0) { s7_inst.instruction |= 0x8000000; @@ -1620,7 +1620,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p); } - if (value == (int) s7_FAIL) + if (value == s7_FAIL) { if ((data_type != _SIMM14_NEG) && (data_type != _SIMM16_NEG) && (data_type != _IMM16_NEG)) { @@ -1638,7 +1638,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) } s7_inst.error = s7_err_msg; - return (int) s7_FAIL; + return s7_FAIL; } if ((s7_score_df_range[data_type].range[0] != 0) || (data_type == _IMM5_RANGE_8_31)) @@ -1673,7 +1673,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type) && (((s7_inst.instruction >> 20) & 0x1F) != 0x1f)) { s7_inst.error = _("invalid constant: bit expression not defined"); - return (int) s7_FAIL; + return s7_FAIL; } } @@ -1687,10 +1687,10 @@ s7_do_rdsi16 (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 1, _SIMM16) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 1, _SIMM16) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; /* ldi. */ @@ -1720,9 +1720,9 @@ s7_do_sub_rdsi16 (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _SIMM16_NEG) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _SIMM16_NEG) != s7_FAIL) s7_end_of_line (str); } @@ -1734,10 +1734,10 @@ s7_do_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */ { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL) s7_data_op2 (&str, 1, _SIMM14); } @@ -1748,11 +1748,11 @@ s7_do_sub_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */ { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _SIMM14_NEG) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _SIMM14_NEG) != s7_FAIL) s7_end_of_line (str); } @@ -1763,12 +1763,12 @@ s7_do_rdrsi5 (char *str) /* 0~((2^14)-1) */ { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 10, _IMM5) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 10, _IMM5) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if ((((s7_inst.instruction >> 20) & 0x1f) == ((s7_inst.instruction >> 15) & 0x1f)) @@ -1788,11 +1788,11 @@ s7_do_rdrsi14 (char *str) /* 0 ~ ((2^14)-1) */ { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _IMM14) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _IMM14) != s7_FAIL) s7_end_of_line (str); } @@ -1803,10 +1803,10 @@ s7_do_xrsi5 (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 10, _IMM5) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 10, _IMM5) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 15) & 0x10) == 0)) @@ -1825,10 +1825,10 @@ s7_do_rdi16 (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 1, _IMM16) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 1, _IMM16) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; } @@ -1838,8 +1838,8 @@ s7_do_macro_rdi32hi (char *str) s7_skip_whitespace (str); /* Do not handle s7_end_of_line(). */ - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL) s7_data_op2 (&str, 1, _VALUE_HI16); } @@ -1849,8 +1849,8 @@ s7_do_macro_rdi32lo (char *str) s7_skip_whitespace (str); /* Do not handle s7_end_of_line(). */ - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL) s7_data_op2 (&str, 1, _VALUE_LO16); } @@ -1861,9 +1861,9 @@ s7_do_rdi16_pic (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _IMM16_pic) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _IMM16_pic) != s7_FAIL) s7_end_of_line (str); } @@ -1874,9 +1874,9 @@ s7_do_addi_s_pic (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _SIMM16_pic) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _SIMM16_pic) != s7_FAIL) s7_end_of_line (str); } @@ -1887,9 +1887,9 @@ s7_do_addi_u_pic (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_data_op2 (&str, 1, _IMM16_LO16_pic) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_data_op2 (&str, 1, _IMM16_LO16_pic) != s7_FAIL) s7_end_of_line (str); } @@ -1900,7 +1900,7 @@ s7_do_rd (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL) s7_end_of_line (str); } @@ -1909,8 +1909,8 @@ s7_do_rs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 15) & 0x10) == 0)) @@ -1927,7 +1927,7 @@ s7_do_i15 (char *str) { s7_skip_whitespace (str); - if (s7_data_op2 (&str, 10, _IMM15) != (int) s7_FAIL) + if (s7_data_op2 (&str, 10, _IMM15) != s7_FAIL) s7_end_of_line (str); } @@ -1936,7 +1936,7 @@ s7_do_xi5x (char *str) { s7_skip_whitespace (str); - if (s7_data_op2 (&str, 15, _IMM5) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_data_op2 (&str, 15, _IMM5) == s7_FAIL || s7_end_of_line (str) == s7_FAIL) return; if (s7_inst.relax_inst != 0x8000) @@ -1951,10 +1951,10 @@ s7_do_rdrs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if (s7_inst.relax_inst != 0x8000) @@ -2005,9 +2005,9 @@ s7_do_rdcrs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) != s7_FAIL) s7_end_of_line (str); } @@ -2021,15 +2021,15 @@ s7_do_rdsrs (char *str) /* mfsr */ if ((s7_inst.instruction & 0xff) == 0x50) { - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR) != s7_FAIL) s7_end_of_line (str); } else { - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL) s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR); } } @@ -2041,10 +2041,10 @@ s7_do_rdxrs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 10) & 0x10) == 0) @@ -2063,10 +2063,10 @@ s7_do_rsrs (char *str) { s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 20) & 0x1f) == 3) @@ -2087,23 +2087,23 @@ s7_do_ceinst (char *str) strbak = str; s7_skip_whitespace (str); - if (s7_data_op2 (&str, 20, _IMM5) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 5, _IMM5) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 0, _IMM5) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_data_op2 (&str, 20, _IMM5) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 5, _IMM5) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 0, _IMM5) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } else { str = strbak; - if (s7_data_op2 (&str, 0, _IMM25) == (int) s7_FAIL) + if (s7_data_op2 (&str, 0, _IMM25) == s7_FAIL) return; } } @@ -2115,7 +2115,7 @@ s7_reglow_required_here (char **str, int shift) int reg; char *start = *str; - if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != (int) s7_FAIL) + if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != s7_FAIL) { if ((reg == 1) && (s7_nor1 == 1) && (s7_inst.bwarn == 0)) { @@ -2135,7 +2135,7 @@ s7_reglow_required_here (char **str, int shift) *str = start; sprintf (buff, _("low register(r0-r15)expected, not '%.100s'"), start); s7_inst.error = buff; - return (int) s7_FAIL; + return s7_FAIL; } /* Handle addc!/add!/and!/cmp!/neg!/not!/or!/sll!/srl!/sra!/xor!/sub!. */ @@ -2145,10 +2145,10 @@ s7_do16_rdrs (char *str) { s7_skip_whitespace (str); - if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reglow_required_here (&str, 4) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reglow_required_here (&str, 8) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reglow_required_here (&str, 4) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -2185,8 +2185,8 @@ s7_do16_rs (char *str) s7_skip_whitespace (str); - if ((rd = s7_reglow_required_here (&str, 4)) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if ((rd = s7_reglow_required_here (&str, 4)) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -2204,7 +2204,7 @@ s7_do16_xrs (char *str) { s7_skip_whitespace (str); - if (s7_reglow_required_here (&str, 4) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reglow_required_here (&str, 4) == s7_FAIL || s7_end_of_line (str) == s7_FAIL) { return; } @@ -2223,7 +2223,7 @@ s7_reghigh_required_here (char **str, int shift) int reg; char *start = *str; - if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != (int) s7_FAIL) + if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != s7_FAIL) { if (15 < reg && reg < 32) { @@ -2237,7 +2237,7 @@ s7_reghigh_required_here (char **str, int shift) *str = start; sprintf (buff, _("high register(r16-r31)expected, not '%.100s'"), start); s7_inst.error = buff; - return (int) s7_FAIL; + return s7_FAIL; } /* Handle mhfl!. */ @@ -2247,10 +2247,10 @@ s7_do16_hrdrs (char *str) { s7_skip_whitespace (str); - if (s7_reghigh_required_here (&str, 8) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reglow_required_here (&str, 4) != (int) s7_FAIL - && s7_end_of_line (str) != (int) s7_FAIL) + if (s7_reghigh_required_here (&str, 8) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reglow_required_here (&str, 4) != s7_FAIL + && s7_end_of_line (str) != s7_FAIL) { s7_inst.relax_inst |= ((((s7_inst.instruction >> 8) & 0xf) | 0x10) << 20) | (((s7_inst.instruction >> 4) & 0xf) << 15) | (0xf << 10); @@ -2265,10 +2265,10 @@ s7_do16_rdhrs (char *str) { s7_skip_whitespace (str); - if (s7_reglow_required_here (&str, 8) != (int) s7_FAIL - && s7_skip_past_comma (&str) != (int) s7_FAIL - && s7_reghigh_required_here (&str, 4) != (int) s7_FAIL - && s7_end_of_line (str) != (int) s7_FAIL) + if (s7_reglow_required_here (&str, 8) != s7_FAIL + && s7_skip_past_comma (&str) != s7_FAIL + && s7_reghigh_required_here (&str, 4) != s7_FAIL + && s7_end_of_line (str) != s7_FAIL) { s7_inst.relax_inst |= (((s7_inst.instruction >> 8) & 0xf) << 20) | ((((s7_inst.instruction >> 4) & 0xf) | 0x10) << 15) | (0xf << 10); @@ -2544,7 +2544,7 @@ s7_handle_dependency (struct s7_score_it *theinst) static enum insn_class s7_get_insn_class_from_type (enum score_insn_type type) { - enum insn_class retval = (int) s7_FAIL; + enum insn_class retval = s7_FAIL; switch (type) { @@ -2826,7 +2826,7 @@ s7_append_insn (char *str, bool gen_frag_p) if (s7_inst.error) { - retval = (int) s7_FAIL; + retval = s7_FAIL; as_bad (_("%s -- `%s'"), s7_inst.error, s7_inst.str); s7_inst.error = NULL; } @@ -2847,10 +2847,10 @@ s7_do16_mv_rdrs (char *str) backupstr = str; s7_skip_whitespace (str); - if ((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || (reg_rs = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if ((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || (reg_rs = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -2870,7 +2870,7 @@ s7_do16_mv_rdrs (char *str) char append_str[s7_MAX_LITERAL_POOL_SIZE]; sprintf (append_str, "mlfh! %s", backupstr); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ s7_inst.bwarn = -1; @@ -2889,7 +2889,7 @@ s7_do16_mv_rdrs (char *str) char append_str[s7_MAX_LITERAL_POOL_SIZE]; sprintf (append_str, "mhfl! %s", backupstr); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -2904,10 +2904,10 @@ s7_do16_rdi4 (char *str) { s7_skip_whitespace (str); - if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 3, _IMM4) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reglow_required_here (&str, 8) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 3, _IMM4) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -2947,10 +2947,10 @@ s7_do16_rdi5 (char *str) { s7_skip_whitespace (str); - if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_data_op2 (&str, 3, _IMM5) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_reglow_required_here (&str, 8) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_data_op2 (&str, 3, _IMM5) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; else { @@ -2967,7 +2967,7 @@ s7_do16_xi5 (char *str) { s7_skip_whitespace (str); - if (s7_data_op2 (&str, 3, _IMM5) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_data_op2 (&str, 3, _IMM5) == s7_FAIL || s7_end_of_line (str) == s7_FAIL) return; else { @@ -2987,7 +2987,7 @@ s7_validate_immediate_align (int val, unsigned int data_type) if (val % 2) { s7_inst.error = _("address offset must be half word alignment"); - return (int) s7_FAIL; + return s7_FAIL; } } else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2)) @@ -2995,7 +2995,7 @@ s7_validate_immediate_align (int val, unsigned int data_type) if (val % 4) { s7_inst.error = _("address offset must be word alignment"); - return (int) s7_FAIL; + return s7_FAIL; } } @@ -3035,19 +3035,19 @@ s7_exp_ldst_offset (char **str, int shift, unsigned int data_type) } } - if (s7_my_get_expression (&s7_inst.reloc.exp, str) == (int) s7_FAIL) - return (int) s7_FAIL; + if (s7_my_get_expression (&s7_inst.reloc.exp, str) == s7_FAIL) + return s7_FAIL; if (s7_inst.reloc.exp.X_op == O_constant) { /* Need to check the immediate align. */ int value = s7_validate_immediate_align (s7_inst.reloc.exp.X_add_number, data_type); - if (value == (int) s7_FAIL) - return (int) s7_FAIL; + if (value == s7_FAIL) + return s7_FAIL; value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p); - if (value == (int) s7_FAIL) + if (value == s7_FAIL) { if (data_type < 30) sprintf (s7_err_msg, @@ -3060,7 +3060,7 @@ s7_exp_ldst_offset (char **str, int shift, unsigned int data_type) s7_score_df_range[data_type - 24].bits, s7_score_df_range[data_type - 24].range[0], s7_score_df_range[data_type - 24].range[1]); s7_inst.error = s7_err_msg; - return (int) s7_FAIL; + return s7_FAIL; } if (data_type == _IMM5_RSHIFT_1) @@ -3102,8 +3102,8 @@ s7_do_ldst_insn (char *str) s7_skip_whitespace (str); - if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) return; /* ld/sw rD, [rA, simm15] ld/sw rD, [rA]+, simm12 ld/sw rD, [rA, simm12]+. */ @@ -3112,7 +3112,7 @@ s7_do_ldst_insn (char *str) str++; s7_skip_whitespace (str); - if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL) return; /* Conflicts can occur on stores as well as loads. */ @@ -3130,8 +3130,8 @@ s7_do_ldst_insn (char *str) /* ld/sw rD, [rA]+, simm12. */ if (s7_skip_past_comma (&str) == s7_SUCCESS) { - if ((s7_exp_ldst_offset (&str, 3, _SIMM12) == (int) s7_FAIL) - || (s7_end_of_line (str) == (int) s7_FAIL)) + if ((s7_exp_ldst_offset (&str, 3, _SIMM12) == s7_FAIL) + || (s7_end_of_line (str) == s7_FAIL)) return; if (conflict_reg) @@ -3183,7 +3183,7 @@ s7_do_ldst_insn (char *str) else { s7_SET_INSN_ERROR (NULL); - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) { return; } @@ -3202,7 +3202,7 @@ s7_do_ldst_insn (char *str) /* ld/sw rD, [rA] convert to ld/sw rD, [rA, simm15]. */ else { - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; ldst_idx = s7_inst.instruction & OPC_PSEUDOLDST_MASK; @@ -3259,13 +3259,13 @@ s7_do_ldst_insn (char *str) /* ld/sw rD, [rA, simm15] ld/sw rD, [rA, simm12]+. */ else { - if (s7_skip_past_comma (&str) == (int) s7_FAIL) + if (s7_skip_past_comma (&str) == s7_FAIL) { s7_inst.error = _("pre-indexed expression expected"); return; } - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL) return; s7_skip_whitespace (str); @@ -3297,7 +3297,7 @@ s7_do_ldst_insn (char *str) } } - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; if (s7_inst.reloc.exp.X_op == O_constant) @@ -3336,7 +3336,7 @@ s7_do_ldst_insn (char *str) } value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p); - if (value == (int) s7_FAIL) + if (value == s7_FAIL) { if (data_type < 30) sprintf (s7_err_msg, @@ -3606,7 +3606,7 @@ s7_do_cache (char *str) { s7_skip_whitespace (str); - if ((s7_data_op2 (&str, 20, _IMM5) == (int) s7_FAIL) || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if ((s7_data_op2 (&str, 20, _IMM5) == s7_FAIL) || (s7_skip_past_comma (&str) == s7_FAIL)) { return; } @@ -3623,13 +3623,13 @@ s7_do_cache (char *str) str++; s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL) return; s7_skip_whitespace (str); /* cache op, [rA] */ - if (s7_skip_past_comma (&str) == (int) s7_FAIL) + if (s7_skip_past_comma (&str) == s7_FAIL) { s7_SET_INSN_ERROR (NULL); if (*str != ']') @@ -3642,7 +3642,7 @@ s7_do_cache (char *str) /* cache op, [rA, simm15] */ else { - if (s7_exp_ldst_offset (&str, 0, _SIMM15) == (int) s7_FAIL) + if (s7_exp_ldst_offset (&str, 0, _SIMM15) == s7_FAIL) { return; } @@ -3655,7 +3655,7 @@ s7_do_cache (char *str) } } - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; } else @@ -3672,21 +3672,21 @@ s7_do_crdcrscrsimm5 (char *str) strbak = str; s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL - || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE_CR) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL + || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_CR) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL) { str = strbak; /* cop1 cop_code20. */ - if (s7_data_op2 (&str, 5, _IMM20) == (int) s7_FAIL) + if (s7_data_op2 (&str, 5, _IMM20) == s7_FAIL) return; } else { - if (s7_data_op2 (&str, 5, _IMM5) == (int) s7_FAIL) + if (s7_data_op2 (&str, 5, _IMM5) == s7_FAIL) return; } @@ -3699,8 +3699,8 @@ s7_do_ldst_cop (char *str) { s7_skip_whitespace (str); - if ((s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if ((s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) return; if (*str == '[') @@ -3708,14 +3708,14 @@ s7_do_ldst_cop (char *str) str++; s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL) return; s7_skip_whitespace (str); if (*str++ != ']') { - if (s7_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == (int) s7_FAIL) + if (s7_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == s7_FAIL) return; s7_skip_whitespace (str); @@ -3737,7 +3737,7 @@ s7_do16_ldst_insn (char *str) { s7_skip_whitespace (str); - if ((s7_reglow_required_here (&str, 8) == (int) s7_FAIL) || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if ((s7_reglow_required_here (&str, 8) == s7_FAIL) || (s7_skip_past_comma (&str) == s7_FAIL)) return; if (*str == '[') @@ -3747,13 +3747,13 @@ s7_do16_ldst_insn (char *str) str++; s7_skip_whitespace (str); - if ((reg = s7_reglow_required_here (&str, 4)) == (int) s7_FAIL) + if ((reg = s7_reglow_required_here (&str, 4)) == s7_FAIL) return; s7_skip_whitespace (str); if (*str++ == ']') { - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; else { @@ -3782,13 +3782,13 @@ s7_do16_ldst_imm_insn (char *str) int reg_rd; char *dataptr = NULL, *pp = NULL; int cnt = 0; - int assign_data = (int) s7_FAIL; + int assign_data = s7_FAIL; unsigned int ldst_func; s7_skip_whitespace (str); - if (((reg_rd = s7_reglow_required_here (&str, 8)) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if (((reg_rd = s7_reglow_required_here (&str, 8)) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) return; s7_skip_whitespace (str); @@ -3816,7 +3816,7 @@ s7_do16_ldst_imm_insn (char *str) else assign_data = s7_exp_ldst_offset (&pp, 3, _IMM5); - if ((assign_data == (int) s7_FAIL) || (s7_end_of_line (pp) == (int) s7_FAIL)) + if ((assign_data == s7_FAIL) || (s7_end_of_line (pp) == s7_FAIL)) return; else { @@ -3855,8 +3855,8 @@ s7_do16_push_pop (char *str) int H_bit_mask = 0; s7_skip_whitespace (str); - if (((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if (((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) return; if (reg_rd >= 16) @@ -3873,7 +3873,7 @@ s7_do16_push_pop (char *str) str++; s7_skip_whitespace (str); - if ((reg = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == s7_FAIL) return; else if (reg > 7) { @@ -3884,7 +3884,7 @@ s7_do16_push_pop (char *str) } s7_skip_whitespace (str); - if ((*str++ != ']') || (s7_end_of_line (str) == (int) s7_FAIL)) + if ((*str++ != ']') || (s7_end_of_line (str) == s7_FAIL)) { if (!s7_inst.error) s7_inst.error = _("missing ]"); @@ -3948,7 +3948,7 @@ s7_do_ldst_unalign (char *str) str++; s7_skip_whitespace (str); - if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL) + if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL) return; if (*str++ == ']') @@ -3965,14 +3965,14 @@ s7_do_ldst_unalign (char *str) return; } - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; } /* lcw/lce/scb/sce rD, [rA]+. */ else { - if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) { return; } @@ -3983,7 +3983,7 @@ s7_do_ldst_unalign (char *str) int reg; s7_skip_whitespace (str); - if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL) { return; } @@ -4010,7 +4010,7 @@ s7_do_ldst_unalign (char *str) return; } - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; } else @@ -4040,8 +4040,8 @@ s7_do_ldst_atomic (char *str) s7_skip_whitespace (str); - if ((s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL)) + if ((s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL)) { return; } @@ -4054,7 +4054,7 @@ s7_do_ldst_atomic (char *str) int reg; s7_skip_whitespace (str); - if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL) { return; } @@ -4199,7 +4199,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) For an external symbol: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; if (reg_rd == s7_PIC_CALL_REG) @@ -4213,7 +4213,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15; memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it)); sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&var_insts[1], &s7_inst, sizeof (struct s7_score_it)); @@ -4223,7 +4223,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) { /* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, true) == (int) s7_FAIL) + if (s7_append_insn (tmp, true) == s7_FAIL) return; /* Insn 2 */ @@ -4232,7 +4232,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Fix part For an external symbol: addi rD, <constant> */ sprintf (tmp, "addi r%d, %d", reg_rd, (int) add_number); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4241,7 +4241,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */ sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd, S_GET_NAME (add_symbol), (int) add_number); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4254,7 +4254,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, true) == (int) s7_FAIL) + if (s7_append_insn (tmp, true) == s7_FAIL) return; /* Insn 2 */ @@ -4263,7 +4263,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Fix part For an external symbol: ldis r1, HI%<constant> */ sprintf (tmp, "ldis r1, %d", hi); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4276,7 +4276,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) hi += 1; } sprintf (tmp, "ldis_pic r1, %d", hi); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4288,7 +4288,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Fix part For an external symbol: ori r1, LO%<constant> */ sprintf (tmp, "ori r1, %d", lo); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4296,7 +4296,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Var part For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */ sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4304,7 +4304,7 @@ s7_build_la_pic (int reg_rd, expressionS exp) /* Insn 4: add rD, rD, r1 */ sprintf (tmp, "add r%d, r%d, r1", reg_rd, reg_rd); - if (s7_append_insn (tmp, true) == (int) s7_FAIL) + if (s7_append_insn (tmp, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4322,8 +4322,8 @@ s7_do_macro_la_rdi32 (char *str) int reg_rd; s7_skip_whitespace (str); - if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL) + if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL) { return; } @@ -4333,13 +4333,13 @@ s7_do_macro_la_rdi32 (char *str) char *keep_data = str; /* Check immediate value. */ - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL) { s7_inst.error = _("expression error"); return; } else if ((s7_inst.reloc.exp.X_add_symbol == NULL) - && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _IMM32, 0) == (int) s7_FAIL)) + && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _IMM32, 0) == s7_FAIL)) { s7_inst.error = _("value not in range [0, 0xffffffff]"); return; @@ -4349,7 +4349,7 @@ s7_do_macro_la_rdi32 (char *str) str = keep_data; /* la rd, simm16. */ - if (s7_data_op2 (&str, 1, _SIMM16_LA) != (int) s7_FAIL) + if (s7_data_op2 (&str, 1, _SIMM16_LA) != s7_FAIL) { s7_end_of_line (str); return; @@ -4359,8 +4359,8 @@ s7_do_macro_la_rdi32 (char *str) { s7_SET_INSN_ERROR (NULL); str = keep_data; - if ((s7_data_op2 (&str, 1, _VALUE_HI16) == (int) s7_FAIL) - || (s7_end_of_line (str) == (int) s7_FAIL)) + if ((s7_data_op2 (&str, 1, _VALUE_HI16) == s7_FAIL) + || (s7_end_of_line (str) == s7_FAIL)) { return; } @@ -4369,11 +4369,11 @@ s7_do_macro_la_rdi32 (char *str) if ((s7_score_pic == s7_NO_PIC) || (!s7_inst.reloc.exp.X_add_symbol)) { sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; } else @@ -4397,8 +4397,8 @@ s7_do_macro_li_rdi32 (char *str) int reg_rd; s7_skip_whitespace (str); - if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL - || s7_skip_past_comma (&str) == (int) s7_FAIL) + if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL + || s7_skip_past_comma (&str) == s7_FAIL) { return; } @@ -4407,7 +4407,7 @@ s7_do_macro_li_rdi32 (char *str) char *keep_data = str; /* Check immediate value. */ - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL) { s7_inst.error = _("expression error"); return; @@ -4423,7 +4423,7 @@ s7_do_macro_li_rdi32 (char *str) str = keep_data; /* li rd, simm16. */ - if (s7_data_op2 (&str, 1, _SIMM16_LA) != (int) s7_FAIL) + if (s7_data_op2 (&str, 1, _SIMM16_LA) != s7_FAIL) { s7_end_of_line (str); return; @@ -4435,8 +4435,8 @@ s7_do_macro_li_rdi32 (char *str) str = keep_data; - if ((s7_data_op2 (&str, 1, _VALUE_HI16) == (int) s7_FAIL) - || (s7_end_of_line (str) == (int) s7_FAIL)) + if ((s7_data_op2 (&str, 1, _VALUE_HI16) == s7_FAIL) + || (s7_end_of_line (str) == s7_FAIL)) { return; } @@ -4449,12 +4449,12 @@ s7_do_macro_li_rdi32 (char *str) { sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; else { sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data); - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4482,15 +4482,15 @@ s7_do_macro_mul_rdrsrs (char *str) strcpy (append_str, str); backupstr = append_str; s7_skip_whitespace (backupstr); - if (((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_skip_past_comma (&backupstr) == (int) s7_FAIL) - || ((reg_rs1 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)) + if (((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_skip_past_comma (&backupstr) == s7_FAIL) + || ((reg_rs1 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)) { s7_inst.error = s7_BAD_ARGS; return; } - if (s7_skip_past_comma (&backupstr) == (int) s7_FAIL) + if (s7_skip_past_comma (&backupstr) == s7_FAIL) { /* rem/remu rA, rB is error format. */ if (strcmp (s7_inst.name, "rem") == 0 || strcmp (s7_inst.name, "remu") == 0) @@ -4507,8 +4507,8 @@ s7_do_macro_mul_rdrsrs (char *str) else { s7_SET_INSN_ERROR (NULL); - if (((reg_rs2 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_end_of_line (backupstr) == (int) s7_FAIL)) + if (((reg_rs2 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_end_of_line (backupstr) == s7_FAIL)) { return; } @@ -4533,11 +4533,11 @@ s7_do_macro_mul_rdrsrs (char *str) } /* Output mul/mulu or div/divu or rem/remu. */ - if (s7_append_insn (append_str, true) == (int) s7_FAIL) + if (s7_append_insn (append_str, true) == s7_FAIL) return; /* Output mfcel or mfceh. */ - if (s7_append_insn (append_str1, true) == (int) s7_FAIL) + if (s7_append_insn (append_str1, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4563,11 +4563,11 @@ s7_exp_macro_ldst_abs (char *str) strcpy (verifystr, str); backupstr = verifystr; s7_skip_whitespace (backupstr); - if ((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) return; tmp = backupstr; - if (s7_skip_past_comma (&backupstr) == (int) s7_FAIL) + if (s7_skip_past_comma (&backupstr) == s7_FAIL) return; backupstr = tmp; @@ -4661,7 +4661,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) For an external symbol: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */ sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it)); @@ -4673,7 +4673,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15; memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it)); sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol)); - if (s7_append_insn (tmp, false) == (int) s7_FAIL) + if (s7_append_insn (tmp, false) == s7_FAIL) return; memcpy (&var_insts[1], &s7_inst, sizeof (struct s7_score_it)); @@ -4681,7 +4681,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name) /* Insn 2 or Insn 3: lw/st rD, [r1, constant] */ sprintf (tmp, "%s r%d, [r1, %d]", insn_name, reg_rd, add_number); - if (s7_append_insn (tmp, true) == (int) s7_FAIL) + if (s7_append_insn (tmp, true) == s7_FAIL) return; /* Set bwarn as -1, so macro instruction itself will not be generated frag. */ @@ -4717,10 +4717,10 @@ s7_do_macro_ldst_label (char *str) backup_str = verifystr; s7_skip_whitespace (backup_str); - if ((reg_rd = s7_reg_required_here (&backup_str, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg_rd = s7_reg_required_here (&backup_str, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) return; - if (s7_skip_past_comma (&backup_str) == (int) s7_FAIL) + if (s7_skip_past_comma (&backup_str) == s7_FAIL) return; label_str = backup_str; @@ -4737,18 +4737,18 @@ s7_do_macro_ldst_label (char *str) absolute_value = backup_str; s7_inst.type = Rd_rvalueRs_SI15; - if (s7_my_get_expression (&s7_inst.reloc.exp, &backup_str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &backup_str) == s7_FAIL) { s7_inst.error = _("expression error"); return; } else if ((s7_inst.reloc.exp.X_add_symbol == NULL) - && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _VALUE, 0) == (int) s7_FAIL)) + && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _VALUE, 0) == s7_FAIL)) { s7_inst.error = _("value not in range [0, 0x7fffffff]"); return; } - else if (s7_end_of_line (backup_str) == (int) s7_FAIL) + else if (s7_end_of_line (backup_str) == s7_FAIL) { s7_inst.error = _("end on line error"); return; @@ -4766,8 +4766,8 @@ s7_do_macro_ldst_label (char *str) /* Ld/st rD, label. */ s7_inst.type = Rd_rvalueRs_SI15; backup_str = absolute_value; - if ((s7_data_op2 (&backup_str, 1, _GP_IMM15) == (int) s7_FAIL) - || (s7_end_of_line (backup_str) == (int) s7_FAIL)) + if ((s7_data_op2 (&backup_str, 1, _GP_IMM15) == s7_FAIL) + || (s7_end_of_line (backup_str) == s7_FAIL)) { return; } @@ -4825,7 +4825,7 @@ s7_do_macro_ldst_label (char *str) ld/st rd, [r1, 0] */ for (i = 0; i < 3; i++) { - if (s7_append_insn (append_str[i], false) == (int) s7_FAIL) + if (s7_append_insn (append_str[i], false) == s7_FAIL) return; memcpy (&inst_expand[i], &s7_inst, sizeof (struct s7_score_it)); @@ -4903,10 +4903,10 @@ s7_do_lw_pic (char *str) int reg_rd; s7_skip_whitespace (str); - if (((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) - || (s7_skip_past_comma (&str) == (int) s7_FAIL) - || (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL) - || (s7_end_of_line (str) == (int) s7_FAIL)) + if (((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL) + || (s7_skip_past_comma (&str) == s7_FAIL) + || (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL) + || (s7_end_of_line (str) == s7_FAIL)) { return; } @@ -4940,7 +4940,7 @@ s7_do_empty (char *str) return; } } - if (s7_end_of_line (str) == (int) s7_FAIL) + if (s7_end_of_line (str) == s7_FAIL) return; if (s7_inst.relax_inst != 0x8000) @@ -4962,8 +4962,8 @@ s7_do_jump (char *str) char *save_in; s7_skip_whitespace (str); - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) return; if (s7_inst.reloc.exp.X_add_symbol == 0) @@ -4990,8 +4990,8 @@ static void s7_do16_jump (char *str) { s7_skip_whitespace (str); - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -5016,8 +5016,8 @@ s7_do_branch (char *str) { unsigned long abs_value = 0; - if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL) + if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL) { return; } @@ -5055,8 +5055,8 @@ s7_do_branch (char *str) static void s7_do16_branch (char *str) { - if ((s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL - || s7_end_of_line (str) == (int) s7_FAIL)) + if ((s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL + || s7_end_of_line (str) == s7_FAIL)) { ; } @@ -5130,14 +5130,13 @@ static valueT s7_md_chars_to_number (char *buf, int n) { valueT result = 0; - unsigned char *where = (unsigned char *) buf; if (target_big_endian) { while (n--) { result <<= 8; - result |= (*where++ & 255); + result |= (*buf++ & 255); } } else @@ -5145,7 +5144,7 @@ s7_md_chars_to_number (char *buf, int n) while (n--) { result <<= 8; - result |= (where[n] & 255); + result |= (buf[n] & 255); } } @@ -5252,7 +5251,7 @@ s7_b32_relax_to_b16 (fragS * fragp) if (s == NULL) frag_addr = 0; else - symbol_address = (addressT) symbol_get_frag (s)->fr_address; + symbol_address = symbol_get_frag (s)->fr_address; value = s7_md_chars_to_number (fragp->fr_literal, s7_INSN_SIZE); @@ -5391,7 +5390,7 @@ s7_s_change_sec (int sec) switch (sec) { case 'r': - seg = subseg_new (s7_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); + seg = subseg_new (s7_RDATA_SECTION_NAME, get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) @@ -5399,7 +5398,7 @@ s7_s_change_sec (int sec) demand_empty_rest_of_line (); break; case 's': - seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); + seg = subseg_new (".sdata", get_absolute_expression ()); bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_SMALL_DATA)); if (strcmp (TARGET_OS, "elf") != 0) @@ -5441,7 +5440,7 @@ s7_get_symbol (void) symbolS *p; c = get_symbol_name (&name); - p = (symbolS *) symbol_find_or_make (name); + p = symbol_find_or_make (name); (void) restore_line_pointer (c); return p; } @@ -5655,13 +5654,13 @@ s7_s_score_end (int x ATTRIBUTE_UNUSED) exp.X_add_number = 0; emit_expr (&exp, 4); fragp = frag_more (7 * 4); - s7_number_to_chars (fragp, (valueT) s7_cur_proc_ptr->reg_mask, 4); - s7_number_to_chars (fragp + 4, (valueT) s7_cur_proc_ptr->reg_offset, 4); - s7_number_to_chars (fragp + 8, (valueT) s7_cur_proc_ptr->fpreg_mask, 4); - s7_number_to_chars (fragp + 12, (valueT) s7_cur_proc_ptr->leaf, 4); - s7_number_to_chars (fragp + 16, (valueT) s7_cur_proc_ptr->frame_offset, 4); - s7_number_to_chars (fragp + 20, (valueT) s7_cur_proc_ptr->frame_reg, 4); - s7_number_to_chars (fragp + 24, (valueT) s7_cur_proc_ptr->pc_reg, 4); + s7_number_to_chars (fragp, s7_cur_proc_ptr->reg_mask, 4); + s7_number_to_chars (fragp + 4, s7_cur_proc_ptr->reg_offset, 4); + s7_number_to_chars (fragp + 8, s7_cur_proc_ptr->fpreg_mask, 4); + s7_number_to_chars (fragp + 12, s7_cur_proc_ptr->leaf, 4); + s7_number_to_chars (fragp + 16, s7_cur_proc_ptr->frame_offset, 4); + s7_number_to_chars (fragp + 20, s7_cur_proc_ptr->frame_reg, 4); + s7_number_to_chars (fragp + 24, s7_cur_proc_ptr->pc_reg, 4); subseg_set (saved_seg, saved_subseg); } @@ -5679,7 +5678,7 @@ s7_s_score_set (int x ATTRIBUTE_UNUSED) while (!is_end_of_stmt (*input_line_pointer)) { - name[i] = (char) * input_line_pointer; + name[i] = *input_line_pointer; i++; ++input_line_pointer; } @@ -5747,21 +5746,21 @@ s7_s_score_cpload (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) return; demand_empty_rest_of_line (); sprintf (insn_str, "ld_i32hi r%d, %s", s7_GP, GP_DISP_LABEL); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; sprintf (insn_str, "ld_i32lo r%d, %s", s7_GP, GP_DISP_LABEL); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; sprintf (insn_str, "add r%d, r%d, r%d", s7_GP, s7_GP, reg); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; } @@ -5783,8 +5782,8 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL - || s7_skip_past_comma (&input_line_pointer) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL + || s7_skip_past_comma (&input_line_pointer) == s7_FAIL) { return; } @@ -5794,7 +5793,7 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) if (cprestore_offset <= 0x3fff) { sprintf (insn_str, "sw r%d, [r%d, %d]", s7_GP, reg, cprestore_offset); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; } else @@ -5805,15 +5804,15 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED) s7_nor1 = 0; sprintf (insn_str, "li r1, %d", cprestore_offset); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; sprintf (insn_str, "add r1, r1, r%d", reg); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; sprintf (insn_str, "sw r%d, [r1]", s7_GP); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; s7_nor1 = r1_bak; @@ -5844,7 +5843,7 @@ s7_s_score_gpword (int ignore ATTRIBUTE_UNUSED) ignore_rest_of_line (); } p = frag_more (4); - s7_number_to_chars (p, (valueT) 0, 4); + s7_number_to_chars (p, 0, 4); fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, false, BFD_RELOC_GPREL32); demand_empty_rest_of_line (); } @@ -5865,7 +5864,7 @@ s7_s_score_cpadd (int ignore ATTRIBUTE_UNUSED) return; } - if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL) + if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL) { return; } @@ -5873,7 +5872,7 @@ s7_s_score_cpadd (int ignore ATTRIBUTE_UNUSED) /* Add $gp to the register named as an argument. */ sprintf (insn_str, "add r%d, r%d, r%d", reg, reg, s7_GP); - if (s7_append_insn (insn_str, true) == (int) s7_FAIL) + if (s7_append_insn (insn_str, true) == s7_FAIL) return; } @@ -6036,7 +6035,7 @@ s7_s_score_lcomm (int bytes_p) symbol_get_frag (symbolP)->fr_symbol = NULL; symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, (offsetT) temp, NULL); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, temp, NULL); *pfrag = 0; @@ -6081,7 +6080,7 @@ s7_begin (void) s7_build_dependency_insn_hsh (); - for (i = (int) REG_TYPE_FIRST; i < (int) s7_REG_TYPE_MAX; i++) + for (i = REG_TYPE_FIRST; i < s7_REG_TYPE_MAX; i++) s7_build_reg_hsh (s7_all_reg_maps + i); /* Initialize dependency vector. */ @@ -6090,7 +6089,7 @@ s7_begin (void) bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0); seg = now_seg; subseg = now_subseg; - s7_pdr_seg = subseg_new (".pdr", (subsegT) 0); + s7_pdr_seg = subseg_new (".pdr", 0); bfd_set_section_flags (s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); bfd_set_section_alignment (s7_pdr_seg, 2); subseg_set (seg, subseg); @@ -6184,19 +6183,19 @@ s7_atof (int type, char *litP, int *sizeP) if (target_big_endian) { for (i = 0; i < prec; i++) - { - s7_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } + { + s7_number_to_chars (litP, words[i], 2); + litP += 2; + } } else { for (i = 0; i < prec; i += 2) - { - s7_number_to_chars (litP, (valueT) words[i + 1], 2); - s7_number_to_chars (litP + 2, (valueT) words[i], 2); - litP += 4; - } + { + s7_number_to_chars (litP, words[i + 1], 2); + s7_number_to_chars (litP + 2, words[i], 2); + litP += 4; + } } return 0; diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index c37306f..551d8e8 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -445,7 +445,7 @@ sh_elf_cons (int nbytes) do { expression (&exp); - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } while (*input_line_pointer++ == ','); @@ -605,7 +605,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (l1 == '1') { if (src[2] >= '0' && src[2] <= '5' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_REG_N; *reg = 10 + src[2] - '0'; @@ -613,26 +613,26 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } if (l1 >= '0' && l1 <= '9' - && ! IDENT_CHAR ((unsigned char) src[2])) + && ! IDENT_CHAR (src[2])) { *mode = A_REG_N; *reg = (l1 - '0'); return 2; } if (l1 >= '0' && l1 <= '7' && strncasecmp (&src[2], "_bank", 5) == 0 - && ! IDENT_CHAR ((unsigned char) src[7])) + && ! IDENT_CHAR (src[7])) { *mode = A_REG_B; *reg = (l1 - '0'); return 7; } - if (l1 == 'e' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l1 == 'e' && ! IDENT_CHAR (src[2])) { *mode = A_RE; return 2; } - if (l1 == 's' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l1 == 's' && ! IDENT_CHAR (src[2])) { *mode = A_RS; return 2; @@ -643,13 +643,13 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) { if (l1 == '0') { - if (! IDENT_CHAR ((unsigned char) src[2])) + if (! IDENT_CHAR (src[2])) { *mode = DSP_REG_N; *reg = A_A0_NUM; return 2; } - if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) + if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR (src[3])) { *mode = DSP_REG_N; *reg = A_A0G_NUM; @@ -658,13 +658,13 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l1 == '1') { - if (! IDENT_CHAR ((unsigned char) src[2])) + if (! IDENT_CHAR (src[2])) { *mode = DSP_REG_N; *reg = A_A1_NUM; return 2; } - if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) + if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR (src[3])) { *mode = DSP_REG_N; *reg = A_A1G_NUM; @@ -673,21 +673,21 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l1 == 'x' && src[2] >= '0' && src[2] <= '1' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_REG_N; *reg = 4 + (l1 - '0'); return 3; } if (l1 == 'y' && src[2] >= '0' && src[2] <= '1' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_REG_N; *reg = 6 + (l1 - '0'); return 3; } if (l1 == 's' && src[2] >= '0' && src[2] <= '3' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { int n = l1 - '0'; @@ -697,7 +697,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } - if (l0 == 'i' && l1 && ! IDENT_CHAR ((unsigned char) src[2])) + if (l0 == 'i' && l1 && ! IDENT_CHAR (src[2])) { if (l1 == 's') { @@ -720,7 +720,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l0 == 'x' && l1 >= '0' && l1 <= '1' - && ! IDENT_CHAR ((unsigned char) src[2])) + && ! IDENT_CHAR (src[2])) { *mode = DSP_REG_N; *reg = A_X0_NUM + l1 - '0'; @@ -728,7 +728,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l0 == 'y' && l1 >= '0' && l1 <= '1' - && ! IDENT_CHAR ((unsigned char) src[2])) + && ! IDENT_CHAR (src[2])) { *mode = DSP_REG_N; *reg = A_Y0_NUM + l1 - '0'; @@ -736,7 +736,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l0 == 'm' && l1 >= '0' && l1 <= '1' - && ! IDENT_CHAR ((unsigned char) src[2])) + && ! IDENT_CHAR (src[2])) { *mode = DSP_REG_N; *reg = l1 == '0' ? A_M0_NUM : A_M1_NUM; @@ -745,59 +745,59 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (l0 == 's' && l1 == 's' - && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) + && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR (src[3])) { *mode = A_SSR; return 3; } if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_SPC; return 3; } if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_SGR; return 3; } if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_DSR; return 3; } if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_DBR; return 3; } - if (l0 == 's' && l1 == 'r' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l0 == 's' && l1 == 'r' && ! IDENT_CHAR (src[2])) { *mode = A_SR; return 2; } - if (l0 == 's' && l1 == 'p' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l0 == 's' && l1 == 'p' && ! IDENT_CHAR (src[2])) { *mode = A_REG_N; *reg = 15; return 2; } - if (l0 == 'p' && l1 == 'r' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l0 == 'p' && l1 == 'r' && ! IDENT_CHAR (src[2])) { *mode = A_PR; return 2; } - if (l0 == 'p' && l1 == 'c' && ! IDENT_CHAR ((unsigned char) src[2])) + if (l0 == 'p' && l1 == 'c' && ! IDENT_CHAR (src[2])) { /* Don't use A_DISP_PC here - that would accept stuff like 'mova pc,r0' and use an uninitialized immediate. */ @@ -805,26 +805,26 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) return 2; } if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_GBR; return 3; } if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_VBR; return 3; } if (l0 == 't' && l1 == 'b' && TOLOWER (src[2]) == 'r' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_TBR; return 3; } if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c' - && ! IDENT_CHAR ((unsigned char) src[4])) + && ! IDENT_CHAR (src[4])) { if (TOLOWER (src[3]) == 'l') { @@ -838,7 +838,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = A_MOD; return 3; @@ -848,7 +848,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (src[2] == '1') { if (src[3] >= '0' && src[3] <= '5' - && ! IDENT_CHAR ((unsigned char) src[4])) + && ! IDENT_CHAR (src[4])) { *mode = F_REG_N; *reg = 10 + src[3] - '0'; @@ -856,7 +856,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } if (src[2] >= '0' && src[2] <= '9' - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = F_REG_N; *reg = (src[2] - '0'); @@ -868,7 +868,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (src[2] == '1') { if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! IDENT_CHAR ((unsigned char) src[4])) + && ! IDENT_CHAR (src[4])) { *mode = D_REG_N; *reg = 10 + src[3] - '0'; @@ -876,7 +876,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = D_REG_N; *reg = (src[2] - '0'); @@ -888,7 +888,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (src[2] == '1') { if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! IDENT_CHAR ((unsigned char) src[4])) + && ! IDENT_CHAR (src[4])) { *mode = X_REG_N; *reg = 11 + src[3] - '0'; @@ -896,7 +896,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } } if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = X_REG_N; *reg = (src[2] - '0') + 1; @@ -905,14 +905,14 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l0 == 'f' && l1 == 'v') { - if (src[2] == '1'&& src[3] == '2' && ! IDENT_CHAR ((unsigned char) src[4])) + if (src[2] == '1'&& src[3] == '2' && ! IDENT_CHAR (src[4])) { *mode = V_REG_N; *reg = 12; return 4; } if ((src[2] == '0' || src[2] == '4' || src[2] == '8') - && ! IDENT_CHAR ((unsigned char) src[3])) + && ! IDENT_CHAR (src[3])) { *mode = V_REG_N; *reg = (src[2] - '0'); @@ -921,7 +921,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) } if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u' && TOLOWER (src[3]) == 'l' - && ! IDENT_CHAR ((unsigned char) src[4])) + && ! IDENT_CHAR (src[4])) { *mode = FPUL_N; return 4; @@ -929,7 +929,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's' && TOLOWER (src[3]) == 'c' - && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5])) + && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR (src[5])) { *mode = FPSCR_N; return 5; @@ -937,7 +937,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg) if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't' && TOLOWER (src[3]) == 'r' - && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5])) + && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR (src[5])) { *mode = XMTRX_M4; return 5; @@ -2871,7 +2871,7 @@ struct sh_count_relocs static void sh_count_relocs (bfd *abfd ATTRIBUTE_UNUSED, segT sec, void *data) { - struct sh_count_relocs *info = (struct sh_count_relocs *) data; + struct sh_count_relocs *info = data; segment_info_type *seginfo; symbolS *sym; fixS *fix; @@ -3018,7 +3018,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP) { case C (COND_JUMP, COND8): case C (COND_JUMP_DELAY, COND8): - subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP8BY2); fragP->fr_fix += 2; @@ -3026,7 +3025,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP) break; case C (UNCOND_JUMP, UNCOND12): - subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP12BY2); fragP->fr_fix += 2; @@ -3082,7 +3080,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP) its delay-slot insn already makes the branch reach. */ /* Build a relocation to six / four bytes farther on. */ - subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, section_symbol (seg), fragP->fr_address + fragP->fr_fix + (delay ? 4 : 6), 1, BFD_RELOC_SH_PCDISP8BY2); @@ -3206,8 +3203,7 @@ sh_cons_align (int nbytes) return; } - frag_var (rs_align_test, 1, 1, (relax_substateT) 0, - (symbolS *) NULL, (offsetT) nalign, (char *) NULL); + frag_var (rs_align_test, 1, 1, 0, NULL, nalign, NULL); record_alignment (now_seg, nalign); } @@ -3704,8 +3700,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) if (val >= 0) val >>= shift; else - val = ((val >> shift) - | ((long) -1 & ~ ((long) -1 >> shift))); + val = (val >> shift) | (-1L & ~ (-1L >> shift)); } /* Extend sign for 64-bit host. */ @@ -3817,7 +3812,7 @@ long md_pcrel_from_section (fixS *fixP, segT sec) { if (! sh_local_pcrel (fixP) - && fixP->fx_addsy != (symbolS *) NULL + && fixP->fx_addsy != NULL && (generic_force_reloc (fixP) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 6db8481..0dd9205 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -805,8 +805,8 @@ struct priv_reg_entry v9a_asr_table[] = static int cmp_reg_entry (const void *parg, const void *qarg) { - const struct priv_reg_entry *p = (const struct priv_reg_entry *) parg; - const struct priv_reg_entry *q = (const struct priv_reg_entry *) qarg; + const struct priv_reg_entry *p = parg; + const struct priv_reg_entry *q = qarg; if (p->name == q->name) return 0; @@ -921,8 +921,8 @@ struct perc_entry perc_table[NUM_PERC_ENTRIES]; static int cmp_perc_entry (const void *parg, const void *qarg) { - const struct perc_entry *p = (const struct perc_entry *) parg; - const struct perc_entry *q = (const struct perc_entry *) qarg; + const struct perc_entry *p = parg; + const struct perc_entry *q = qarg; if (p->name == q->name) return 0; @@ -1254,7 +1254,7 @@ synthetize_setuw (const struct sparc_opcode *insn) && (the_insn.exp.X_add_number < -(offsetT) U0x80000000 || the_insn.exp.X_add_number > (offsetT) U0xffffffff)) as_warn (_("set: number not in -2147483648..4294967295 range")); - the_insn.exp.X_add_number = (int) the_insn.exp.X_add_number; + the_insn.exp.X_add_number = (int32_t) the_insn.exp.X_add_number; } } @@ -3402,9 +3402,9 @@ output_insn (const struct sparc_opcode *insn, struct sparc_it *theinsn) /* Put out the opcode. */ if (INSN_BIG_ENDIAN) - number_to_chars_bigendian (toP, (valueT) theinsn->opcode, 4); + number_to_chars_bigendian (toP, theinsn->opcode, 4); else - number_to_chars_littleendian (toP, (valueT) theinsn->opcode, 4); + number_to_chars_littleendian (toP, theinsn->opcode, 4); /* Put out the symbol-dependent stuff. */ if (theinsn->reloc != BFD_RELOC_NONE) @@ -3544,9 +3544,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) /* It's a relocation against an instruction. */ if (INSN_BIG_ENDIAN) - insn = bfd_getb32 ((unsigned char *) buf); + insn = bfd_getb32 (buf); else - insn = bfd_getl32 ((unsigned char *) buf); + insn = bfd_getl32 (buf); switch (fixP->fx_r_type) { @@ -3588,9 +3588,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) then we can optimize if the call destination is near by changing the call into a branch always. */ if (INSN_BIG_ENDIAN) - delay = bfd_getb32 ((unsigned char *) buf + 4); + delay = bfd_getb32 (buf + 4); else - delay = bfd_getl32 ((unsigned char *) buf + 4); + delay = bfd_getl32 (buf + 4); if ((insn & OP (~0)) != OP (1) || (delay & OP (~0)) != OP (2)) break; if ((delay & OP3 (~0)) != OP3 (0x3d) /* Restore. */ @@ -3624,9 +3624,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) int reg; if (INSN_BIG_ENDIAN) - setter = bfd_getb32 ((unsigned char *) buf - 4); + setter = bfd_getb32 (buf - 4); else - setter = bfd_getl32 ((unsigned char *) buf - 4); + setter = bfd_getl32 (buf - 4); if ((setter & (0xffffffff ^ RD (~0))) != (INSN_OR | RS1 (O7) | RS2 (G0))) break; @@ -3643,9 +3643,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) break; if (INSN_BIG_ENDIAN) - bfd_putb32 (INSN_NOP, (unsigned char *) buf + 4); + bfd_putb32 (INSN_NOP, buf + 4); else - bfd_putl32 (INSN_NOP, (unsigned char *) buf + 4); + bfd_putl32 (INSN_NOP, buf + 4); } } break; @@ -3820,9 +3820,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) } if (INSN_BIG_ENDIAN) - bfd_putb32 (insn, (unsigned char *) buf); + bfd_putb32 (insn, buf); else - bfd_putl32 (insn, (unsigned char *) buf); + bfd_putl32 (insn, buf); } /* Are we finished with this relocation now? */ @@ -4219,8 +4219,7 @@ s_reserve (int ignore ATTRIBUTE_UNUSED) symbol_get_frag (symbolP)->fr_symbol = NULL; symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) size, (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SEGMENT (symbolP, bss_section); @@ -4336,8 +4335,7 @@ s_common (int ignore ATTRIBUTE_UNUSED) if (S_GET_SEGMENT (symbolP) == bss_section) symbol_get_frag (symbolP)->fr_symbol = 0; symbol_set_frag (symbolP, frag_now); - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) size, (char *) 0); + p = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *p = 0; S_SET_SEGMENT (symbolP, bss_section); S_CLEAR_EXTERNAL (symbolP); @@ -4347,7 +4345,7 @@ s_common (int ignore ATTRIBUTE_UNUSED) else { allocate_common: - S_SET_VALUE (symbolP, (valueT) size); + S_SET_VALUE (symbolP, size); S_SET_ALIGN (symbolP, temp); S_SET_SIZE (symbolP, size); S_SET_EXTERNAL (symbolP); @@ -4553,7 +4551,7 @@ s_register (int ignore ATTRIBUTE_UNUSED) if (! (flags & (BSF_GLOBAL|BSF_LOCAL|BSF_WEAK))) flags |= BSF_GLOBAL; symbol_get_bfdsym (globals[reg])->flags = flags; - S_SET_VALUE (globals[reg], (valueT) reg); + S_SET_VALUE (globals[reg], reg); S_SET_ALIGN (globals[reg], reg); S_SET_SIZE (globals[reg], 0); /* Although we actually want undefined_section here, @@ -4635,8 +4633,7 @@ sparc_cons_align (int nbytes) return; } - frag_var (rs_align_test, 1, 1, (relax_substateT) 0, - (symbolS *) NULL, (offsetT) nalign, (char *) NULL); + frag_var (rs_align_test, 1, 1, 0, NULL, nalign, NULL); record_alignment (now_seg, nalign); } @@ -4937,7 +4934,7 @@ cons_fix_new_sparc (fragS *frag, } } - fix_new_exp (frag, where, (int) nbytes, exp, 0, r); + fix_new_exp (frag, where, nbytes, exp, 0, r); } void diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h index d569fe7..cfb89e0 100644 --- a/gas/config/tc-sparc.h +++ b/gas/config/tc-sparc.h @@ -178,4 +178,4 @@ extern int sparc_cie_data_alignment; this, BFD_RELOC_32_PCREL will be emitted directly instead. */ #define CFI_DIFF_EXPR_OK 0 -#endif +#endif /* TC_SPARC */ diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c index 1c8f7c5..5da4e00 100644 --- a/gas/config/tc-spu.c +++ b/gas/config/tc-spu.c @@ -298,7 +298,7 @@ md_assemble (char *op) insn.reloc[i] = BFD_RELOC_NONE; } insn.opcode = format->opcode; - insn.tag = (enum spu_insns) (format - spu_opcodes); + insn.tag = format - spu_opcodes; syntax_error_arg = 0; syntax_error_param = 0; @@ -569,7 +569,7 @@ get_reg (const char *param, struct spu_insn *insn, int arg, int accept_expr) char *save_ptr; expressionS ex; save_ptr = input_line_pointer; - input_line_pointer = (char *)param; + input_line_pointer = (char *) param; expression (&ex); param = input_line_pointer; input_line_pointer = save_ptr; @@ -721,16 +721,11 @@ md_create_short_jump (char *ptr, fragS *frag, symbolS *to_symbol) { - ptr[0] = (char) 0xc0; + ptr[0] = 0xc0; ptr[1] = 0x00; ptr[2] = 0x00; ptr[3] = 0x00; - fix_new (frag, - ptr - frag->fr_literal, - 4, - to_symbol, - (offsetT) 0, - 0, + fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, 0, 0, BFD_RELOC_SPU_PCREL16); } @@ -743,16 +738,11 @@ md_create_long_jump (char *ptr, fragS *frag, symbolS *to_symbol) { - ptr[0] = (char) 0xc0; + ptr[0] = 0xc0; ptr[1] = 0x00; ptr[2] = 0x00; ptr[3] = 0x00; - fix_new (frag, - ptr - frag->fr_literal, - 4, - to_symbol, - (offsetT) 0, - 0, + fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, 0, 0, BFD_RELOC_SPU_PCREL16); } #endif @@ -872,7 +862,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _("reloc %d not supported by object file format"), @@ -950,7 +940,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) valueT val = *valP; char *place = fixP->fx_where + fixP->fx_frag->fr_literal; - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) { /* We can't actually support subtracting a symbol. */ as_bad_subtract (fixP); diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c index 87cf09a..2c80f97 100644 --- a/gas/config/tc-tic30.c +++ b/gas/config/tc-tic30.c @@ -598,7 +598,7 @@ tic30_operand (char *token) current_op->immediate.s_number = current_op->immediate.imm_expr.X_add_number; current_op->immediate.u_number - = (unsigned int) current_op->immediate.imm_expr.X_add_number; + = current_op->immediate.imm_expr.X_add_number; current_op->immediate.resolved = 1; } } @@ -610,8 +610,8 @@ tic30_operand (char *token) current_op->immediate.decimal_found = 1; current_op->immediate.label = xstrdup (token); current_op->immediate.f_number = (float) atof (token); - current_op->immediate.s_number = (int) atoi (token); - current_op->immediate.u_number = (unsigned int) atoi (token); + current_op->immediate.s_number = atoi (token); + current_op->immediate.u_number = atoi (token); current_op->immediate.resolved = 1; } current_op->op_type = Disp | Abs24 | Imm16 | Imm24; @@ -1061,7 +1061,7 @@ tic30_parallel_insn (char *token) char *p; p = frag_more (INSN_SIZE); - md_number_to_chars (p, (valueT) p_insn.opcode, INSN_SIZE); + md_number_to_chars (p, p_insn.opcode, INSN_SIZE); } { @@ -1151,7 +1151,7 @@ symbolS * md_undefined_symbol (char *name ATTRIBUTE_UNUSED) { debug ("In md_undefined_symbol()\n"); - return (symbolS *) 0; + return NULL; } valueT @@ -1279,7 +1279,7 @@ md_atof (int what_statement_type, if (mant == 0) { mant |= 0x00800000; - exp = (long) exp - 0x01000000; + exp = exp - 0x01000000; } } tmsfloat = exp | mant; @@ -1672,7 +1672,7 @@ md_assemble (char *line) insn.opcode |= insn.addressing_mode; p = frag_more (INSN_SIZE); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { @@ -1723,12 +1723,12 @@ md_assemble (char *line) into instruction word, and output. */ insn.opcode |= (insn.operand_type[am_insn]->direct.address & 0x0000FFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { /* Unresolved direct addressing mode instruction. */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, & insn.operand_type[am_insn]->direct.direct_expr, 0, 0); @@ -1748,7 +1748,7 @@ md_assemble (char *line) { case Imm_Float: debug ("Floating point first operand\n"); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); keeploc = input_line_pointer; input_line_pointer = @@ -1771,7 +1771,7 @@ md_assemble (char *line) as_warn (_("only lower 16-bits of first operand are used")); insn.opcode |= (insn.operand_type[0]->immediate.u_number & 0x0000FFFFL); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); break; case Imm_SInt: @@ -1788,7 +1788,7 @@ md_assemble (char *line) } insn.opcode |= (insn.operand_type[0]->immediate.s_number & 0x0000FFFFL); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); break; } } @@ -1797,7 +1797,7 @@ md_assemble (char *line) /* Unresolved immediate label. */ if (insn.operands > 1) insn.opcode |= (insn.operand_type[1]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, & insn.operand_type[0]->immediate.imm_expr, 0, 0); @@ -1814,7 +1814,7 @@ md_assemble (char *line) { insn.opcode |= (insn.operand_type[0]->reg.opcode); insn.opcode |= PC_Register; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { @@ -1823,11 +1823,11 @@ md_assemble (char *line) { insn.opcode |= (insn.operand_type[0]->immediate.s_number & 0x0000FFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, & insn.operand_type[0]->immediate.imm_expr, 1, 0); @@ -1842,7 +1842,7 @@ md_assemble (char *line) { insn.opcode |= (insn.operand_type[1]->reg.opcode); insn.opcode |= PC_Register; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else if (insn.operand_type[1]->immediate.resolved == 1) { @@ -1859,12 +1859,12 @@ md_assemble (char *line) } insn.opcode |= (insn.operand_type[1]->immediate.s_number); insn.opcode |= PC_Relative; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { insn.opcode |= PC_Relative; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix_new_exp (frag_now, p + 2 - frag_now->fr_literal, 2, & insn.operand_type[1]->immediate.imm_expr, 1, 0); @@ -1882,14 +1882,14 @@ md_assemble (char *line) as_bad (_("interrupt vector for trap instruction out of range")); return; } - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else if (insn.tm->opcode_modifier == StackOp || insn.tm->opcode_modifier == Rotate) { /* Push, Pop and Rotate instructions. */ insn.opcode |= (insn.operand_type[0]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else if ((insn.tm->operand_types[0] & (Abs24 | Direct)) == (Abs24 | Direct)) @@ -1903,13 +1903,13 @@ md_assemble (char *line) /* Direct addressing uses lower 8 bits of direct address. */ insn.opcode |= (insn.operand_type[0]->direct.address & 0x00FF0000) >> 16; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { fixS *fix; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal), 1, &insn.operand_type[0]->direct.direct_expr, 0, 0); /* Ensure that the assembler doesn't complain @@ -1929,12 +1929,12 @@ md_assemble (char *line) } insn.opcode |= ((insn.operand_type[0]->immediate.u_number & 0x00FF0000) >> 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { fixS *fix; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal), 1, &insn.operand_type[0]->immediate.imm_expr, 0, 0); @@ -1951,22 +1951,22 @@ md_assemble (char *line) as_warn (_("first operand is too large for a 24-bit displacement")); insn.opcode |= (insn.operand_type[0]->immediate.u_number & 0x00FFFFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } else { - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); fix_new_exp (frag_now, p + 1 - (frag_now->fr_literal), 3, & insn.operand_type[0]->immediate.imm_expr, 0, 0); } } else if (insn.tm->operand_types[0] & NotReq) /* Check for NOP instruction without arguments. */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); else if (insn.tm->operands == 0) /* Check for instructions without operands. */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); + md_number_to_chars (p, insn.opcode, INSN_SIZE); } debug ("Addressing mode: %08X\n", insn.addressing_mode); { diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index 167a94f..3a3123c 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -695,9 +695,7 @@ tic4x_seg_alloc (char *name ATTRIBUTE_UNUSED, { char *p; - p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, - (symbolS *) symbolP, - size * OCTETS_PER_BYTE, (char *) 0); + p = frag_var (rs_fill, 1, 1, 0, symbolP, size * OCTETS_PER_BYTE, NULL); *p = 0; } } @@ -772,8 +770,7 @@ tic4x_bss (int x ATTRIBUTE_UNUSED) symbol_set_frag (symbolP, frag_now); - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - size * OCTETS_PER_BYTE, (char *) 0); + p = frag_var (rs_org, 1, 1, 0, symbolP, size * OCTETS_PER_BYTE, NULL); *p = 0; /* Fill char. */ S_SET_SEGMENT (symbolP, bss_section); @@ -2584,15 +2581,13 @@ md_atof (int type, char *litP, int *sizeP) for (wordP = words; wordP<(words+prec) ; wordP+=2) { if (wordP < (words + prec - 1)) /* Dump wordP[1] (if we have one). */ - { - md_number_to_chars (litP, (valueT) (wordP[1]), - sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); - } + { + md_number_to_chars (litP, wordP[1], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } /* Dump wordP[0] */ - md_number_to_chars (litP, (valueT) (wordP[0]), - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, wordP[0], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } return NULL; @@ -2819,7 +2814,7 @@ md_undefined_symbol (char *name) char *s = name + 1; int lab = 0; - while (ISDIGIT ((unsigned char) *s)) + while (ISDIGIT (*s)) { lab = lab * 10 + *s - '0'; s++; @@ -3003,7 +2998,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixP) reloc->address = fixP->fx_frag->fr_address + fixP->fx_where; reloc->address /= OCTETS_PER_BYTE; reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixP->fx_file, fixP->fx_line, _("Reloc %d not supported by object file format"), diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index db3def4..515b843 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -478,7 +478,7 @@ tic54x_bss (int x ATTRIBUTE_UNUSED) char c; char *name; char *p; - int words; + offsetT words; segT current_seg; subsegT current_subseg; symbolS *symbolP; @@ -504,7 +504,7 @@ tic54x_bss (int x ATTRIBUTE_UNUSED) words = get_absolute_expression (); if (words < 0) { - as_bad (_(".bss size %d < 0!"), words); + as_bad (_(".bss size %d < 0!"), (int) words); ignore_rest_of_line (); return; } @@ -533,11 +533,10 @@ tic54x_bss (int x ATTRIBUTE_UNUSED) symbolP = symbol_find_or_make (name); if (S_GET_SEGMENT (symbolP) == bss_section) - symbol_get_frag (symbolP)->fr_symbol = (symbolS *) NULL; + symbol_get_frag (symbolP)->fr_symbol = NULL; symbol_set_frag (symbolP, frag_now); - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) (words * OCTETS_PER_BYTE), (char *) 0); + p = frag_var (rs_org, 1, 1, 0, symbolP, words * OCTETS_PER_BYTE, NULL); *p = 0; /* Fill char. */ S_SET_SEGMENT (symbolP, bss_section); @@ -574,11 +573,11 @@ stag_add_field_symbols (struct stag *stag, /* Construct a symbol for every field contained within this structure including fields within structure fields. */ - prefix = concat (path, *path ? "." : "", NULL); + prefix = concat (path, *path ? "." : "", (const char *) NULL); while (field != NULL) { - char *name = concat (prefix, field->name, NULL); + char *name = concat (prefix, field->name, (const char *) NULL); char *freename = name; if (rootsym == NULL) @@ -594,7 +593,8 @@ stag_add_field_symbols (struct stag *stag, { subsym_ent_t *ent = xmalloc (sizeof (*ent)); ent->u.s = concat (S_GET_NAME (rootsym), "+", root_stag_name, - name + strlen (S_GET_NAME (rootsym)), NULL); + name + strlen (S_GET_NAME (rootsym)), + (const char *) NULL); ent->freekey = 1; ent->freeval = 1; ent->isproc = 0; @@ -860,7 +860,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED) static void tic54x_struct_field (int type) { - int size; + unsigned int size; int count = 1; int new_bitfield_offset = 0; int field_align = current_stag->current_bitfield_offset != 0; @@ -964,12 +964,12 @@ tic54x_struct_field (int type) if (current_stag->is_union) { /* Note we treat the element as if it were an array of COUNT. */ - if (current_stag->size < (unsigned) size * count) + if (current_stag->size < size * count) current_stag->size = size * count; } else { - abs_section_offset += (unsigned) size * count; + abs_section_offset += size * count; current_stag->current_bitfield_offset = new_bitfield_offset; } line_label = NULL; @@ -1149,7 +1149,7 @@ tic54x_global (int type) static void free_subsym_ent (void *ent) { - string_tuple_t *tuple = (string_tuple_t *) ent; + string_tuple_t *tuple = ent; subsym_ent_t *val = (void *) tuple->value; if (val->freekey) free ((void *) tuple->key); @@ -1169,7 +1169,7 @@ subsym_htab_create (void) static void free_local_label_ent (void *ent) { - string_tuple_t *tuple = (string_tuple_t *) ent; + string_tuple_t *tuple = ent; free ((void *) tuple->key); free ((void *) tuple->value); free (ent); @@ -1295,10 +1295,8 @@ tic54x_space (int arg) bi->seg = now_seg; bi->type = bes; bi->sym = label; - p = frag_var (rs_machine_dependent, - 65536 * 2, 1, (relax_substateT) 0, - make_expr_symbol (&expn), (offsetT) 0, - (char *) bi); + p = frag_var (rs_machine_dependent, 65536 * 2, 1, 0, + make_expr_symbol (&expn), 0, (char *) bi); if (p) *p = 0; @@ -1362,9 +1360,7 @@ tic54x_space (int arg) } if (!need_pass_2) - p = frag_var (rs_fill, 1, 1, - (relax_substateT) 0, (symbolS *) 0, - (offsetT) octets, (char *) 0); + p = frag_var (rs_fill, 1, 1, 0, NULL, octets, NULL); /* Make note of how many bits of this word we've allocated so far. */ frag_now->tc_frag_data = bit_offset; @@ -1470,9 +1466,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) seg_info (seg)->bss = 1; /* Uninitialized data. */ - p = frag_var (rs_fill, 1, 1, - (relax_substateT) 0, (symbolS *) line_label, - size * OCTETS_PER_BYTE, (char *) 0); + p = frag_var (rs_fill, 1, 1, 0, line_label, size * OCTETS_PER_BYTE, NULL); *p = 0; if (blocking_flag) @@ -1808,10 +1802,8 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED) bi->seg = now_seg; bi->type = TYPE_FIELD; bi->value = value; - p = frag_var (rs_machine_dependent, - 4, 1, (relax_substateT) 0, - make_expr_symbol (&size_exp), (offsetT) 0, - (char *) bi); + p = frag_var (rs_machine_dependent, 4, 1, 0, + make_expr_symbol (&size_exp), 0, (char *) bi); goto getout; } else if (bit_offset == 0 || bit_offset + size > 16) @@ -1839,7 +1831,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED) /* OR in existing value. */ if (alloc_frag->tc_frag_data) - value |= ((unsigned short) p[1] << 8) | p[0]; + value |= ((uint16_t) p[1] << 8) | p[0]; md_number_to_chars (p, value, 2); alloc_frag->tc_frag_data += size; if (alloc_frag->tc_frag_data == 16) @@ -2379,7 +2371,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED) /* Write to a temporary file, then use s_include to include it a bit of a hack. */ ftmp = fopen (fname, "w+b"); - fwrite ((void *) buf, size, 1, ftmp); + fwrite (buf, size, 1, ftmp); if (size == 0 || buf[size - 1] != '\n') fwrite ("\n", 1, 1, ftmp); fclose (ftmp); @@ -3945,16 +3937,14 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand) if (strcasecmp (operand->buf, "st0") == 0 || strcasecmp (operand->buf, "st1") == 0) { - insn->opcode[0].word |= - ((unsigned short) (operand->buf[2] - '0')) << 9; + insn->opcode[0].word |= ((uint16_t) (operand->buf[2] - '0')) << 9; return 1; } else if (operand->exp.X_op == O_constant && (operand->exp.X_add_number == 0 || operand->exp.X_add_number == 1)) { - insn->opcode[0].word |= - ((unsigned short) (operand->exp.X_add_number)) << 9; + insn->opcode[0].word |= ((uint16_t) (operand->exp.X_add_number)) << 9; return 1; } as_bad (_("Invalid status register \"%s\""), operand->buf); @@ -4009,7 +3999,7 @@ emit_insn (tic54x_insn *insn) char *p = frag_more (size); if (size == 2) - md_number_to_chars (p, (valueT) insn->opcode[i].word, 2); + md_number_to_chars (p, insn->opcode[i].word, 2); else md_number_to_chars (p, (valueT) insn->opcode[i].word << 16, 4); @@ -5277,7 +5267,7 @@ tic54x_relax_frag (fragS *frag, long stretch ATTRIBUTE_UNUSED) valueT value = bi->value; value <<= available - size; - value |= ((unsigned short) p[1] << 8) | p[0]; + value |= ((uint16_t) p[1] << 8) | p[0]; md_number_to_chars (p, value, 2); if ((prev_frag->tc_frag_data += size) == 16) prev_frag->tc_frag_data = 0; diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index aeb2239..7862236 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -659,8 +659,7 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED) symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, sbss_section); @@ -669,7 +668,7 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED) } else { - S_SET_VALUE (symbolP, (valueT) size); + S_SET_VALUE (symbolP, size); S_SET_ALIGN (symbolP, 1 << align2); S_SET_EXTERNAL (symbolP); S_SET_SEGMENT (symbolP, &scom_section); @@ -3084,14 +3083,13 @@ static valueT md_chars_to_number (char *buf, int n) { valueT result = 0; - unsigned char *p = (unsigned char *) buf; if (target_big_endian) { while (n--) { result <<= 8; - result |= (*p++ & 0xff); + result |= (*buf++ & 0xff); } } else @@ -3099,7 +3097,7 @@ md_chars_to_number (char *buf, int n) while (n--) { result <<= 8; - result |= (p[n] & 0xff); + result |= (buf[n] & 0xff); } } @@ -3527,7 +3525,7 @@ md_assemble (char *str) bool found_match = false; for (i = 0; i < TIC6X_NUM_PREFER; i++) - opc_rank[i] = (unsigned int) -1; + opc_rank[i] = -1u; min_rank = TIC6X_NUM_PREFER - 1; max_rank = 0; @@ -3576,7 +3574,7 @@ md_assemble (char *str) if (rank > max_rank) max_rank = rank; - if (opc_rank[rank] == (unsigned int) -1) + if (opc_rank[rank] == -1u) opc_rank[rank] = i; else /* The opcode table should provide a total ordering @@ -3607,7 +3605,7 @@ md_assemble (char *str) { fix_needed = false; - if (opc_rank[try_rank] == (unsigned int) -1) + if (opc_rank[try_rank] == -1u) continue; opcode_value = tic6x_try_encode (opcm[opc_rank[try_rank]], operands, @@ -4468,7 +4466,7 @@ tic6x_pcrel_from_section (fixS *fixp, segT sec) && (!S_IS_DEFINED (fixp->fx_addsy) || S_GET_SEGMENT (fixp->fx_addsy) != sec)) return 0; - return (fixp->fx_where + fixp->fx_frag->fr_address) & ~(long) 0x1f; + return (fixp->fx_where + fixp->fx_frag->fr_address) & ~0x1fULL; } /* Round up a section size to the appropriate boundary. */ diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h index 55f2b2c..5859333 100644 --- a/gas/config/tc-tic6x.h +++ b/gas/config/tc-tic6x.h @@ -18,7 +18,9 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef TC_TIC6X #define TC_TIC6X 1 + #define TARGET_BYTES_BIG_ENDIAN 0 #define WORKING_DOT_WORD #define DOUBLEBAR_PARALLEL @@ -225,3 +227,5 @@ struct fde_entry; void tic6x_cfi_endproc (struct fde_entry *fde); #define tc_cfi_section_name ".c6xabi.exidx" + +#endif /* TC_TIC6X */ diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index f70388c..84daf05 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -441,25 +441,25 @@ apply_special_operator (operatorT op, offsetT num, const char *file, check_shift = 0; /* Fall through. */ case O_hw0: - ret = (signed short)num; + ret = (int16_t) num; break; case O_hw1_last: check_shift = 16; /* Fall through. */ case O_hw1: - ret = (signed short)(num >> 16); + ret = (int16_t) (num >> 16); break; case O_hw2_last: check_shift = 32; /* Fall through. */ case O_hw2: - ret = (signed short)(num >> 32); + ret = (int16_t) (num >> 32); break; case O_hw3: - ret = (signed short)(num >> 48); + ret = (int16_t) (num >> 48); break; default: @@ -959,10 +959,8 @@ tilegx_flush_bundle (void) /* Figure out what pipe the fnop must be in via arithmetic. * p0 + p1 + p2 must sum to the sum of TILEGX_PIPELINE_Y[012]. */ current_bundle[0].pipe = - (tilegx_pipeline)((TILEGX_PIPELINE_Y0 - + TILEGX_PIPELINE_Y1 - + TILEGX_PIPELINE_Y2) - - (current_bundle[1].pipe + current_bundle[2].pipe)); + (TILEGX_PIPELINE_Y0 + TILEGX_PIPELINE_Y1 + TILEGX_PIPELINE_Y2 + - current_bundle[1].pipe - current_bundle[2].pipe); } check_illegal_reg_writes (); @@ -1351,7 +1349,7 @@ md_atof (int type, char *litP, int *sizeP) the bigendian 386. */ for (wordP = words + prec - 1; prec--;) { - md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } return 0; @@ -1467,7 +1465,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return; - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) { /* We can't actually support subtracting a symbol. */ as_bad_subtract (fixP); @@ -1678,7 +1676,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) ORing in values is OK since we know the existing bits for this operand are zero. */ for (; bits != 0; bits >>= 8) - *p++ |= (char)bits; + *p++ |= bits; } else { diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 738b24a..8c90217 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -387,13 +387,13 @@ apply_special_operator (operatorT op, int num) switch (op) { case O_lo16: - return (signed short)num; + return (int16_t) num; case O_hi16: - return (signed short)(num >> 16); + return (int16_t) (num >> 16); case O_ha16: - return (signed short)((num + 0x8000) >> 16); + return (int16_t) ((num + 0x8000) >> 16); default: abort (); @@ -846,10 +846,8 @@ tilepro_flush_bundle (void) /* Figure out what pipe the fnop must be in via arithmetic. * p0 + p1 + p2 must sum to the sum of TILEPRO_PIPELINE_Y[012]. */ current_bundle[0].pipe = - (tilepro_pipeline)((TILEPRO_PIPELINE_Y0 - + TILEPRO_PIPELINE_Y1 - + TILEPRO_PIPELINE_Y2) - - (current_bundle[1].pipe + current_bundle[2].pipe)); + (TILEPRO_PIPELINE_Y0 + TILEPRO_PIPELINE_Y1 + TILEPRO_PIPELINE_Y2 + - current_bundle[1].pipe - current_bundle[2].pipe); } check_illegal_reg_writes (); @@ -878,8 +876,8 @@ tilepro_flush_bundle (void) f); } - number_to_chars_littleendian (f, (unsigned int)bits, 4); - number_to_chars_littleendian (f + 4, (unsigned int)(bits >> 32), 4); + number_to_chars_littleendian (f, bits, 4); + number_to_chars_littleendian (f + 4, bits >> 32, 4); current_bundle_index = 0; /* Emit DWARF2 debugging information. */ @@ -1227,7 +1225,7 @@ md_atof (int type, char *litP, int *sizeP) the bigendian 386. */ for (wordP = words + prec - 1; prec--;) { - md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } return 0; diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index b344005..176910d 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -247,8 +247,7 @@ v850_offset (int ignore ATTRIBUTE_UNUSED) char *pfrag; int temp = get_absolute_expression (); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, (symbolS *)0, - (offsetT) temp, (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, NULL, temp, NULL); *pfrag = 0; demand_empty_rest_of_line (); @@ -345,15 +344,10 @@ v850_comm (int area) int old_subsec; char *pfrag; int align; - flagword applicable; old_sec = now_seg; old_subsec = now_subseg; - applicable = bfd_applicable_section_flags (stdoutput); - - applicable &= SEC_ALLOC; - switch (area) { case SCOMMON_SECTION: @@ -412,8 +406,7 @@ v850_comm (int area) } symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) size, (char *) 0); + pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; S_SET_SIZE (symbolP, size); @@ -1675,42 +1668,29 @@ md_atof (int type, char *litp, int *sizep) void md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, - asection *sec, + asection *sec ATTRIBUTE_UNUSED, fragS *fragP) { - union u - { - bfd_reloc_code_real_type fx_r_type; - char * fr_opcode; - } - opcode_converter; - subseg_change (sec, 0); - - opcode_converter.fr_opcode = fragP->fr_opcode; - - subseg_change (sec, 0); + unsigned int opindex = (uintptr_t) fragP->fr_opcode; if (fragP->fr_subtype == SUBYPTE_LOOP_16_22) { fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, - fragP->fr_offset, 1, - BFD_RELOC_UNUSED + opcode_converter.fx_r_type); + fragP->fr_offset, 1, BFD_RELOC_UNUSED + opindex); fragP->fr_fix += 4; } else if (fragP->fr_subtype == SUBYPTE_LOOP_16_22 + 1) { - unsigned char * buffer = - (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]); - int loop_reg = (buffer[0] & 0x1f); + char *buffer = fragP->fr_literal + fragP->fr_fix; + int loop_reg = buffer[0] & 0x1f; /* Add -1.reg. */ - md_number_to_chars ((char *) buffer, 0x025f | (loop_reg << 11), 2); + md_number_to_chars (buffer, 0x025f | (loop_reg << 11), 2); /* Now create the conditional branch + fixup to the final target. */ /* 0x000107ea = bne LBL(disp17). */ - md_number_to_chars ((char *) buffer + 2, 0x000107ea, 4); + md_number_to_chars (buffer + 2, 0x000107ea, 4); fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, - fragP->fr_offset, 1, - BFD_RELOC_V850_17_PCREL); + fragP->fr_offset, 1, BFD_RELOC_V850_17_PCREL); fragP->fr_fix += 6; } /* In range conditional or unconditional branch. */ @@ -1727,8 +1707,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, { fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, - fragP->fr_offset, 1, - BFD_RELOC_UNUSED + opcode_converter.fx_r_type); + fragP->fr_offset, 1, BFD_RELOC_UNUSED + opindex); fragP->fr_fix += 2; } /* V850e2r-v3 17bit conditional branch. */ @@ -1737,8 +1716,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, || fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 1 || fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 1) { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]); + char *buffer = fragP->fr_literal + fragP->fr_fix; buffer[0] &= 0x0f; /* Use condition. */ buffer[0] |= 0xe0; @@ -1746,7 +1724,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, /* Now create the unconditional branch + fixup to the final target. */ - md_number_to_chars ((char *) buffer + 2, 0x0001, 2); + md_number_to_chars (buffer + 2, 0x0001, 2); fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 1, BFD_RELOC_V850_17_PCREL); fragP->fr_fix += 4; @@ -1757,8 +1735,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, || fragP->fr_subtype == SUBYPTE_COND_9_17_22 + 2 || fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 2) { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); + char *buffer = fragP->fr_literal + fragP->fr_fix; /* Reverse the condition of the first branch. */ buffer[0] ^= 0x08; @@ -1771,7 +1748,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, /* Now create the unconditional branch + fixup to the final target. */ - md_number_to_chars ((char *) buffer + 2, 0x00000780, 4); + md_number_to_chars (buffer + 2, 0x00000780, 4); fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL); fragP->fr_fix += 6; @@ -1780,8 +1757,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, else if (fragP->fr_subtype == SUBYPTE_COND_9_22_32 + 2 || fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 3) { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); + char *buffer = fragP->fr_literal + fragP->fr_fix; /* Reverse the condition of the first branch. */ buffer[0] ^= 0x08; @@ -1794,7 +1770,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, /* Now create the unconditional branch + fixup to the final target. */ - md_number_to_chars ((char *) buffer + 2, 0x02e0, 2); + md_number_to_chars (buffer + 2, 0x02e0, 2); fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol, fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL); fragP->fr_fix += 8; @@ -1822,8 +1798,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, || fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 2 || fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 2) { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); + char *buffer = fragP->fr_literal + fragP->fr_fix; /* bsa .+4 */ buffer[0] &= 0x8f; @@ -1831,23 +1806,21 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, buffer[1] &= 0x07; /* br .+6 */ - md_number_to_chars ((char *) buffer + 2, 0x05b5, 2); + md_number_to_chars (buffer + 2, 0x05b5, 2); /* Now create the unconditional branch + fixup to the final target. */ /* jr SYM */ - md_number_to_chars ((char *) buffer + 4, 0x00000780, 4); + md_number_to_chars (buffer + 4, 0x00000780, 4); fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol, - fragP->fr_offset, 1, - BFD_RELOC_V850_22_PCREL); + fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL); fragP->fr_fix += 8; } /* Out of range SA conditional branch. Emit a branch around a 32bit jump. */ else if (fragP->fr_subtype == SUBYPTE_SA_9_22_32 + 2 || fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 3) { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); + char *buffer = fragP->fr_literal + fragP->fr_fix; /* bsa .+2 */ buffer[0] &= 0x8f; @@ -1855,12 +1828,12 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, buffer[1] &= 0x07; /* br .+8 */ - md_number_to_chars ((char *) buffer + 2, 0x05c5, 2); + md_number_to_chars (buffer + 2, 0x05c5, 2); /* Now create the unconditional branch + fixup to the final target. */ /* jr SYM */ - md_number_to_chars ((char *) buffer + 4, 0x02e0, 2); + md_number_to_chars (buffer + 4, 0x02e0, 2); fix_new (fragP, fragP->fr_fix + 6, 4, fragP->fr_symbol, fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL); @@ -1958,7 +1931,7 @@ md_begin (void) { if (strcmp (prev_name, op->name)) { - prev_name = (char *) op->name; + prev_name = op->name; str_hash_insert (v850_hash, op->name, op, 0); } op++; @@ -3070,7 +3043,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 6, 2, SUBYPTE_LOOP_16_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f+4, 0, 4); } @@ -3087,7 +3060,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 4, 2, SUBYPTE_UNCOND_9_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 2); } @@ -3096,7 +3069,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_UNCOND_9_22_32, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 4); } @@ -3113,7 +3086,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_17_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 6); } @@ -3122,7 +3095,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_17_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 4); } @@ -3134,7 +3107,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 6); } @@ -3143,7 +3116,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_22, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 4); } @@ -3158,7 +3131,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_17_22_32, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 8); } @@ -3167,7 +3140,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_17_22_32, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 6); } @@ -3179,7 +3152,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_22_32, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 8); } @@ -3188,7 +3161,7 @@ md_assemble (char *str) f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_22_32, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, - (char *)(size_t) fixups[0].opindex); + (char *) (uintptr_t) fixups[0].opindex); md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 6); } @@ -3312,8 +3285,7 @@ md_assemble (char *str) f - frag_now->fr_literal, 4, & fixups[i].exp, (operand->flags & V850_PCREL) != 0, - (bfd_reloc_code_real_type) (fixups[i].opindex - + (int) BFD_RELOC_UNUSED)); + fixups[i].opindex + BFD_RELOC_UNUSED); } } @@ -3396,7 +3368,7 @@ v850_pcrel_from_section (fixS *fixp, segT section) /* If the symbol is undefined, or in a section other than our own, or it is weak (in which case it may well be in another section, then let the linker figure it out. */ - if (fixp->fx_addsy != (symbolS *) NULL + if (fixp->fx_addsy != NULL && (! S_IS_DEFINED (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy) || (S_GET_SEGMENT (fixp->fx_addsy) != section))) @@ -3420,7 +3392,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) return; } - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_addnumber = value, fixP->fx_done = 1; @@ -3430,7 +3402,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) else { value = fixP->fx_offset; - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) { if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section) value -= S_GET_VALUE (fixP->fx_subsy); @@ -3441,14 +3413,14 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) fixP->fx_addnumber = value; } - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { int opindex; const struct v850_operand *operand; unsigned long insn; const char *errmsg = NULL; - opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; operand = &v850_operands[opindex]; /* Fetch the instruction, insert the fully resolved operand @@ -3459,9 +3431,9 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) where = fixP->fx_frag->fr_literal + fixP->fx_where; if (fixP->fx_size > 2) - insn = bfd_getl32 ((unsigned char *) where); + insn = bfd_getl32 (where); else - insn = bfd_getl16 ((unsigned char *) where); + insn = bfd_getl16 (where); /* When inserting loop offsets a backwards displacement is encoded as a positive value. */ @@ -3474,9 +3446,9 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) as_warn_where (fixP->fx_file, fixP->fx_line, "%s", errmsg); if (fixP->fx_size > 2) - bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putl32 (insn, where); else - bfd_putl16 ((bfd_vma) insn, (unsigned char *) where); + bfd_putl16 (insn, where); if (fixP->fx_done) /* Nothing else to do here. */ @@ -3512,7 +3484,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) && ((struct v850_operand *) fixP->tc_fix_data)->insert != NULL) { const char * message = NULL; - struct v850_operand * operand = (struct v850_operand *) fixP->tc_fix_data; + struct v850_operand * operand = fixP->tc_fix_data; unsigned long insn; /* The variable "where" currently points at the exact point inside @@ -3525,14 +3497,14 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) else if (fixP->fx_size == 1) where -= 3; - insn = bfd_getl32 ((unsigned char *) where); + insn = bfd_getl32 (where); /* Use the operand's insertion procedure, if present, in order to make sure that the value is correctly stored in the insn. */ insn = operand->insert (insn, (offsetT) value, & message); /* Ignore message even if it is set. */ - bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putl32 (insn, where); } else { @@ -3540,17 +3512,17 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) { case BFD_RELOC_V850_32_ABS: case BFD_RELOC_V850_32_PCREL: - bfd_putl32 (value & 0xfffffffe, (unsigned char *) where); + bfd_putl32 (value & 0xfffffffe, where); break; case BFD_RELOC_32: - bfd_putl32 (value, (unsigned char *) where); + bfd_putl32 (value, where); break; case BFD_RELOC_V850_23: bfd_putl32 (((value & 0x7f) << 4) | ((value & 0x7fff80) << (16-7)) | (bfd_getl32 (where) & ~((0x7f << 4) | (0xffff << 16))), - (unsigned char *) where); + where); break; case BFD_RELOC_16: @@ -3561,7 +3533,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_V850_SDA_16_16_OFFSET: case BFD_RELOC_V850_TDA_16_16_OFFSET: case BFD_RELOC_V850_CALLT_16_16_OFFSET: - bfd_putl16 (value & 0xffff, (unsigned char *) where); + bfd_putl16 (value & 0xffff, where); break; case BFD_RELOC_8: @@ -3580,7 +3552,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_V850_16_PCREL: bfd_putl16 ((-value & 0xfffe) | (bfd_getl16 (where + 2) & 0x0001), - (unsigned char *) (where + 2)); + where + 2); break; case BFD_RELOC_V850_22_PCREL: @@ -3592,7 +3564,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_V850_LO16_S1: case BFD_RELOC_V850_ZDA_15_16_OFFSET: case BFD_RELOC_V850_SDA_15_16_OFFSET: - bfd_putl16 (value & 0xfffe, (unsigned char *) where); + bfd_putl16 (value & 0xfffe, where); break; case BFD_RELOC_V850_16_SPLIT_OFFSET: @@ -3748,7 +3720,7 @@ v850_md_finish (void) /* Write the note type. */ p = frag_more (4); - md_number_to_chars (p, (valueT) id, 4); + md_number_to_chars (p, id, 4); /* Write the name field. */ p = frag_more (4); diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c index e256d08..1705380 100644 --- a/gas/config/tc-vax.c +++ b/gas/config/tc-vax.c @@ -278,7 +278,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) { valueT value = * valueP; - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); if (fixP->fx_addsy == NULL) @@ -332,8 +332,7 @@ bignum_copy (LITTLENUM_TYPE *in, LITTLENUM_TYPE *p; /* -> most significant (non-zero) input littlenum. */ - memcpy ((void *) out, (void *) in, - (unsigned int) out_length << LITTLENUM_SHIFT); + memcpy (out, in, (unsigned int) out_length << LITTLENUM_SHIFT); for (p = in + in_length - 1; p >= in; --p) { if (*p) @@ -346,11 +345,10 @@ bignum_copy (LITTLENUM_TYPE *in, } else { - memcpy ((char *) out, (char *) in, - (unsigned int) in_length << LITTLENUM_SHIFT); + memcpy (out, in, (unsigned int) in_length << LITTLENUM_SHIFT); if (out_length > in_length) - memset ((char *) (out + in_length), '\0', + memset (out + in_length, 0, (unsigned int) (out_length - in_length) << LITTLENUM_SHIFT); significant_littlenums_dropped = 0; @@ -3356,7 +3354,7 @@ vax_cons_fix_new (fragS *frag, int where, unsigned int nbytes, expressionS *exp, : nbytes == 2 ? BFD_RELOC_16 : BFD_RELOC_32); - fix_new_exp (frag, where, (int) nbytes, exp, 0, r); + fix_new_exp (frag, where, nbytes, exp, 0, r); } const char * diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index 93c108f..01767f3 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -201,7 +201,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } void @@ -412,10 +412,9 @@ relaxed_symbol_addr (fragS *fragp, long stretch) if (f->fr_type == rs_align || f->fr_type == rs_align_code) { if (stretch < 0) - stretch = - ((- stretch) - & ~ ((1 << (int) f->fr_offset) - 1)); + stretch = -(-stretch & ~((1ul << f->fr_offset) - 1)); else - stretch &= ~ ((1 << (int) f->fr_offset) - 1); + stretch &= ~((1ul << f->fr_offset) - 1); if (stretch == 0) break; } @@ -493,7 +492,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, long visium_pcrel_from_section (fixS *fixP, segT sec) { - if (fixP->fx_addsy != (symbolS *) NULL + if (fixP->fx_addsy != NULL && (!S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { @@ -634,7 +633,7 @@ md_apply_fix (fixS * fixP, valueT * value, segT segment) break; default: /* It's a relocation against an instruction. */ - insn = bfd_getb32 ((unsigned char *) buf); + insn = bfd_getb32 (buf); switch (fixP->fx_r_type) { @@ -683,11 +682,11 @@ md_apply_fix (fixS * fixP, valueT * value, segT segment) default: as_bad_where (fixP->fx_file, fixP->fx_line, "bad or unhandled relocation type: 0x%02x", - fixP->fx_r_type); + (unsigned int) fixP->fx_r_type); break; } - bfd_putb32 (insn, (unsigned char *) buf); + bfd_putb32 (insn, buf); visium_update_parity_bit (buf); break; } @@ -831,8 +830,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = 0; i < prec; i++) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -840,8 +838,7 @@ md_atof (int type, char *litP, int *sizeP) { for (i = prec - 1; i >= 0; i--) { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); + md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } } @@ -1375,9 +1372,8 @@ md_assemble (char *str0) if (imm < 0 || imm > 31) as_bad ("immediate value out of range"); - opcode |= - (r1 << 10) | (r2 << 16) | (1 << 9) | ((imm & 0x1f) << - 4); + opcode |= ((r1 << 10) | (r2 << 16) | (1 << 9) + | ((imm & 0x1f) << 4)); } else { @@ -1891,9 +1887,8 @@ md_assemble (char *str0) if (finst < 0 || finst > 15) as_bad ("finst out of range"); - opcode |= - ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 << - 4); + opcode |= (((finst & 0xf) << 27) + | (r1 << 10) | (r2 << 16) | (r3 << 4)); } else { @@ -1957,9 +1952,8 @@ md_assemble (char *str0) if (finst < 0 || finst > 15) as_bad ("finst out of range"); - opcode |= - ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 << - 4); + opcode |= (((finst & 0xf) << 27) + | (r1 << 10) | (r2 << 16) | (r3 << 4)); } else { diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c index 066255f..23d2b43 100644 --- a/gas/config/tc-wasm32.c +++ b/gas/config/tc-wasm32.c @@ -178,7 +178,7 @@ valueT md_section_align (asection * seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } /* Apply a fixup, return TRUE if done (and no relocation is diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index 239310d..4a7829f 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -104,7 +104,7 @@ static void get_default_target (void); static char *extract_word (char *, char *, int); static struct xgate_opcode *xgate_find_match (struct xgate_opcode_handle *, int, s_operand [], unsigned int); -static int cmp_opcode (struct xgate_opcode *, struct xgate_opcode *); +static int cmp_opcode (const void *, const void *); static void xgate_print_table (void); static unsigned int xgate_get_operands (char *, s_operand []); static register_id reg_name_search (char *); @@ -308,7 +308,7 @@ md_begin (void) xgate_op_table[i] = xgate_opcode_ptr[i]; qsort (xgate_op_table, xgate_num_opcodes, sizeof (struct xgate_opcode), - (int (*)(const void *, const void *)) cmp_opcode); + cmp_opcode); /* Calculate number of handles since this will be smaller than the raw number of opcodes in the table. */ @@ -466,7 +466,7 @@ valueT md_section_align (asection * seg, valueT addr) { int align = bfd_section_alignment (seg); - return ((addr + (1 << align) - 1) & -(1 << align)); + return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align); } void @@ -621,7 +621,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) else reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) + if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, _ ("Relocation %d is not supported by object file format."), @@ -652,11 +652,11 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) /* If the fixup is done mark it done so no further symbol resolution will take place. */ - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); where = fixP->fx_frag->fr_literal + fixP->fx_where; @@ -705,7 +705,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) _("Value out of 16-bit range.")); value >>= 8; value &= 0x00ff; - bfd_putb16 ((bfd_vma) value | opcode, (void *) where); + bfd_putb16 (value | opcode, where); break; case BFD_RELOC_XGATE_24: case BFD_RELOC_XGATE_IMM8_LO: @@ -713,7 +713,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) as_bad_where (fixP->fx_file, fixP->fx_line, _("Value out of 16-bit range.")); value &= 0x00ff; - bfd_putb16 ((bfd_vma) value | opcode, (void *) where); + bfd_putb16 (value | opcode, where); break; case BFD_RELOC_XGATE_IMM3: if (value < 0 || value > 7) @@ -737,13 +737,13 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) number_to_chars_bigendian (where, (opcode | value), 2); break; case BFD_RELOC_8: - ((bfd_byte *) where)[0] = (bfd_byte) value; + *where = value & 0xff; break; case BFD_RELOC_32: - bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (value, where); break; case BFD_RELOC_16: - bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + bfd_putb16 (value, where); break; default: as_fatal (_("Line %d: unknown relocation type: 0x%x."), fixP->fx_line, @@ -896,8 +896,10 @@ xgate_parse_exp (char *s, expressionS * op) } static int -cmp_opcode (struct xgate_opcode *op1, struct xgate_opcode *op2) +cmp_opcode (const void *p1, const void *p2) { + const struct xgate_opcode *op1 = p1; + const struct xgate_opcode *op2 = p2; return strcmp (op1->name, op2->name); } @@ -1121,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[]) unsigned short oper_mask = 0; int operand_bit_length = 0; unsigned int operand = 0; - char n_operand_bits = 0; char first_operand_equals_second = 0; int i = 0; char c = 0; @@ -1137,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[]) { oper_mask <<= 1; oper_mask += 1; - n_operand_bits++; } } diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index 83bf873..7a90316 100644 --- a/gas/config/tc-xstormy16.c +++ b/gas/config/tc-xstormy16.c @@ -331,7 +331,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, long md_pcrel_from_section (fixS * fixP, segT sec) { - if ((fixP->fx_addsy != (symbolS *) NULL + if ((fixP->fx_addsy != NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) || xstormy16_force_relocation (fixP)) @@ -474,16 +474,16 @@ xstormy16_md_apply_fix (fixS * fixP, break; } - if (fixP->fx_addsy == (symbolS *) NULL) + if (fixP->fx_addsy == NULL) fixP->fx_done = 1; /* We don't actually support subtracting a symbol. */ - if (fixP->fx_subsy != (symbolS *) NULL) + if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + if (fixP->fx_r_type >= BFD_RELOC_UNUSED) { - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex); const char *errmsg; bfd_reloc_code_real_type reloc_type; @@ -496,7 +496,7 @@ xstormy16_md_apply_fix (fixS * fixP, CGEN_FIELDS *fields = xmalloc (CGEN_CPU_SIZEOF_FIELDS (cd)); CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn)); - CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value); + CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, value); #if CGEN_INT_INSN_P { @@ -507,7 +507,7 @@ xstormy16_md_apply_fix (fixS * fixP, /* ??? 0 is passed for `pc'. */ errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, - &insn_value, (bfd_vma) 0); + &insn_value, 0); cgen_put_insn_value (cd, (unsigned char *) where, CGEN_INSN_BITSIZE (insn), insn_value, gas_cgen_cpu_desc->insn_endian); @@ -516,7 +516,7 @@ xstormy16_md_apply_fix (fixS * fixP, /* ??? 0 is passed for `pc'. */ errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, (unsigned char *) where, - (bfd_vma) 0); + 0); #endif if (errmsg) as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg); diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 1889608..af1154e 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -1312,7 +1312,7 @@ get_directive (directiveE *directive, bool *negated) if (strncmp (directive_string, directive_info[i].name, len) == 0) { input_line_pointer += len; - *directive = (directiveE) i; + *directive = i; if (*negated && !directive_info[i].can_be_negated) as_bad (_("directive %s cannot be negated"), directive_info[i].name); @@ -1321,7 +1321,7 @@ get_directive (directiveE *directive, bool *negated) } as_bad (_("unknown directive")); - *directive = (directiveE) XTENSA_UNDEFINED; + *directive = XTENSA_UNDEFINED; } @@ -1705,7 +1705,7 @@ xtensa_elf_cons (int nbytes) as_bad (_("invalid use of %s relocation"), reloc_howto->name); else { - char *p = frag_more ((int) nbytes); + char *p = frag_more (nbytes); xtensa_set_frag_assembly_state (frag_now); fix_new_exp (frag_now, p - frag_now->fr_literal, nbytes, &exp, reloc_howto->pc_relative, reloc); @@ -1714,7 +1714,7 @@ xtensa_elf_cons (int nbytes) else { xtensa_set_frag_assembly_state (frag_now); - emit_expr (&exp, (unsigned int) nbytes); + emit_expr (&exp, nbytes); } } while (*input_line_pointer++ == ','); @@ -1869,7 +1869,7 @@ expression_end (const char *name) } -#define ERROR_REG_NUM ((unsigned) -1) +#define ERROR_REG_NUM (-1u) static unsigned tc_get_register (const char *prefix) @@ -1903,7 +1903,7 @@ tc_get_register (const char *prefix) return ERROR_REG_NUM; } - if (!ISDIGIT ((unsigned char) *input_line_pointer)) + if (!ISDIGIT (*input_line_pointer)) { as_bad (_("bad register number: %s"), input_line_pointer); return ERROR_REG_NUM; @@ -1911,7 +1911,7 @@ tc_get_register (const char *prefix) reg = 0; - while (ISDIGIT ((int) *input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) reg = reg * 10 + *input_line_pointer++ - '0'; if (!(next_expr = expression_end (input_line_pointer))) @@ -1961,7 +1961,7 @@ expression_maybe_register (xtensa_opcode opc, int opnd, expressionS *tok) case BFD_RELOC_HI16: if (tok->X_op == O_constant) { - tok->X_add_number = ((unsigned) tok->X_add_number) >> 16; + tok->X_add_number = ((uint32_t) tok->X_add_number) >> 16; return; } break; @@ -2522,7 +2522,7 @@ xg_translate_idioms (char **popname, int *pnum_args, char **arg_strings) { if (*pnum_args == 0) { - arg_strings[0] = (char *) xmalloc (2); + arg_strings[0] = xmalloc (2); strcpy (arg_strings[0], "0"); *pnum_args = 1; } @@ -5378,7 +5378,7 @@ xtensa_frob_label (symbolS *sym) /* Since the label was already attached to a frag associated with the previous basic block, it now needs to be reset to the current frag. */ symbol_set_frag (sym, frag_now); - S_SET_VALUE (sym, (valueT) frag_now_fix ()); + S_SET_VALUE (sym, frag_now_fix ()); if (generating_literals) xtensa_add_literal_sym (sym); @@ -9001,15 +9001,15 @@ xtensa_add_config_info (void) /* Follow the standard note section layout: First write the length of the name string. */ p = frag_more (4); - md_number_to_chars (p, (valueT) XTINFO_NAMESZ, 4); + md_number_to_chars (p, XTINFO_NAMESZ, 4); /* Next comes the length of the "descriptor", i.e., the actual data. */ p = frag_more (4); - md_number_to_chars (p, (valueT) sz, 4); + md_number_to_chars (p, sz, 4); /* Write the note type. */ p = frag_more (4); - md_number_to_chars (p, (valueT) XTINFO_TYPE, 4); + md_number_to_chars (p, XTINFO_TYPE, 4); /* Write the name field. */ p = frag_more (XTINFO_NAMESZ); @@ -10321,7 +10321,7 @@ relax_frag_immed (segT segP, min_steps, stretch); gas_assert (num_steps >= min_steps && num_steps <= RELAX_IMMED_MAXSTEPS); - fragP->tc_frag_data.slot_subtypes[slot] = (int) RELAX_IMMED + num_steps; + fragP->tc_frag_data.slot_subtypes[slot] = RELAX_IMMED + num_steps; /* Figure out the number of bytes needed. */ num_literal_bytes = get_num_stack_literal_bytes (&istack); @@ -10350,8 +10350,7 @@ relax_frag_immed (segT segP, min_steps, stretch + old_size); gas_assert (num_steps >= min_steps && num_steps <= RELAX_IMMED_MAXSTEPS); - fragP->tc_frag_data.slot_subtypes[slot] - = (int) RELAX_IMMED + num_steps; + fragP->tc_frag_data.slot_subtypes[slot] = RELAX_IMMED + num_steps; num_literal_bytes = get_num_stack_literal_bytes (&istack); literal_diff diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 3abc026..add28a3 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -633,6 +633,33 @@ z80_start_line_hook (void) break; } } + /* Remove leading zeros from dollar local labels if SDCC compat enabled. */ + if (sdcc_compat && *input_line_pointer == '0') + { + char *dollar; + + /* SDCC emits at most one label definition per line, so it is + enough to look at only the first label. Hand-written asm + might use more, but then it is unlikely to use leading zeros + on dollar local labels. */ + + /* Place p at the first character after [0-9]+. */ + for (p = input_line_pointer; *p >= '0' && *p <= '9'; ++p) + ; + + /* Is this a dollar sign label? + GAS allows spaces between $ and :, but SDCC does not. */ + if (p[0] == '$' && p[1] == ':') + { + dollar = p; + /* Replace zeros with spaces until the first non-zero, + but leave the last character before $ intact (for e.g. 0$:). */ + for (p = input_line_pointer; *p == '0' && p < dollar - 1; ++p) + { + *p = ' '; + } + } + } /* Check for <label>[:] =|([.](EQU|DEFL)) <value>. */ if (is_name_beginner (*input_line_pointer)) { @@ -2966,10 +2993,10 @@ emit_lea (char prefix, char opcode, const char * args) switch (rnum) { case REG_IX: - opcode = (opcode == (char)0x33) ? 0x55 : (opcode|0x00); + opcode = opcode == 0x33 ? 0x55 : opcode | 0x00; break; case REG_IY: - opcode = (opcode == (char)0x32) ? 0x54 : (opcode|0x01); + opcode = opcode == 0x32 ? 0x54 : opcode | 0x01; } q = frag_more (2); @@ -3420,7 +3447,7 @@ assemble_suffix (const char **suffix) i = 0x40; break; } - *frag_more (1) = (char)i; + *frag_more (1) = i; switch (i) { case 0x40: inst_mode = INST_MODE_FORCED | INST_MODE_S | INST_MODE_IS; break; @@ -3720,7 +3747,7 @@ is_overflow (long value, unsigned bitsize) { if (value < 0) return signed_overflow (value, bitsize); - return unsigned_overflow ((unsigned long)value, bitsize); + return unsigned_overflow (value, bitsize); } void @@ -4064,8 +4091,8 @@ str_to_zeda32(char *litP, int *sizeP) else if (!sign) mantissa &= (1ull << 23) - 1; for (i = 0; i < 24; i += 8) - *litP++ = (char)(mantissa >> i); - *litP = (char)(0x80 + exponent); + *litP++ = mantissa >> i; + *litP = 0x80 + exponent; return NULL; } @@ -4111,9 +4138,9 @@ str_to_float48(char *litP, int *sizeP) return _("overflow"); if (!sign) mantissa &= (1ull << 39) - 1; - *litP++ = (char)(0x80 + exponent); + *litP++ = 0x80 + exponent; for (i = 0; i < 40; i += 8) - *litP++ = (char)(mantissa >> i); + *litP++ = mantissa >> i; return NULL; } diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index 9947fe1..83a732f 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -164,7 +164,7 @@ md_begin (void) opcode_entry_type *fake_opcode; fake_opcode = XNEW (opcode_entry_type); fake_opcode->name = md_pseudo_table[idx].poc_name; - fake_opcode->func = (void *) (md_pseudo_table + idx); + fake_opcode->p = md_pseudo_table + idx; fake_opcode->opcode = 250; str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode, 0); } @@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE { unsigned char *output_ptr = buffer; int c; - int nibble; unsigned int *class_ptr; frag_wane (frag_now); @@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE memset (buffer, 0, sizeof (buffer)); class_ptr = this_try->byte_info; - for (nibble = 0; (c = *class_ptr++); nibble++) + while ((c = *class_ptr++) != 0) { switch (c & CLASS_MASK) @@ -1248,7 +1247,7 @@ md_assemble (char *str) if (opcode->opcode == 250) { - pseudo_typeS *p; + const pseudo_typeS *p; char oc; char *old = input_line_pointer; @@ -1260,7 +1259,7 @@ md_assemble (char *str) *old = '\n'; while (is_whitespace (*input_line_pointer)) input_line_pointer++; - p = (pseudo_typeS *) (opcode->func); + p = opcode->p; (p->poc_handler) (p->poc_val); input_line_pointer = old; diff --git a/gas/config/te-nacl.h b/gas/config/te-nacl.h deleted file mode 100644 index fff7388..0000000 --- a/gas/config/te-nacl.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2012-2025 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3, - or (at your option) any later version. - - GAS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#define TE_NACL - -#define LOCAL_LABELS_DOLLAR 1 -#define LOCAL_LABELS_FB 1 - -/* These are for ARM but don't hurt other CPU targets. - They match the settings from te-armeabi.h; NaCl/ARM is based on EABI. */ -#define FPU_DEFAULT FPU_ARCH_SOFTVFP -#define EABI_DEFAULT EF_ARM_EABI_VER5 - -#include "obj-format.h" diff --git a/gas/config/te-vms.c b/gas/config/te-vms.c index c88fbbe..8e6f7e7 100644 --- a/gas/config/te-vms.c +++ b/gas/config/te-vms.c @@ -169,7 +169,7 @@ vms_file_stats_name (const char *dirname, return 0; } - fullname = concat (dirname, filename, NULL); + fullname = concat (dirname, filename, (const char *) NULL); tryfile = to_vms_file_spec (fullname); /* Allocate and initialize a FAB and NAM structures. */ @@ -278,7 +278,7 @@ vms_file_stats_name (const char *dirname, struct tm *ts; long long gmtoff, secs, nsecs; - fullname = concat (dirname, filename, NULL); + fullname = concat (dirname, filename, (const char *) NULL); if ((stat (fullname, &buff)) != 0) { |