From: Alan Modra Date: Sun, 10 Oct 2004 13:58:05 +0000 (+0000) Subject: * libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f12123c0d5ef931a2617b4b3bdb877556133c206;p=binutils-gdb.git * libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while. * libbfd.h: Regnerate. * elf32-cris.c: Add missing semicolon to BFD_ASSERTs. * elf32-frv.c: Likewise. * elf32-m32r.c: Likewise. * elf32-ppc.c: Likewise. * elf64-hppa.c: Likewise. * elfxx-ia64.c: Likewise. * opncls.c: Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 634591d57d7..dcf9aeba6db 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2004-10-10 Alan Modra + + * libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while. + * libbfd.h: Regnerate. + * elf32-cris.c: Add missing semicolon to BFD_ASSERTs. + * elf32-frv.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-ppc.c: Likewise. + * elf64-hppa.c: Likewise. + * elfxx-ia64.c: Likewise. + * opncls.c: Likewise. + 2004-10-10 Alan Modra * elf-bfd.h (struct eh_frame_hdr_info): Add offsets_adjusted. diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 2e8a6b3874d..f0c88dcc6df 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -2960,7 +2960,7 @@ cris_elf_print_private_bfd_data (abfd, ptr) { FILE *file = (FILE *) ptr; - BFD_ASSERT (abfd != NULL && ptr != NULL) + BFD_ASSERT (abfd != NULL && ptr != NULL); _bfd_elf_print_private_bfd_data (abfd, ptr); diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index d95fa800c87..53deac7d09c 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -832,7 +832,7 @@ frvfdpic_relocs_info_for_global (struct htab *ht, /* Obtain the address of the entry in HT associated with the SYMNDXth local symbol of the input bfd ABFD, plus the addend, creating a new - entry if none existed. */ + entry if none existed. */ inline static struct frvfdpic_relocs_info * frvfdpic_relocs_info_for_local (struct htab *ht, bfd *abfd, @@ -1021,7 +1021,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, asection *sec, Elf_Internal_Sym *sym, bfd_vma addend) - + { bfd_vma fd_lazy_rel_offset = (bfd_vma)-1; int dynindx = -1; @@ -1099,7 +1099,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, ->output_section->vma + frvfdpic_got_section (info)->output_offset, R_FRV_32, idx, ad, entry); - + bfd_put_32 (output_bfd, ad, frvfdpic_got_section (info)->contents + frvfdpic_got_initial_offset (info) @@ -1112,7 +1112,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, { int reloc, idx; bfd_vma ad = 0; - + if (! (entry->symndx == -1 && entry->d.h->root.type == bfd_link_hash_undefweak && FRVFDPIC_SYM_LOCAL (info, entry->d.h))) @@ -1285,7 +1285,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, { if (ad) return FALSE; - + fd_lazy_rel_offset = ofst; /* A function descriptor used for lazy or local resolving is @@ -1297,7 +1297,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, lowword = entry->lzplt_entry + 4 + frvfdpic_plt_section (info)->output_offset + frvfdpic_plt_section (info)->output_section->vma; - highword = _frvfdpic_osec_to_segment + highword = _frvfdpic_osec_to_segment (output_bfd, frvfdpic_plt_section (info)->output_section); } else @@ -2095,14 +2095,14 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, relocation = picrel->got_entry; check_segment[0] = check_segment[1] = got_segment; break; - + case R_FRV_FUNCDESC_GOT12: case R_FRV_FUNCDESC_GOTHI: case R_FRV_FUNCDESC_GOTLO: relocation = picrel->fdgot_entry; check_segment[0] = check_segment[1] = got_segment; break; - + case R_FRV_GOTOFFHI: case R_FRV_GOTOFF12: case R_FRV_GOTOFFLO: @@ -2479,7 +2479,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, if (! IS_FDPIC (output_bfd) || ! picrel->plt) break; /* Fall through. */ - + /* When referencing a GOT entry, a function descriptor or a PLT, we don't want the addend to apply to the reference, but rather to the referenced symbol. The actual entry @@ -2497,7 +2497,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, /* Note that we only want GOTOFFHI, not GOTOFFLO or GOTOFF12 here, since we do want to apply the addend to the others. Note that we've applied the addend to GOTOFFHI before we - shifted it right. */ + shifted it right. */ case R_FRV_GOTOFFHI: relocation -= rel->r_addend; break; @@ -3147,7 +3147,7 @@ _frvfdpic_compute_got_alloc_data (struct _frvfdpic_dynamic_got_alloc_data *gad, odd = cur + got; got += 4; } - + /* Compute the tentative boundaries of this range. */ gad->max = cur + got; gad->min = fdcur - fd; @@ -3222,7 +3222,7 @@ inline static bfd_signed_vma _frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) { bfd_signed_vma ret; - + if (gad->odd) { /* If there was an odd word left behind, use it. */ @@ -3301,7 +3301,7 @@ _frvfdpic_assign_got_entries (void **entryp, void *info_) } else if (entry->privfd) entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); - + return 1; } @@ -3331,7 +3331,7 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_) } else { - BFD_ASSERT (dinfo->gothilo.fdplt) + BFD_ASSERT (dinfo->gothilo.fdplt); entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); dinfo->gothilo.fdplt -= 8; } @@ -3370,9 +3370,9 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_) == FRVFDPIC_LZPLT_RESOLV_LOC) dinfo->g.lzplt += 4; } - + return 1; -} +} /* Follow indirect and warning hash entries so that each got entry points to the final symbol definition. P must point to a pointer @@ -3540,7 +3540,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, if (frvfdpic_got_section (info)->contents == NULL) return FALSE; } - + if (elf_hash_table (info)->dynamic_sections_created) /* Subtract the number of lzplt entries, since those will generate relocations in the pltrel section. */ @@ -3571,7 +3571,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, if (frvfdpic_gotfixup_section (info)->contents == NULL) return FALSE; } - + if (elf_hash_table (info)->dynamic_sections_created) { frvfdpic_pltrel_section (info)->size = @@ -3587,7 +3587,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, return FALSE; } } - + /* Add 4 bytes for every block of at most 65535 lazy PLT entries, such that there's room for the additional instruction needed to call the resolver. Since _frvfdpic_assign_got_entries didn't @@ -4145,14 +4145,14 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) picrel = NULL; break; } - + switch (ELF32_R_TYPE (rel->r_info)) { case R_FRV_LABEL24: if (IS_FDPIC (abfd)) picrel->call = 1; break; - + case R_FRV_FUNCDESC_VALUE: picrel->relocsfdv++; if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) @@ -4167,11 +4167,11 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) picrel->relocs32++; break; - + case R_FRV_GOT12: picrel->got12 = 1; break; - + case R_FRV_GOTHI: case R_FRV_GOTLO: picrel->gothilo = 1; @@ -4180,32 +4180,32 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) case R_FRV_FUNCDESC_GOT12: picrel->fdgot12 = 1; break; - + case R_FRV_FUNCDESC_GOTHI: case R_FRV_FUNCDESC_GOTLO: picrel->fdgothilo = 1; break; - + case R_FRV_GOTOFF12: case R_FRV_GOTOFFHI: case R_FRV_GOTOFFLO: picrel->gotoff = 1; break; - + case R_FRV_FUNCDESC_GOTOFF12: picrel->fdgoff12 = 1; break; - + case R_FRV_FUNCDESC_GOTOFFHI: case R_FRV_FUNCDESC_GOTOFFLO: picrel->fdgoffhilo = 1; break; - + case R_FRV_FUNCDESC: picrel->fd = 1; picrel->relocsfd++; break; - + /* This relocation describes the C++ object vtable hierarchy. Reconstruct it for later use during GC. */ case R_FRV_GNU_VTINHERIT: @@ -4723,7 +4723,7 @@ frv_elf_print_private_bfd_data (abfd, ptr) if (flags & EF_FRV_FDPIC) fprintf (file, " -mfdpic"); - + if (flags & EF_FRV_NON_PIC_RELOCS) fprintf (file, " non-pic relocations"); diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index ec967e2118f..fd259cd201b 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1350,7 +1350,7 @@ m32r_info_to_howto_rel (abfd, cache_ptr, dst) unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY) + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY); cache_ptr->howto = &m32r_elf_howto_table[r_type]; } @@ -2828,7 +2828,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_M32R_GOTOFF: /* Relocation is relative to the start of the global offset table (for ld24 rx, #uimm24). eg access at label+addend - + ld24 rx. #label@GOTOFF + addend sub rx, r12. */ @@ -4271,7 +4271,7 @@ m32r_elf_print_private_bfd_data (abfd, ptr) { FILE * file = (FILE *) ptr; - BFD_ASSERT (abfd != NULL && ptr != NULL) + BFD_ASSERT (abfd != NULL && ptr != NULL); _bfd_elf_print_private_bfd_data (abfd, ptr); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a9a246dc3a5..edc4efc1b95 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -5473,7 +5473,7 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (sec != NULL); BFD_ASSERT (bfd_is_und_section (sec) || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0 - || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0) + || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0); addend -= sec->output_section->vma + sec->output_offset + 0x8000; break; diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 800d66ad7ca..8bc830c1103 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1969,7 +1969,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym) the original values (in elf64_hppa_link_output_symbol_hook). */ if (dyn_h && dyn_h->want_opd) { - BFD_ASSERT (sopd != NULL) + BFD_ASSERT (sopd != NULL); /* Save away the original value and section index so that we can restore them later. */ @@ -1993,7 +1993,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym) Elf_Internal_Rela rel; bfd_byte *loc; - BFD_ASSERT (splt != NULL && spltrel != NULL) + BFD_ASSERT (splt != NULL && spltrel != NULL); /* We do not actually care about the value in the PLT entry if we are creating a shared library and the symbol is @@ -2043,7 +2043,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym) int insn; unsigned int max_offset; - BFD_ASSERT (stub != NULL) + BFD_ASSERT (stub != NULL); /* Install the generic stub template. diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 69ec779331c..093adbc47c2 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -924,7 +924,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) location of interest is just "sym". */ if (symtype == STT_SECTION) toff += irel->r_addend; - + toff = _bfd_merged_section_offset (abfd, &tsec, elf_section_data (tsec)->sec_info, toff); @@ -1125,7 +1125,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) enough that the data segment moves, which will change the GP. Reset the GP so that we re-calculate next round. We need to do this at the _beginning_ of the next round; now will not do. */ - + /* Clean up and go home. */ while (fixups) { @@ -2458,7 +2458,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) if (!pltoff) return FALSE; } - + dyn_i->want_pltoff = 1; } if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC)) @@ -4178,7 +4178,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); if (dyn_i->want_fptr) { - BFD_ASSERT (h == NULL || h->dynindx == -1) + BFD_ASSERT (h == NULL || h->dynindx == -1); if (!undef_weak_ref) value = set_fptr_entry (output_bfd, info, dyn_i, value); dynindx = -1; @@ -4262,7 +4262,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_PCREL64I: /* The PCREL21BI reloc is specifically not intended for use with dynamic relocs. PCREL21F and PCREL21M are used for speculation - fixup code, and thus probably ought not be dynamic. The + fixup code, and thus probably ought not be dynamic. The PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */ if (dynamic_symbol_p) { diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 95399dcee27..86e6942ed6c 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -595,10 +595,10 @@ void bfd_assert (const char*,int); #define BFD_ASSERT(x) \ - { if (!(x)) bfd_assert(__FILE__,__LINE__); } + do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) #define BFD_FAIL() \ - { bfd_assert(__FILE__,__LINE__); } + do { bfd_assert(__FILE__,__LINE__); } while (0) extern void _bfd_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 81f03c96b04..c308d881246 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -600,10 +600,10 @@ void bfd_assert (const char*,int); #define BFD_ASSERT(x) \ - { if (!(x)) bfd_assert(__FILE__,__LINE__); } + do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) #define BFD_FAIL() \ - { bfd_assert(__FILE__,__LINE__); } + do { bfd_assert(__FILE__,__LINE__); } while (0) extern void _bfd_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; diff --git a/bfd/opncls.c b/bfd/opncls.c index e54e099d07d..627364c53ba 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -859,9 +859,9 @@ bfd_release (bfd *abfd, void *block) } -/* - GNU Extension: separate debug-info files - +/* + GNU Extension: separate debug-info files + The idea here is that a special section called .gnu_debuglink might be embedded in a binary file, which indicates that some *other* file contains the real debugging information. This special section contains a @@ -889,7 +889,7 @@ DESCRIPTION RETURNS Return the updated CRC32 value. -*/ +*/ unsigned long bfd_calc_gnu_debuglink_crc32 (unsigned long crc, @@ -1092,19 +1092,19 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory) return NULL; } BFD_ASSERT (strlen (dir) != 0); - + /* Strip off filename part. */ for (i = strlen (dir) - 1; i >= 0; i--) if (IS_DIR_SEPARATOR (dir[i])) break; dir[i + 1] = '\0'; - BFD_ASSERT (dir[i] == '/' || dir[0] == '\0') + BFD_ASSERT (dir[i] == '/' || dir[0] == '\0'); debugfile = malloc (strlen (debug_file_directory) + 1 + strlen (dir) + strlen (".debug/") - + strlen (basename) + + strlen (basename) + 1); if (debugfile == NULL) { @@ -1211,7 +1211,7 @@ DESCRIPTION RETURNS A pointer to the new section is returned if all is ok. Otherwise <> is - returned and bfd_error is set. + returned and bfd_error is set. */ asection * @@ -1228,7 +1228,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) /* Strip off any path components in filename. */ filename = lbasename (filename); - + sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK); if (sect) { @@ -1246,7 +1246,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) /* XXX Should we delete the section from the bfd ? */ return NULL; - + debuglink_size = strlen (filename) + 1; debuglink_size += 3; debuglink_size &= ~3; @@ -1255,7 +1255,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) if (! bfd_set_section_size (abfd, sect, debuglink_size)) /* XXX Should we delete the section from the bfd ? */ return NULL; - + return sect; } @@ -1277,7 +1277,7 @@ DESCRIPTION RETURNS <> is returned if all is ok. Otherwise <> is returned - and bfd_error is set. + and bfd_error is set. */ bfd_boolean @@ -1320,7 +1320,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, /* Strip off any path components in filename, now that we no longer need them. */ filename = lbasename (filename); - + debuglink_size = strlen (filename) + 1; debuglink_size += 3; debuglink_size &= ~3;