bfd cleanups

Hans-Peter Nilsson hp@bitrange.com
Tue Feb 1 03:29:00 GMT 2005


On Tue, 1 Feb 2005, Ben Elliston wrote:
> > Please keep the comment in cpu-cris.c.  I think the code also serves
> > a purpose, so please keep as a whole or suggest some improvement in
> > documentness "so that it doesn't just look like disabled code".
> > Maybe add "This code is disabled but kept as a warning" to the top
> > of the comment?
>
> Changed as suggested.

Nah, not _really_, at least not what I _meant_: you removed the
#if 0, so it's not less clear what comment and code goes with
what.  Sorry; I reinstated the #if 0, but with the added
sentence at the top of the comment:

	* cpu-cris.c (get_compatible): Rearrange disabled code and comment
	for clarity.

Index: cpu-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-cris.c,v
retrieving revision 1.6
diff -p -c -r1.6 cpu-cris.c
*** cpu-cris.c	31 Jan 2005 23:13:17 -0000	1.6
--- cpu-cris.c	1 Feb 2005 03:19:30 -0000
*************** get_compatible (a,b)
*** 45,51 ****
    if (b->mach == bfd_mach_cris_v10_v32)
      return a;

!   /* See ldlang.c:lang_check.  Quite illogically, incompatible arches
       (as signalled by this function) are only *warned* about, while with
       this function signalling compatible ones, we can have the
       cris_elf_merge_private_bfd_data function return an error.  This is
--- 45,53 ----
    if (b->mach == bfd_mach_cris_v10_v32)
      return a;

! #if 0
!   /* The code below is disabled but kept as a warning.
!      See ldlang.c:lang_check.  Quite illogically, incompatible arches
       (as signalled by this function) are only *warned* about, while with
       this function signalling compatible ones, we can have the
       cris_elf_merge_private_bfd_data function return an error.  This is
*************** get_compatible (a,b)
*** 56,67 ****
       pretending matching machs here.  */

    /* Except for the compatible mach, machs must match.  */
!
!   /*
!     This code is disabled but kept as a warning:
!     if (a->mach != b->mach)
!       return NULL;
!   */

    return a;
  }
--- 58,66 ----
       pretending matching machs here.  */

    /* Except for the compatible mach, machs must match.  */
!   if (a->mach != b->mach)
!     return NULL;
! #endif

    return a;
  }

Perhaps a bit clearer when comparing to the previous version:

Index: cpu-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-cris.c,v
retrieving revision 1.5
diff -p -c -r1.5 cpu-cris.c
*** cpu-cris.c	4 Nov 2004 14:57:43 -0000	1.5
--- cpu-cris.c	1 Feb 2005 03:20:11 -0000
*************** get_compatible (a,b)
*** 46,52 ****
      return a;

  #if 0
!   /* See ldlang.c:lang_check.  Quite illogically, incompatible arches
       (as signalled by this function) are only *warned* about, while with
       this function signalling compatible ones, we can have the
       cris_elf_merge_private_bfd_data function return an error.  This is
--- 46,53 ----
      return a;

  #if 0
!   /* The code below is disabled but kept as a warning.
!      See ldlang.c:lang_check.  Quite illogically, incompatible arches
       (as signalled by this function) are only *warned* about, while with
       this function signalling compatible ones, we can have the
       cris_elf_merge_private_bfd_data function return an error.  This is

brgds, H-P



More information about the Binutils mailing list