From: Alan Modra Date: Tue, 8 Jul 2025 23:29:10 +0000 (+0930) Subject: gas NULL casts X-Git-Tag: binutils-2_45~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a12e548ba3cc61c62211d22b1e5c058fbc8a138;p=thirdparty%2Fbinutils-gdb.git gas NULL casts This removes many unnecessary NULL casts. I'm also adding a few arg casts in concat calls, to make the code consistent. Advice from quite a few years ago was that it's better to use the exact type for args corresponding to function ellipses, in case NULL is defined as plain 0. (I think that happened with some early 64-bit systems. Plain NULL ought to be OK nowadays.) --- diff --git a/gas/as.c b/gas/as.c index c7de3a9f4e8..78970ff2714 100644 --- a/gas/as.c +++ b/gas/as.c @@ -791,7 +791,7 @@ This program has absolutely no warranty.\n")); if (*s == '\0') as_fatal (_("bad defsym; format is --defsym name=value")); *s++ = '\0'; - i = bfd_scan_vma (s, (const char **) NULL, 0); + i = bfd_scan_vma (s, NULL, 0); n = XNEW (struct defsym_list); n->next = defsyms; n->name = optarg; diff --git a/gas/cgen.c b/gas/cgen.c index 8fbb531035c..f5b9030a019 100644 --- a/gas/cgen.c +++ b/gas/cgen.c @@ -848,11 +848,11 @@ gas_cgen_md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) /* Canonical name, since used a lot. */ CGEN_CPU_DESC cd = gas_cgen_cpu_desc; - 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_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); if (fixP->fx_r_type >= BFD_RELOC_UNUSED) diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index f481ad448d7..20167e94040 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 becf7a969f2..1607a430cf6 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 1f9eaa33c93..93f1a8bbe0e 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -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); @@ -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) @@ -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 368594d3a04..e2425fe3578 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2691,7 +2691,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-macho.c b/gas/config/obj-macho.c index ae26d670b18..adcdb99c740 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -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 @@ -1875,7 +1875,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 0d8108f4e04..1a77176413a 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); @@ -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 29a81d17112..dd66e006a7b 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -10269,7 +10269,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 diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index bfdf338615d..613211ceb53 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -638,7 +638,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 +736,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; @@ -1738,7 +1738,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 +1754,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; @@ -2028,7 +2028,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) { @@ -3387,11 +3387,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) @@ -4864,7 +4864,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; @@ -4907,7 +4907,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; @@ -5092,7 +5092,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; diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 391ff6f6f9e..83f03c3f4cf 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2767,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)) { @@ -3917,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; diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index c6045a1ff80..f6f4eb99c93 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); @@ -29996,7 +29996,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-avr.c b/gas/config/tc-avr.c index 650b736bfd4..fbadf373944 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -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 @@ -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"), diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 5b1db29b505..d4caa9e6cee 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)) { diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c index 84eab3f88af..5ba2bbd16c3 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")); @@ -848,7 +848,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) diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c index 5780386e585..a7ac4efba3b 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; @@ -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 fffd3f12b45..da153fed986 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"), @@ -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: diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index beb46facd22..7eaf7a90bca 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -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; diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index b10cdffbdda..ff1bedbf2af 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -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; diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 76827d501b6..4a25da2f58b 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -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,11 +1901,11 @@ 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 diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 64d70f4cb5d..6b514d3cbf0 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -248,7 +248,7 @@ 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 ((fixP->fx_r_type < BFD_RELOC_UNUSED) @@ -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) diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 2b135f45f00..8246113582c 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -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 2c84812b5c7..86d8277041e 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; @@ -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 @@ -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 83d3e1f5731..e5d9a8a9bc6 100644 --- a/gas/config/tc-ft32.c +++ b/gas/config/tc-ft32.c @@ -581,7 +581,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-i386.c b/gas/config/tc-i386.c index b0a22bb7e92..5e0c0c1a9f0 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 @@ -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; } } diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 827f6b1544c..bb3eb67c72b 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -3572,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 @@ -3591,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); } diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index e7e123574d1..f0259f8bc3b 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -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)) { diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index c101d71d450..d2e2226347f 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. */ @@ -357,7 +357,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 +368,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-m32c.c b/gas/config/tc-m32c.c index de2f86c87e2..a65daae1e5b 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -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). diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 6946b2e50c8..2bd32afab1d 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,7 +609,7 @@ 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; @@ -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); @@ -1837,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) diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 40dd4561c3f..e80c6dfd052 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -3835,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."), @@ -4326,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 diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 446d9d8a2ef..ad8ab96697a 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -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; diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c index 8688bfaf424..f20f0d36372 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 d35a8639c49..e1327676272 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -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)) diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index 097a0ead4d4..0e4cf7245c3 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -2444,7 +2444,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 9f4e01dd64a..9c0f2687bab 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -2617,7 +2617,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) { @@ -17656,7 +17656,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 @@ -19915,7 +19915,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 (); @@ -19956,7 +19956,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 68fd52d06a1..631dcc924e6 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -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)) { diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index db66e201b43..f57540e6fb6 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -676,7 +676,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 +697,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 +734,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; @@ -844,17 +844,18 @@ mn10200_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 & 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 @@ -1318,7 +1319,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 3c8834e2c0f..4e24254e4e1 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -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-msp430.c b/gas/config/tc-msp430.c index 563365faaf7..d5a11f84bbc 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -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) { diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index 9dd884f42f9..e5e9d5ca1f3 100644 --- a/gas/config/tc-mt.c +++ b/gas/config/tc-mt.c @@ -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). diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index a159ddb2c54..dc5a8af9675 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -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-or1k.c b/gas/config/tc-or1k.c index 5b3e0130628..87a2ac0e3cd 100644 --- a/gas/config/tc-or1k.c +++ b/gas/config/tc-or1k.c @@ -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 5a93b41786f..5eec9568107 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. */ @@ -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 @@ -2947,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; @@ -3452,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) @@ -3495,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)) @@ -3693,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 @@ -4647,7 +4647,7 @@ ppc_change_csect (symbolS *sym, offsetT align) 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; @@ -5288,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'; @@ -5389,7 +5389,6 @@ ppc_bf (int ignore ATTRIBUTE_UNUSED) saved_bi_sym = 0; } - symbol_get_tc (sym)->output = 1; ppc_frob_label (sym); @@ -5459,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); @@ -5631,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 { @@ -5656,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; @@ -5764,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")); @@ -6008,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; @@ -6109,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 { @@ -6118,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; @@ -6130,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; @@ -6139,7 +6138,7 @@ 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, @@ -6159,7 +6158,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 { @@ -6202,7 +6201,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 @@ -6257,10 +6256,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 @@ -6293,14 +6292,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) @@ -6598,17 +6597,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); @@ -6989,7 +6988,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 @@ -7763,7 +7762,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-pru.c b/gas/config/tc-pru.c index 00208e4fd06..6200461440e 100644 --- a/gas/config/tc-pru.c +++ b/gas/config/tc-pru.c @@ -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 diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index cb21620b5ff..f5740f8e81b 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -5783,7 +5783,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-s12z.c b/gas/config/tc-s12z.c index 9c8fcfe1ec4..8f7c5d1bc95 100644 --- a/gas/config/tc-s12z.c +++ b/gas/config/tc-s12z.c @@ -3891,7 +3891,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 +3930,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); /* diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index e1ab865a322..03f955944e8 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -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 @@ -5574,7 +5574,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 (); @@ -5708,7 +5708,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 (); diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 90bd5c2f4de..d49abc25501 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3816,7 +3816,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-spu.c b/gas/config/tc-spu.c index 82e0eb1df31..e189d1b88fa 100644 --- a/gas/config/tc-spu.c +++ b/gas/config/tc-spu.c @@ -872,7 +872,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 +950,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 87cf09a39fd..7f00418f479 100644 --- a/gas/config/tc-tic30.c +++ b/gas/config/tc-tic30.c @@ -1151,7 +1151,7 @@ symbolS * md_undefined_symbol (char *name ATTRIBUTE_UNUSED) { debug ("In md_undefined_symbol()\n"); - return (symbolS *) 0; + return NULL; } valueT diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index f5284d8219f..0ee5f6d8b59 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -3000,7 +3000,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 ed3efc49665..0add19b23ea 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -533,7 +533,7 @@ 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, 0, symbolP, words * OCTETS_PER_BYTE, NULL); @@ -573,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) @@ -593,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; diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index f70388ca854..fae4b0a20c4 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -1467,7 +1467,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); diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 85a59ac034d..8e1062b0330 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -3393,7 +3393,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))) @@ -3417,7 +3417,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; @@ -3427,7 +3427,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); diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c index e256d08a36e..dca86dac195 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) diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index 93c108f0368..6fadf409cf4 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -493,7 +493,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)) { diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index 239310d1553..be9cac7ce80 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -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; diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index f7807f5049d..f86423da6d7 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,11 +474,11 @@ 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 (fixP->fx_r_type >= BFD_RELOC_UNUSED) diff --git a/gas/config/te-vms.c b/gas/config/te-vms.c index c88fbbec70f..8e6f7e7ec97 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) { diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index a21ae322488..5eb8a5d1de8 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -236,7 +236,7 @@ get_debugseg_name (segT seg, const char *base_name) { if (!strcmp (base_name, ".eh_frame_entry") && strcmp (name, ".text") != 0) - return notes_concat (base_name, ".", name, NULL); + return notes_concat (base_name, ".", name, (const char *) NULL); name = ""; } @@ -249,7 +249,7 @@ get_debugseg_name (segT seg, const char *base_name) else name = dollar; - return notes_concat (base_name, name, NULL); + return notes_concat (base_name, name, (const char *) NULL); } /* Allocate a dwcfi_seg_list structure. */ diff --git a/gas/ecoff.c b/gas/ecoff.c index 360127b53b3..27724bbe474 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -813,8 +813,8 @@ typedef struct varray { #endif #define INIT_VARRAY(type) { /* macro to initialize a varray */ \ - (vlinks_t *)0, /* first */ \ - (vlinks_t *)0, /* last */ \ + 0, /* first */ \ + 0, /* last */ \ 0, /* num_allocated */ \ sizeof (type), /* object_size */ \ OBJECTS_PER_PAGE (type), /* objects_per_page */ \ @@ -980,22 +980,22 @@ static const efdr_t init_file = { 0, /* cbLine: size of lines for this file */ }, - (FDR *)0, /* orig_fdr: original file header pointer */ - (char *)0, /* name: pointer to filename */ + 0, /* orig_fdr: original file header pointer */ + 0, /* name: pointer to filename */ 0, /* fake: whether this is a faked .file */ 0, /* void_type: ptr to aux node for void type */ 0, /* int_type: ptr to aux node for int type */ - (scope_t *)0, /* cur_scope: current scope being processed */ + 0, /* cur_scope: current scope being processed */ 0, /* file_index: current file # */ 0, /* nested_scopes: # nested scopes */ INIT_VARRAY (char), /* strings: local string varray */ - INIT_VARRAY (localsym_t), /* symbols: local symbols varray */ + INIT_VARRAY (localsym_t), /* symbols: local symbols varray */ INIT_VARRAY (proc_t), /* procs: procedure varray */ INIT_VARRAY (aux_t), /* aux_syms: auxiliary symbols varray */ - (struct efdr *)0, /* next_file: next file structure */ + 0, /* next_file: next file structure */ - (htab_t)0, /* str_hash: string hash table */ + 0, /* str_hash: string hash table */ { 0 }, /* thash_head: type hash table */ }; @@ -1385,11 +1385,11 @@ static alloc_info_t alloc_counts[alloc_type_last]; int ecoff_debugging_seen = 0; /* Various statics. */ -static efdr_t *cur_file_ptr = (efdr_t *) 0; /* current file desc. header */ -static proc_t *cur_proc_ptr = (proc_t *) 0; /* current procedure header */ -static proc_t *first_proc_ptr = (proc_t *) 0; /* first procedure header */ -static thead_t *top_tag_head = (thead_t *) 0; /* top level tag head */ -static thead_t *cur_tag_head = (thead_t *) 0; /* current tag head */ +static efdr_t *cur_file_ptr = 0; /* current file desc. header */ +static proc_t *cur_proc_ptr = 0; /* current procedure header */ +static proc_t *first_proc_ptr = 0; /* first procedure header */ +static thead_t *top_tag_head = 0; /* top level tag head */ +static thead_t *cur_tag_head = 0; /* current tag head */ #ifdef ECOFF_DEBUG static int debug = 0; /* trace functions */ #endif @@ -1478,8 +1478,8 @@ ecoff_read_begin_hook (void) { tag_hash = str_htab_create (); top_tag_head = allocate_thead (); - top_tag_head->first_tag = (tag_t *) NULL; - top_tag_head->free = (thead_t *) NULL; + top_tag_head->first_tag = NULL; + top_tag_head->free = NULL; top_tag_head->prev = cur_tag_head; cur_tag_head = top_tag_head; } @@ -1496,9 +1496,9 @@ ecoff_symbol_new_hook (symbolS *symbolP) symbol created by md_begin which may required special handling at some point. Creating a dummy file with a dummy name is certainly wrong. */ - if (cur_file_ptr == (efdr_t *) NULL + if (cur_file_ptr == NULL && seen_at_least_1_file ()) - add_file ((const char *) NULL, 0, 1); + add_file (NULL, 0, 1); obj = symbol_get_obj (symbolP); obj->ecoff_file = cur_file_ptr; obj->ecoff_symbol = NULL; @@ -1535,7 +1535,7 @@ add_varray_page (varray_t *vp /* varray to add page to */) new_links->start_index = vp->num_allocated; vp->objects_last_page = 0; - if (vp->first == (vlinks_t *) NULL) /* first allocation? */ + if (vp->first == NULL) /* first allocation? */ vp->first = vp->last = new_links; else { /* 2nd or greater allocation */ @@ -1583,7 +1583,7 @@ add_string (varray_t *vp, /* string obstack */ as_fatal (_("duplicate %s"), str); } - if (ret_hash != (shash_t **) NULL) + if (ret_hash != NULL) *ret_hash = hash_ptr; return hash_ptr->indx; @@ -1607,9 +1607,9 @@ add_ecoff_symbol (const char *str, /* symbol name */ tag_t *ptag_next; varray_t *vp; int scope_delta = 0; - shash_t *hash_ptr = (shash_t *) NULL; + shash_t *hash_ptr = NULL; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); vp = &cur_file_ptr->symbols; @@ -1619,19 +1619,19 @@ add_ecoff_symbol (const char *str, /* symbol name */ psym = &vp->last->datum->sym[vp->objects_last_page++]; - if (str == (const char *) NULL && sym_value != (symbolS *) NULL) + if (str == NULL && sym_value != NULL) psym->name = S_GET_NAME (sym_value); else psym->name = str; psym->as_sym = sym_value; - if (sym_value != (symbolS *) NULL) + if (sym_value != NULL) symbol_get_obj (sym_value)->ecoff_symbol = psym; psym->addend = addend; psym->file_ptr = cur_file_ptr; psym->proc_ptr = cur_proc_ptr; - psym->begin_ptr = (localsym_t *) NULL; - psym->index_ptr = (aux_t *) NULL; - psym->forward_ref = (forward_t *) NULL; + psym->begin_ptr = NULL; + psym->index_ptr = NULL; + psym->forward_ref = NULL; psym->sym_index = -1; memset (&psym->ecoff_sym, 0, sizeof (EXTR)); psym->ecoff_sym.asym.value = value; @@ -1643,8 +1643,8 @@ add_ecoff_symbol (const char *str, /* symbol name */ assembly before deciding where to put the name (it may be just an external symbol). Otherwise, this is just a debugging symbol and the name should go with the current file. */ - if (sym_value == (symbolS *) NULL) - psym->ecoff_sym.asym.iss = ((str == (const char *) NULL) + if (sym_value == NULL) + psym->ecoff_sym.asym.iss = (str == NULL ? 0 : add_string (&cur_file_ptr->strings, cur_file_ptr->str_hash, @@ -1658,7 +1658,7 @@ add_ecoff_symbol (const char *str, /* symbol name */ /* Save the symbol within the hash table if this is a static item, and it has a name. */ - if (hash_ptr != (shash_t *) NULL + if (hash_ptr != NULL && (type == st_Global || type == st_Static || type == st_Label || type == st_Proc || type == st_StaticProc)) hash_ptr->sym_ptr = psym; @@ -1696,7 +1696,7 @@ add_ecoff_symbol (const char *str, /* symbol name */ case st_End: pscope = cur_file_ptr->cur_scope; - if (pscope == (scope_t *) NULL) + if (pscope == NULL) as_fatal (_("too many st_End's")); else { @@ -1715,10 +1715,10 @@ add_ecoff_symbol (const char *str, /* symbol name */ cur_tag_head = ptag_head->prev; for (ptag = ptag_head->first_tag; - ptag != (tag_t *) NULL; + ptag != NULL; ptag = ptag_next) { - if (ptag->forward_ref != (forward_t *) NULL) + if (ptag->forward_ref != NULL) add_unknown_tag (ptag); ptag_next = ptag->same_block; @@ -1802,7 +1802,7 @@ add_aux_sym_symint (symint_t aux_word /* auxiliary information word */) varray_t *vp; aux_t *aux_ptr; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); vp = &cur_file_ptr->aux_syms; @@ -1825,7 +1825,7 @@ add_aux_sym_rndx (int file_index, symint_t sym_index) varray_t *vp; aux_t *aux_ptr; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); vp = &cur_file_ptr->aux_syms; @@ -1855,7 +1855,7 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ int i; AUXU aux; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); vp = &cur_file_ptr->aux_syms; @@ -1903,17 +1903,17 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ hi %= THASH_SIZE; for (hash_ptr = hash_tbl[hi]; - hash_ptr != (thash_t *)0; + hash_ptr; hash_ptr = hash_ptr->next) { if (aux.isym == hash_ptr->type.isym) break; } - if (hash_ptr != (thash_t *) NULL && state == hash_yes) + if (hash_ptr != NULL && state == hash_yes) return hash_ptr->indx; - if (hash_ptr == (thash_t *) NULL) + if (hash_ptr == NULL) { hash_ptr = allocate_thash (); hash_ptr->next = hash_tbl[hi]; @@ -1957,7 +1957,7 @@ add_aux_sym_tir (type_info_t *t, /* current type information */ localsym_t *sym = t->tag_ptr->sym; forward_t *forward_ref = allocate_forward (); - if (sym != (localsym_t *) NULL) + if (sym != NULL) { forward_ref->next = sym->forward_ref; sym->forward_ref = forward_ref; @@ -2007,16 +2007,16 @@ get_tag (const char *tag, /* tag name */ shash_t *hash_ptr; tag_t *tag_ptr; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); hash_ptr = str_hash_find (tag_hash, tag); - if (hash_ptr != (shash_t *) NULL - && hash_ptr->tag_ptr != (tag_t *) NULL) + if (hash_ptr != NULL + && hash_ptr->tag_ptr != NULL) { tag_ptr = hash_ptr->tag_ptr; - if (sym != (localsym_t *) NULL) + if (sym != NULL) { tag_ptr->basic_type = basic_type; tag_ptr->ifd = cur_file_ptr->file_index; @@ -2025,7 +2025,7 @@ get_tag (const char *tag, /* tag name */ return tag_ptr; } - if (hash_ptr == (shash_t *) NULL) + if (hash_ptr == NULL) { char *perm; @@ -2036,12 +2036,12 @@ get_tag (const char *tag, /* tag name */ } tag_ptr = allocate_tag (); - tag_ptr->forward_ref = (forward_t *) NULL; + tag_ptr->forward_ref = NULL; tag_ptr->hash_ptr = hash_ptr; tag_ptr->same_name = hash_ptr->tag_ptr; tag_ptr->basic_type = basic_type; tag_ptr->sym = sym; - tag_ptr->ifd = ((sym == (localsym_t *) NULL) + tag_ptr->ifd = (sym == NULL ? (symint_t) -1 : cur_file_ptr->file_index); tag_ptr->same_block = cur_tag_head->first_tag; @@ -2083,7 +2083,7 @@ add_unknown_tag (tag_t *ptag /* pointer to tag information */) (void) add_ecoff_symbol (name, st_End, sc_Info, NULL, 0, 0, 0); - for (pf = &sym->forward_ref; *pf != (forward_t *) NULL; pf = &(*pf)->next) + for (pf = &sym->forward_ref; *pf != NULL; pf = &(*pf)->next) ; *pf = ptag->forward_ref; } @@ -2111,7 +2111,7 @@ add_procedure (char *func /* func name */, int aent) if (aent) return; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) as_fatal (_("no current file pointer")); vp = &cur_file_ptr->procs; @@ -2121,7 +2121,7 @@ add_procedure (char *func /* func name */, int aent) cur_proc_ptr = new_proc_ptr = &vp->last->datum->proc[vp->objects_last_page++]; - if (first_proc_ptr == (proc_t *) NULL) + if (first_proc_ptr == NULL) first_proc_ptr = new_proc_ptr; vp->num_allocated++; @@ -2137,11 +2137,11 @@ add_procedure (char *func /* func name */, int aent) ++proc_cnt; /* Fill in the linenos preceding the .ent, if any. */ - if (noproc_lineno != (lineno_list_t *) NULL) + if (noproc_lineno != NULL) { lineno_list_t *l; - for (l = noproc_lineno; l != (lineno_list_t *) NULL; l = l->next) + for (l = noproc_lineno; l != NULL; l = l->next) l->proc = new_proc_ptr; *last_lineno_ptr = noproc_lineno; while (*last_lineno_ptr != NULL) @@ -2149,7 +2149,7 @@ add_procedure (char *func /* func name */, int aent) last_lineno = *last_lineno_ptr; last_lineno_ptr = &last_lineno->next; } - noproc_lineno = (lineno_list_t *) NULL; + noproc_lineno = NULL; } } @@ -2176,11 +2176,11 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) /* If the file name is NULL, then no .file symbol appeared, and we want to use the actual file name. */ - if (file_name == (const char *) NULL) + if (file_name == NULL) { - if (first_file != (efdr_t *) NULL) + if (first_file != NULL) as_fatal (_("fake .file after real one")); - file_name = as_where ((unsigned int *) NULL); + file_name = as_where (NULL); /* Automatically generate ECOFF debugging information, since I think that's what other ECOFF assemblers do. We don't do @@ -2228,7 +2228,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) /* See if the file has already been created. */ for (fil_ptr = first_file; - fil_ptr != (efdr_t *) NULL; + fil_ptr != NULL; fil_ptr = fil_ptr->next_file) { if (first_ch == fil_ptr->name[0] @@ -2243,7 +2243,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) } /* If this is a new file, create it. */ - if (fil_ptr == (efdr_t *) NULL) + if (fil_ptr == NULL) { if (file_desc.objects_last_page == file_desc.objects_per_page) add_varray_page (&file_desc); @@ -2261,10 +2261,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) fil_ptr->str_hash = str_htab_create (); /* Make sure 0 byte in string table is null */ - add_string (&fil_ptr->strings, - fil_ptr->str_hash, - "", - (shash_t **)0); + add_string (&fil_ptr->strings, fil_ptr->str_hash, "", NULL); if (strlen (file_name) > PAGE_USIZE - 2) as_fatal (_("filename goes over one page boundary")); @@ -2396,14 +2393,14 @@ ecoff_directive_begin (int ignore ATTRIBUTE_UNUSED) char *name; char name_end; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) { as_warn (_(".begin directive without a preceding .file directive")); demand_empty_rest_of_line (); return; } - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".begin directive without a preceding .ent directive")); demand_empty_rest_of_line (); @@ -2432,14 +2429,14 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED) char name_end; symbolS *endsym; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) { as_warn (_(".bend directive without a preceding .file directive")); demand_empty_rest_of_line (); return; } - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".bend directive without a preceding .ent directive")); demand_empty_rest_of_line (); @@ -2452,7 +2449,7 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED) corresponding symbol. We fill in the offset when we write out the symbol. */ endsym = symbol_find (name); - if (endsym == (symbolS *) NULL) + if (endsym == NULL) as_warn (_(".bend directive names unknown symbol")); else (void) add_ecoff_symbol (NULL, st_End, sc_Text, endsym, 0, 0, 0); @@ -2493,7 +2490,7 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED) name_end = get_symbol_name (&name); - if (coff_sym_name != (char *) NULL) + if (coff_sym_name != NULL) as_warn (_(".def pseudo-op used inside of .def/.endef; ignored")); else if (*name == '\0') as_warn (_("empty symbol name in .def; ignored")); @@ -2507,9 +2504,9 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED) coff_storage_class = sc_Nil; coff_symbol_typ = st_Nil; coff_is_function = 0; - coff_tag = (char *) NULL; + coff_tag = NULL; coff_value = 0; - coff_sym_value = (symbolS *) NULL; + coff_sym_value = NULL; coff_sym_addend = 0; } @@ -2529,7 +2526,7 @@ ecoff_directive_dim (int ignore ATTRIBUTE_UNUSED) int dimens[N_TQ]; int i; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".dim pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2577,7 +2574,7 @@ ecoff_directive_scl (int ignore ATTRIBUTE_UNUSED) { long val; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".scl pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2602,7 +2599,7 @@ ecoff_directive_size (int ignore ATTRIBUTE_UNUSED) int sizes[N_TQ]; int i; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".size pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2652,7 +2649,7 @@ ecoff_directive_type (int ignore ATTRIBUTE_UNUSED) tq_t *tq_ptr; tq_t *tq_shft; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".type pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2719,7 +2716,7 @@ ecoff_directive_tag (int ignore ATTRIBUTE_UNUSED) char *name; char name_end; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".tag pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2743,7 +2740,7 @@ ecoff_directive_val (int ignore ATTRIBUTE_UNUSED) { expressionS exp; - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".val pseudo-op used outside of .def/.endef; ignored")); demand_empty_rest_of_line (); @@ -2781,26 +2778,26 @@ ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); - if (coff_sym_name == (char *) NULL) + if (coff_sym_name == NULL) { as_warn (_(".endef pseudo-op used before .def; ignored")); return; } name = coff_sym_name; - coff_sym_name = (char *) NULL; + coff_sym_name = NULL; /* If the symbol is a static or external, we have already gotten the appropriate type and class, so make sure we don't override those values. This is needed because there are some type and classes that are not in COFF, such as short data, etc. */ - if (coff_sym_value != (symbolS *) NULL) + if (coff_sym_value != NULL) { coff_symbol_typ = st_Nil; coff_storage_class = sc_Nil; } - coff_type.extra_sizes = coff_tag != (char *) NULL; + coff_type.extra_sizes = coff_tag != NULL; if (coff_type.num_dims > 0) { int diff = coff_type.num_dims - coff_type.num_sizes; @@ -2856,14 +2853,13 @@ ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED) || coff_type.basic_type == bt_Union || coff_type.basic_type == bt_Enum) { - if (coff_tag == (char *) NULL) + if (coff_tag == NULL) { as_warn (_("no tag specified for %s"), name); return; } - coff_type.tag_ptr = get_tag (coff_tag, (localsym_t *) NULL, - coff_type.basic_type); + coff_type.tag_ptr = get_tag (coff_tag, NULL, coff_type.basic_type); } if (coff_is_function) @@ -2904,7 +2900,7 @@ ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED) that any error reporting above gives the correct name. */ case st_End: free (name); - name = (char *) NULL; + name = NULL; coff_value = 0; coff_inside_enumeration = 0; break; @@ -2936,11 +2932,11 @@ ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED) /* Remember any forward references. */ for (pf = &sym->forward_ref; - *pf != (forward_t *) NULL; + *pf != NULL; pf = &(*pf)->next) ; *pf = tag_ptr->forward_ref; - tag_ptr->forward_ref = (forward_t *) NULL; + tag_ptr->forward_ref = NULL; } } @@ -2953,14 +2949,14 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED) char name_end; symbolS *ent; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) { as_warn (_(".end directive without a preceding .file directive")); demand_empty_rest_of_line (); return; } - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".end directive without a preceding .ent directive")); demand_empty_rest_of_line (); @@ -2982,7 +2978,7 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED) current location, and put in the offset when we write out the symbol. */ ent = symbol_find (name); - if (ent == (symbolS *) NULL) + if (ent == NULL) as_warn (_(".end directive names unknown symbol")); else (void) add_ecoff_symbol (NULL, st_End, sc_Text, @@ -2994,7 +2990,7 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED) md_flush_pending_output (); #endif - cur_proc_ptr = (proc_t *) NULL; + cur_proc_ptr = NULL; (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); @@ -3008,10 +3004,10 @@ ecoff_directive_ent (int aent) char *name; char name_end; - if (cur_file_ptr == (efdr_t *) NULL) - add_file ((const char *) NULL, 0, 1); + if (cur_file_ptr == NULL) + add_file (NULL, 0, 1); - if (!aent && cur_proc_ptr != (proc_t *) NULL) + if (!aent && cur_proc_ptr != NULL) { as_warn (_("second .ent directive found before .end directive")); demand_empty_rest_of_line (); @@ -3081,7 +3077,7 @@ ecoff_directive_file (int ignore ATTRIBUTE_UNUSED) char *name; int len; - if (cur_proc_ptr != (proc_t *) NULL) + if (cur_proc_ptr != NULL) { as_warn (_("no way to handle .file within .ent/.end section")); demand_empty_rest_of_line (); @@ -3105,7 +3101,7 @@ ecoff_directive_fmask (int ignore ATTRIBUTE_UNUSED) { long val; - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".fmask outside of .ent")); demand_empty_rest_of_line (); @@ -3133,7 +3129,7 @@ ecoff_directive_frame (int ignore ATTRIBUTE_UNUSED) { long val; - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".frame outside of .ent")); demand_empty_rest_of_line (); @@ -3169,7 +3165,7 @@ ecoff_directive_mask (int ignore ATTRIBUTE_UNUSED) { long val; - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { as_warn (_(".mask outside of .ent")); demand_empty_rest_of_line (); @@ -3198,7 +3194,7 @@ ecoff_directive_loc (int ignore ATTRIBUTE_UNUSED) lineno_list_t *list; symint_t lineno; - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) { as_warn (_(".loc before .file")); demand_empty_rest_of_line (); @@ -3237,7 +3233,7 @@ ecoff_directive_loc (int ignore ATTRIBUTE_UNUSED) list = allocate_lineno_list (); - list->next = (lineno_list_t *) NULL; + list->next = NULL; list->file = cur_file_ptr; list->proc = cur_proc_ptr; list->frag = frag_now; @@ -3250,12 +3246,12 @@ ecoff_directive_loc (int ignore ATTRIBUTE_UNUSED) /* A .loc directive will sometimes appear before a .ent directive, which means that cur_proc_ptr will be NULL here. Arrange to patch this up. */ - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { lineno_list_t **pl; pl = &noproc_lineno; - while (*pl != (lineno_list_t *) NULL) + while (*pl != NULL) pl = &(*pl)->next; *pl = list; } @@ -3411,9 +3407,9 @@ ecoff_stab (int what, as_warn (_(".stab%c: ignoring non-zero other field"), what); /* Make sure we have a current file. */ - if (cur_file_ptr == (efdr_t *) NULL) + if (cur_file_ptr == NULL) { - add_file ((const char *) NULL, 0, 1); + add_file (NULL, 0, 1); save_file_ptr = cur_file_ptr; } @@ -3470,7 +3466,7 @@ ecoff_stab (int what, { st = st_Nil; sc = sc_Nil; - sym = (symbolS *) NULL; + sym = NULL; value = get_absolute_expression (); addend = 0; } @@ -3513,12 +3509,12 @@ ecoff_stab (int what, /* Don't store the stabs symbol we are creating as the type of the ECOFF symbol. We want to compute the type of the ECOFF symbol independently. */ - if (sym != (symbolS *) NULL) + if (sym != NULL) hold = symbol_get_obj (sym)->ecoff_symbol; (void) add_ecoff_symbol (string, st, sc, sym, addend, value, indx); - if (sym != (symbolS *) NULL) + if (sym != NULL) symbol_get_obj (sym)->ecoff_symbol = hold; /* Restore normal file type. */ @@ -3590,7 +3586,7 @@ ecoff_padding_adjust (const struct ecoff_debug_swap *backend, (void) ecoff_add_bytes (buf, bufend, *buf + offset, add); memset (*buf + offset, 0, add); offset += add; - if (bufptrptr != (char **) NULL) + if (bufptrptr != NULL) *bufptrptr = *buf + offset; } @@ -3617,14 +3613,14 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, lineno_list_t first; lineno_list_t *local_first_lineno = first_lineno; - if (linecntptr != (long *) NULL) + if (linecntptr != NULL) *linecntptr = 0; bufptr = *buf + offset; - file = (efdr_t *) NULL; - proc = (proc_t *) NULL; - last = (lineno_list_t *) NULL; + file = NULL; + proc = NULL; + last = NULL; c = offset; iline = 0; totcount = 0; @@ -3642,8 +3638,8 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, Don't do this for ECOFF assembly source line numbers. They work without this extra attention. */ if (debug_type != DEBUG_ECOFF - && first_proc_ptr != (proc_t *) NULL - && local_first_lineno != (lineno_list_t *) NULL + && first_proc_ptr != NULL + && local_first_lineno != NULL && ((S_GET_VALUE (first_proc_ptr->sym->as_sym) + bfd_section_vma (S_GET_SEGMENT (first_proc_ptr->sym->as_sym))) != 0)) @@ -3658,7 +3654,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, local_first_lineno = &first; } - for (l = local_first_lineno; l != (lineno_list_t *) NULL; l = l->next) + for (l = local_first_lineno; l != NULL; l = l->next) { long count; long delta; @@ -3666,7 +3662,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, /* Get the offset to the memory address of the next line number (in words). Do this first, so that we can skip ahead to the next useful line number entry. */ - if (l->next == (lineno_list_t *) NULL) + if (l->next == NULL) { /* We want a count of zero, but it will be decremented before it is used. */ @@ -3687,13 +3683,13 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, if (l->file != file || l->proc != proc) { - if (l->proc != proc && proc != (proc_t *) NULL) + if (l->proc != proc && proc != NULL) proc->pdr.lnHigh = last->lineno; - if (l->file != file && file != (efdr_t *) NULL) + if (l->file != file && file != NULL) { file->fdr.cbLine = c - file->fdr.cbLineOffset; file->fdr.cline = totcount + count; - if (linecntptr != (long *) NULL) + if (linecntptr != NULL) *linecntptr += totcount + count; totcount = 0; } @@ -3703,7 +3699,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, efdr_t *last_file = file; file = l->file; - if (last_file != (efdr_t *) NULL) + if (last_file != NULL) file->fdr.ilineBase = last_file->fdr.ilineBase + last_file->fdr.cline; else @@ -3713,7 +3709,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, if (l->proc != proc) { proc = l->proc; - if (proc != (proc_t *) NULL) + if (proc != NULL) { proc->pdr.lnLow = l->lineno; proc->pdr.cbLineOffset = c - file->fdr.cbLineOffset; @@ -3721,13 +3717,13 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, } } - last = (lineno_list_t *) NULL; + last = NULL; } totcount += count; /* Get the offset to this line number. */ - if (last == (lineno_list_t *) NULL) + if (last == NULL) delta = 0; else delta = l->lineno - last->lineno; @@ -3811,15 +3807,15 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, last = l; } - if (proc != (proc_t *) NULL) + if (proc != NULL) proc->pdr.lnHigh = last->lineno; - if (file != (efdr_t *) NULL) + if (file != NULL) { file->fdr.cbLine = c - file->fdr.cbLineOffset; file->fdr.cline = totcount; } - if (linecntptr != (long *) NULL) + if (linecntptr != NULL) *linecntptr += totcount; c = ecoff_padding_adjust (backend, buf, bufend, c, &bufptr); @@ -3848,7 +3844,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, /* The symbols are stored by file. */ for (file_link = file_desc.first; - file_link != (vlinks_t *) NULL; + file_link != NULL; file_link = file_link->next) { int ifilesym; @@ -3856,7 +3852,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, efdr_t *fil_ptr; efdr_t *fil_end; - if (file_link->next == (vlinks_t *) NULL) + if (file_link->next == NULL) fil_cnt = file_desc.objects_last_page; else fil_cnt = file_desc.objects_per_page; @@ -3869,14 +3865,14 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, fil_ptr->fdr.isymBase = isym; ifilesym = isym; for (sym_link = fil_ptr->symbols.first; - sym_link != (vlinks_t *) NULL; + sym_link != NULL; sym_link = sym_link->next) { int sym_cnt; localsym_t *sym_ptr; localsym_t *sym_end; - if (sym_link->next == (vlinks_t *) NULL) + if (sym_link->next == NULL) sym_cnt = fil_ptr->symbols.objects_last_page; else sym_cnt = fil_ptr->symbols.objects_per_page; @@ -3899,7 +3895,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, information for the external). */ local = 1; as_sym = sym_ptr->as_sym; - if (as_sym != (symbolS *) NULL) + if (as_sym != NULL) { symint_t indx; @@ -3914,7 +3910,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, { symbolS *begin_sym; - know (sym_ptr->proc_ptr != (proc_t *) NULL); + know (sym_ptr->proc_ptr != NULL); begin_sym = sym_ptr->proc_ptr->sym->as_sym; if (S_GET_SEGMENT (as_sym) != S_GET_SEGMENT (begin_sym)) @@ -4034,7 +4030,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, if ((S_IS_EXTERNAL (as_sym) || S_IS_WEAK (as_sym) || ! S_IS_DEFINED (as_sym)) - && sym_ptr->proc_ptr == (proc_t *) NULL + && sym_ptr->proc_ptr == NULL && sym_ptr->ecoff_sym.asym.st != st_Nil && ! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym)) local = 0; @@ -4055,13 +4051,13 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, add_string (&fil_ptr->strings, fil_ptr->str_hash, sym_ptr->name, - (shash_t **) NULL); + NULL); } /* We now know the index of this symbol; fill in locations that have been waiting for that information. */ - if (sym_ptr->begin_ptr != (localsym_t *) NULL) + if (sym_ptr->begin_ptr != NULL) { localsym_t *begin_ptr; st_t begin_type; @@ -4089,7 +4085,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, } else { - know (begin_ptr->index_ptr != (aux_t *) NULL); + know (begin_ptr->index_ptr != NULL); begin_ptr->index_ptr->data.isym = isym - ifilesym + 1; } @@ -4102,8 +4098,8 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, if (begin_type == st_Proc || begin_type == st_StaticProc) { - know (as_sym != (symbolS *) NULL); - know (begin_ptr->as_sym != (symbolS *) NULL); + know (as_sym != NULL); + know (begin_ptr->as_sym != NULL); if (S_GET_SEGMENT (as_sym) != S_GET_SEGMENT (begin_ptr->as_sym)) as_warn (_(".begin/.bend in different segments")); @@ -4126,8 +4122,8 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, { symbolS *begin_sym; - know (as_sym != (symbolS *) NULL); - know (sym_ptr->proc_ptr != (proc_t *) NULL); + know (as_sym != NULL); + know (sym_ptr->proc_ptr != NULL); begin_sym = sym_ptr->proc_ptr->sym->as_sym; if (S_GET_SEGMENT (as_sym) != S_GET_SEGMENT (begin_sym)) @@ -4138,7 +4134,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, } for (f = sym_ptr->forward_ref; - f != (forward_t *) NULL; + f != NULL; f = f->next) { know (local); @@ -4158,7 +4154,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, sym_ptr->sym_index = isym; - if (sym_ptr->proc_ptr != (proc_t *) NULL + if (sym_ptr->proc_ptr != NULL && sym_ptr->proc_ptr->sym == sym_ptr) sym_ptr->proc_ptr->pdr.isym = isym - ifilesym; @@ -4168,7 +4164,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, /* Record the local symbol index and file number in case this is an external symbol. Note that this destroys the asym.index field. */ - if (as_sym != (symbolS *) NULL + if (as_sym != NULL && symbol_get_obj (as_sym)->ecoff_symbol == sym_ptr) { if ((sym_ptr->ecoff_sym.asym.st == st_Proc @@ -4212,14 +4208,14 @@ ecoff_build_procs (const struct ecoff_debug_swap *backend, /* The procedures are stored by file. */ for (file_link = file_desc.first; - file_link != (vlinks_t *) NULL; + file_link != NULL; file_link = file_link->next) { int fil_cnt; efdr_t *fil_ptr; efdr_t *fil_end; - if (file_link->next == (vlinks_t *) NULL) + if (file_link->next == NULL) fil_cnt = file_desc.objects_last_page; else fil_cnt = file_desc.objects_per_page; @@ -4233,14 +4229,14 @@ ecoff_build_procs (const struct ecoff_debug_swap *backend, fil_ptr->fdr.ipdFirst = iproc; first = 1; for (proc_link = fil_ptr->procs.first; - proc_link != (vlinks_t *) NULL; + proc_link != NULL; proc_link = proc_link->next) { int prc_cnt; proc_t *proc_ptr; proc_t *proc_end; - if (proc_link->next == (vlinks_t *) NULL) + if (proc_link->next == NULL) prc_cnt = fil_ptr->procs.objects_last_page; else prc_cnt = fil_ptr->procs.objects_per_page; @@ -4301,14 +4297,14 @@ ecoff_build_aux (const struct ecoff_debug_swap *backend, /* The aux entries are stored by file. */ for (file_link = file_desc.first; - file_link != (vlinks_t *) NULL; + file_link != NULL; file_link = file_link->next) { int fil_cnt; efdr_t *fil_ptr; efdr_t *fil_end; - if (file_link->next == (vlinks_t *) NULL) + if (file_link->next == NULL) fil_cnt = file_desc.objects_last_page; else fil_cnt = file_desc.objects_per_page; @@ -4321,14 +4317,14 @@ ecoff_build_aux (const struct ecoff_debug_swap *backend, fil_ptr->fdr.fBigendian = bigendian; fil_ptr->fdr.iauxBase = iaux; for (aux_link = fil_ptr->aux_syms.first; - aux_link != (vlinks_t *) NULL; + aux_link != NULL; aux_link = aux_link->next) { int aux_cnt; aux_t *aux_ptr; aux_t *aux_end; - if (aux_link->next == (vlinks_t *) NULL) + if (aux_link->next == NULL) aux_cnt = fil_ptr->aux_syms.objects_last_page; else aux_cnt = fil_ptr->aux_syms.objects_per_page; @@ -4390,7 +4386,7 @@ ecoff_build_aux (const struct ecoff_debug_swap *backend, return ecoff_padding_adjust (backend, buf, bufend, offset + iaux * sizeof (union aux_ext), - (char **) NULL); + NULL); } /* Copy out the strings from a varray_t. This returns the number of @@ -4411,12 +4407,12 @@ ecoff_build_strings (char **buf, istr = 0; for (str_link = vp->first; - str_link != (vlinks_t *) NULL; + str_link != NULL; str_link = str_link->next) { unsigned long str_cnt; - if (str_link->next == (vlinks_t *) NULL) + if (str_link->next == NULL) str_cnt = vp->objects_last_page; else str_cnt = vp->objects_per_page; @@ -4446,14 +4442,14 @@ ecoff_build_ss (const struct ecoff_debug_swap *backend, iss = 0; for (file_link = file_desc.first; - file_link != (vlinks_t *) NULL; + file_link != NULL; file_link = file_link->next) { int fil_cnt; efdr_t *fil_ptr; efdr_t *fil_end; - if (file_link->next == (vlinks_t *) NULL) + if (file_link->next == NULL) fil_cnt = file_desc.objects_last_page; else fil_cnt = file_desc.objects_per_page; @@ -4471,8 +4467,7 @@ ecoff_build_ss (const struct ecoff_debug_swap *backend, } } - return ecoff_padding_adjust (backend, buf, bufend, offset + iss, - (char **) NULL); + return ecoff_padding_adjust (backend, buf, bufend, offset + iss, NULL); } /* Swap out the file descriptors. */ @@ -4495,14 +4490,14 @@ ecoff_build_fdr (const struct ecoff_debug_swap *backend, fdr_out = *buf + offset; for (file_link = file_desc.first; - file_link != (vlinks_t *) NULL; + file_link != NULL; file_link = file_link->next) { int fil_cnt; efdr_t *fil_ptr; efdr_t *fil_end; - if (file_link->next == (vlinks_t *) NULL) + if (file_link->next == NULL) fil_cnt = file_desc.objects_last_page; else fil_cnt = file_desc.objects_per_page; @@ -4531,7 +4526,7 @@ ecoff_setup_ext (void) { symbolS *sym; - for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym)) + for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) { if (symbol_get_obj (sym)->ecoff_symbol == NULL) continue; @@ -4574,15 +4569,15 @@ ecoff_build_debug (HDRR *hdr, unsigned long offset; /* Make sure we have a file. */ - if (first_file == (efdr_t *) NULL) - add_file ((const char *) NULL, 0, 1); + if (first_file == NULL) + add_file (NULL, 0, 1); /* Handle any top level tags. */ for (ptag = top_tag_head->first_tag; - ptag != (tag_t *) NULL; + ptag != NULL; ptag = ptag_next) { - if (ptag->forward_ref != (forward_t *) NULL) + if (ptag->forward_ref != NULL) add_unknown_tag (ptag); ptag_next = ptag->same_block; @@ -4596,11 +4591,11 @@ ecoff_build_debug (HDRR *hdr, symbol that has not already received it. */ hold_file_ptr = cur_file_ptr; hold_proc_ptr = cur_proc_ptr; - cur_proc_ptr = (proc_t *) NULL; - for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym)) + cur_proc_ptr = NULL; + for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) { if (symbol_get_obj (sym)->ecoff_symbol != NULL - || symbol_get_obj (sym)->ecoff_file == (efdr_t *) NULL + || symbol_get_obj (sym)->ecoff_file == NULL || (symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) != 0) continue; @@ -4616,12 +4611,12 @@ ecoff_build_debug (HDRR *hdr, files. */ end_warning = 0; for (fil_ptr = first_file; - fil_ptr != (efdr_t *) NULL; + fil_ptr != NULL; fil_ptr = fil_ptr->next_file) { cur_file_ptr = fil_ptr; - while (cur_file_ptr->cur_scope != (scope_t *) NULL - && cur_file_ptr->cur_scope->prev != (scope_t *) NULL) + while (cur_file_ptr->cur_scope != NULL + && cur_file_ptr->cur_scope->prev != NULL) { cur_file_ptr->cur_scope = cur_file_ptr->cur_scope->prev; if (! end_warning && ! cur_file_ptr->fake) @@ -4630,7 +4625,7 @@ ecoff_build_debug (HDRR *hdr, end_warning = 1; } } - if (cur_file_ptr->cur_scope != (scope_t *) NULL) + if (cur_file_ptr->cur_scope != NULL) (void) add_ecoff_symbol (NULL, st_End, sc_Text, NULL, 0, 0, 0); } @@ -4774,7 +4769,7 @@ allocate_scope (void) #ifndef MALLOC_CHECK ptr = alloc_counts[alloc_type_scope].free_list.f_scope; - if (ptr != (scope_t *) NULL) + if (ptr != NULL) alloc_counts[alloc_type_scope].free_list.f_scope = ptr->free; else { @@ -4927,7 +4922,7 @@ allocate_tag (void) #ifndef MALLOC_CHECK ptr = alloc_counts[alloc_type_tag].free_list.f_tag; - if (ptr != (tag_t *) NULL) + if (ptr != NULL) alloc_counts[alloc_type_tag].free_list.f_tag = ptr->free; else { @@ -4967,7 +4962,7 @@ free_tag (tag_t *ptr) ptr->free = alloc_counts[alloc_type_tag].free_list.f_tag; alloc_counts[alloc_type_tag].free_list.f_tag = ptr; #else - free ((PTR_T) ptr); + free (ptr); #endif } @@ -5051,10 +5046,10 @@ free_thead (thead_t *ptr) alloc_counts[alloc_type_thead].total_free++; #ifndef MALLOC_CHECK - ptr->free = (thead_t *) alloc_counts[alloc_type_thead].free_list.f_thead; + ptr->free = alloc_counts[alloc_type_thead].free_list.f_thead; alloc_counts[alloc_type_thead].free_list.f_thead = ptr; #else - free ((PTR_T) ptr); + free (ptr); #endif } @@ -5108,7 +5103,7 @@ ecoff_set_gp_prolog_size (int sz) int ecoff_no_current_file (void) { - return cur_file_ptr == (efdr_t *) NULL; + return cur_file_ptr == NULL; } void @@ -5120,13 +5115,13 @@ ecoff_generate_asm_lineno (void) filename = as_where (&lineno); - if (current_stabs_filename == (char *) NULL + if (current_stabs_filename == NULL || filename_cmp (current_stabs_filename, filename)) add_file (filename, 0, 1); list = allocate_lineno_list (); - list->next = (lineno_list_t *) NULL; + list->next = NULL; list->file = cur_file_ptr; list->proc = cur_proc_ptr; list->frag = frag_now; @@ -5139,12 +5134,12 @@ ecoff_generate_asm_lineno (void) /* A .loc directive will sometimes appear before a .ent directive, which means that cur_proc_ptr will be NULL here. Arrange to patch this up. */ - if (cur_proc_ptr == (proc_t *) NULL) + if (cur_proc_ptr == NULL) { lineno_list_t **pl; pl = &noproc_lineno; - while (*pl != (lineno_list_t *) NULL) + while (*pl != NULL) pl = &(*pl)->next; *pl = list; } diff --git a/gas/expr.c b/gas/expr.c index c16e96b535a..06283c29b9c 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -132,7 +132,7 @@ static unsigned int nr_seen[2]; static symbolS * symbol_lookup_or_make (const char *name, bool start) { - char *buf = concat (start ? ".startof." : ".sizeof.", name, NULL); + char *buf = concat (start ? ".startof." : ".sizeof.", name, (char *) NULL); symbolS *symbolP; unsigned int i; diff --git a/gas/input-file.c b/gas/input-file.c index c64ea4d7ebc..f3af77c6835 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -58,7 +58,7 @@ struct saved_file void input_file_begin (void) { - f_in = (FILE *) 0; + f_in = NULL; } void @@ -237,7 +237,7 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new char *return_value; /* -> Last char of what we read, + 1. */ size_t size; - if (f_in == (FILE *) 0) + if (f_in == NULL) return 0; /* fflush (stdin); could be done here if you want to synchronise stdin and stdout, for the case where our input file is stdin. @@ -266,7 +266,7 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new if (fclose (f_in)) as_warn (_("can't close %s: %s"), file_name, xstrerror (errno)); - f_in = (FILE *) 0; + f_in = NULL; return_value = 0; } diff --git a/gas/listing.c b/gas/listing.c index d6111793090..dbf4782b8d4 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -223,7 +223,7 @@ static char *data_buffer; static void listing_message (const char *name, const char *message) { - if (listing_tail != (list_info_type *) NULL) + if (listing_tail != NULL) { char *n = concat (name, message, (char *) NULL); struct list_message *lm = XNEW (struct list_message); @@ -256,7 +256,7 @@ file_info (const char *file_name) /* Find an entry with this file name. */ file_info_type *p = file_info_head; - while (p != (file_info_type *) NULL) + while (p != NULL) { if (filename_cmp (p->filename, file_name) == 0) return p; @@ -406,11 +406,11 @@ listing_newline (char *ps) new_i->frag = frag_now; new_i->line = line; new_i->file = file_info (file); - new_i->next = (list_info_type *) NULL; + new_i->next = NULL; new_i->messages = NULL; new_i->last_message = NULL; new_i->edict = EDICT_NONE; - new_i->hll_file = (file_info_type *) NULL; + new_i->hll_file = NULL; new_i->hll_line = 0; new_frag (); @@ -488,7 +488,7 @@ listing_prev_line (void) list_info_type *l; fragS *f; - if (head == (list_info_type *) NULL + if (head == NULL || head == listing_tail) return; @@ -497,7 +497,7 @@ listing_prev_line (void) for (l = head; l->next != listing_tail; l = l->next) ; - for (f = frchain_now->frch_root; f != (fragS *) NULL; f = f->fr_next) + for (f = frchain_now->frch_root; f != NULL; f = f->fr_next) if (f->line == listing_tail) f->line = l; @@ -810,7 +810,7 @@ calc_hex (list_info_type *list) data_buffer_size = 0; /* Dump all the frags which belong to this line. */ - while (frag_ptr != (fragS *) NULL && frag_ptr->line == first) + while (frag_ptr != NULL && frag_ptr->line == first) { /* Print as many bytes from the fixed part as is sensible. */ octet_in_frag = 0; @@ -1013,7 +1013,7 @@ list_symbol_table (void) got_some = 0; - for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) + for (ptr = symbol_rootP; ptr != NULL; ptr = symbol_next (ptr)) { if (S_GET_NAME (ptr) && strlen (S_GET_NAME (ptr)) != 0) { diff --git a/gas/messages.c b/gas/messages.c index d11489265be..859ac17f379 100644 --- a/gas/messages.c +++ b/gas/messages.c @@ -221,7 +221,7 @@ as_warn (const char *format, ...) va_start (args, format); vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); - as_warn_internal ((char *) NULL, 0, buffer); + as_warn_internal (NULL, 0, buffer); } } @@ -294,7 +294,7 @@ as_bad (const char *format, ...) vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); - as_bad_internal ((char *) NULL, 0, buffer); + as_bad_internal (NULL, 0, buffer); } /* Like as_bad but the file name and line number are passed in. diff --git a/gas/read.c b/gas/read.c index fefbc3aee05..874802e4d67 100644 --- a/gas/read.c +++ b/gas/read.c @@ -1235,7 +1235,7 @@ read_a_source_file (const char *name) || pop->poc_handler == s_globl || pop->poc_handler == s_ignore))) { - do_align (1, (char *) NULL, 0, 0); + do_align (1, NULL, 0, 0); mri_pending_align = 0; if (line_label != NULL) @@ -1296,7 +1296,7 @@ read_a_source_file (const char *name) if (mri_pending_align) { - do_align (1, (char *) NULL, 0, 0); + do_align (1, NULL, 0, 0); mri_pending_align = 0; if (line_label != NULL) { @@ -1623,7 +1623,7 @@ s_align (signed int arg, int bytes_p) { if (arg < 0) as_warn (_("expected fill pattern missing")); - do_align (align, (char *) NULL, 0, max); + do_align (align, NULL, 0, max); } else { @@ -3482,7 +3482,7 @@ s_space (int mult) } else { - do_align (1, (char *) NULL, 0, 0); + do_align (1, NULL, 0, 0); if (line_label != NULL) { symbol_set_frag (line_label, frag_now); diff --git a/gas/remap.c b/gas/remap.c index ecf77a1fe9b..842c93077a3 100644 --- a/gas/remap.c +++ b/gas/remap.c @@ -78,7 +78,7 @@ remap_debug_filename (const char *filename) if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) { const char *name = filename + map->old_len; - return concat (map->new_prefix, name, NULL); + return concat (map->new_prefix, name, (const char *) NULL); } return xstrdup (filename); diff --git a/gas/write.c b/gas/write.c index 4d95d769d45..93ec6147440 100644 --- a/gas/write.c +++ b/gas/write.c @@ -222,7 +222,7 @@ fix_new (fragS *frag, /* Which frag? */ RELOC_ENUM r_type /* Relocation type. */) { return fix_new_internal (frag, where, size, add_symbol, - (symbolS *) NULL, offset, pcrel, r_type, false); + NULL, offset, pcrel, r_type, false); } /* Create a fixup for an expression. Currently we only support fixups @@ -290,7 +290,7 @@ fix_at_start (fragS *frag, unsigned long size, symbolS *add_symbol, offsetT offset, int pcrel, RELOC_ENUM r_type) { return fix_new_internal (frag, 0, size, add_symbol, - (symbolS *) NULL, offset, pcrel, r_type, true); + NULL, offset, pcrel, r_type, true); } /* Generic function to determine whether a fixup requires a relocation. */ @@ -369,9 +369,9 @@ chain_frchains_together_1 (segT section, struct frchain *frchp) prev_frag->fr_next = frchp->frch_root; prev_frag = frchp->frch_last; gas_assert (prev_frag->fr_type != 0); - if (frchp->fix_root != (fixS *) NULL) + if (frchp->fix_root != NULL) { - if (seg_info (section)->fix_root == (fixS *) NULL) + if (seg_info (section)->fix_root == NULL) seg_info (section)->fix_root = frchp->fix_root; prev_fix->fx_next = frchp->fix_root; seg_info (section)->fix_tail = frchp->fix_tail; @@ -395,7 +395,7 @@ chain_frchains_together (bfd *abfd ATTRIBUTE_UNUSED, /* BFD may have introduced its own sections without using subseg_new, so it is possible that seg_info is NULL. */ info = seg_info (section); - if (info != (segment_info_type *) NULL) + if (info != NULL) info->frchainP->frch_last = chain_frchains_together_1 (section, info->frchainP); @@ -1293,7 +1293,7 @@ write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, n = 0; r = my_reloc_list; last_frag = NULL; - for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next) + for (fixp = seginfo->fix_root; fixp != NULL; fixp = fixp->fx_next) { int fx_size, slack; valueT loc; @@ -2145,7 +2145,7 @@ write_object_file (void) bfd_map_over_sections (stdoutput, renumber_sections, &i); } - bfd_map_over_sections (stdoutput, chain_frchains_together, (char *) 0); + bfd_map_over_sections (stdoutput, chain_frchains_together, NULL); /* We have two segments. If user gave -R flag, then we must put the data frags into the text segment. Do this before relaxing so @@ -2167,12 +2167,12 @@ write_object_file (void) struct broken_word *brokp; for (brokp = broken_words; - brokp != (struct broken_word *) NULL; + brokp != NULL; brokp = brokp->next_broken_word) { brokp->added = 0; - if (brokp->dispfrag != (fragS *) NULL + if (brokp->dispfrag != NULL && brokp->dispfrag->fr_type == rs_broken_word) brokp->dispfrag->fr_subtype = 0; } @@ -2194,7 +2194,7 @@ write_object_file (void) TC_FINALIZE_SYMS_BEFORE_SIZE_SEG to 0. */ finalize_syms = TC_FINALIZE_SYMS_BEFORE_SIZE_SEG; - bfd_map_over_sections (stdoutput, size_seg, (char *) 0); + bfd_map_over_sections (stdoutput, size_seg, NULL); /* Relaxation has completed. Freeze all syms. */ finalize_syms = 1; @@ -2335,7 +2335,7 @@ write_object_file (void) obj_frob_file_before_adjust (); #endif - bfd_map_over_sections (stdoutput, adjust_reloc_syms, (char *) 0); + bfd_map_over_sections (stdoutput, adjust_reloc_syms, NULL); #ifdef tc_frob_file_before_fix tc_frob_file_before_fix (); @@ -2344,7 +2344,7 @@ write_object_file (void) obj_frob_file_before_fix (); #endif - bfd_map_over_sections (stdoutput, fix_segment, (char *) 0); + bfd_map_over_sections (stdoutput, fix_segment, NULL); /* Set up symbol table, and write it out. */ if (symbol_rootP) @@ -2501,7 +2501,7 @@ write_object_file (void) obj_coff_generate_pdata (); #endif - bfd_map_over_sections (stdoutput, write_relocs, (char *) 0); + bfd_map_over_sections (stdoutput, write_relocs, NULL); reloc_list = NULL; #ifdef tc_frob_file_after_relocs @@ -2529,10 +2529,10 @@ write_object_file (void) flags = BFD_COMPRESS | BFD_COMPRESS_GABI | BFD_COMPRESS_ZSTD; stdoutput->flags |= flags & bfd_applicable_file_flags (stdoutput); if ((stdoutput->flags & BFD_COMPRESS) != 0) - bfd_map_over_sections (stdoutput, compress_debug, (char *) 0); + bfd_map_over_sections (stdoutput, compress_debug, NULL); } - bfd_map_over_sections (stdoutput, write_contents, (char *) 0); + bfd_map_over_sections (stdoutput, write_contents, NULL); } #ifdef TC_GENERIC_RELAX_TABLE