This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix BFD_ASSERT invocations
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Sun, 10 Oct 2004 23:26:18 +0930
- Subject: Fix BFD_ASSERT invocations
Cleanup.
* 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.
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.43
diff -u -p -r1.43 libbfd-in.h
--- bfd/libbfd-in.h 8 Oct 2004 14:54:00 -0000 1.43
+++ bfd/libbfd-in.h 10 Oct 2004 13:33:25 -0000
@@ -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;
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.57
diff -u -p -r1.57 elf32-cris.c
--- bfd/elf32-cris.c 17 Sep 2004 07:14:26 -0000 1.57
+++ bfd/elf32-cris.c 10 Oct 2004 13:33:06 -0000
@@ -2960,7 +2960,7 @@ cris_elf_print_private_bfd_data (abfd, p
{
FILE *file = (FILE *) ptr;
- BFD_ASSERT (abfd != NULL && ptr != NULL)
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
_bfd_elf_print_private_bfd_data (abfd, ptr);
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.30
diff -u -p -r1.30 elf32-frv.c
--- bfd/elf32-frv.c 17 Sep 2004 07:14:26 -0000 1.30
+++ bfd/elf32-frv.c 10 Oct 2004 13:33:12 -0000
@@ -3331,7 +3331,7 @@ _frvfdpic_assign_plt_entries (void **ent
}
else
{
- BFD_ASSERT (dinfo->gothilo.fdplt)
+ BFD_ASSERT (dinfo->gothilo.fdplt);
entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo);
dinfo->gothilo.fdplt -= 8;
}
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.52
diff -u -p -r1.52 elf32-m32r.c
--- bfd/elf32-m32r.c 17 Sep 2004 07:14:27 -0000 1.52
+++ bfd/elf32-m32r.c 10 Oct 2004 13:33:12 -0000
@@ -1350,7 +1350,7 @@ m32r_info_to_howto_rel (abfd, cache_ptr,
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];
}
@@ -4271,7 +4271,7 @@ m32r_elf_print_private_bfd_data (abfd, p
{
FILE * file = (FILE *) ptr;
- BFD_ASSERT (abfd != NULL && ptr != NULL)
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
_bfd_elf_print_private_bfd_data (abfd, ptr);
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.127
diff -u -p -r1.127 elf32-ppc.c
--- bfd/elf32-ppc.c 22 Sep 2004 06:57:35 -0000 1.127
+++ bfd/elf32-ppc.c 10 Oct 2004 13:33:14 -0000
@@ -5473,7 +5473,7 @@ ppc_elf_relocate_section (bfd *output_bf
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;
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.51
diff -u -p -r1.51 elf64-hppa.c
--- bfd/elf64-hppa.c 17 Sep 2004 07:14:28 -0000 1.51
+++ bfd/elf64-hppa.c 10 Oct 2004 13:33:16 -0000
@@ -1969,7 +1969,7 @@ elf64_hppa_finish_dynamic_symbol (output
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
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
int insn;
unsigned int max_offset;
- BFD_ASSERT (stub != NULL)
+ BFD_ASSERT (stub != NULL);
/* Install the generic stub template.
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.140
diff -u -p -r1.140 elfxx-ia64.c
--- bfd/elfxx-ia64.c 17 Sep 2004 07:14:30 -0000 1.140
+++ bfd/elfxx-ia64.c 10 Oct 2004 13:33:24 -0000
@@ -4178,7 +4178,7 @@ elfNN_ia64_relocate_section (output_bfd,
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;
Index: bfd/opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.24
diff -u -p -r1.24 opncls.c
--- bfd/opncls.c 24 Jun 2004 04:46:25 -0000 1.24
+++ bfd/opncls.c 10 Oct 2004 13:33:26 -0000
@@ -1099,7 +1099,7 @@ find_separate_debug_file (bfd *abfd, con
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)
--
Alan Modra
IBM OzLabs - Linux Technology Centre