This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bfd cpu cleanup


Crud removal.  Well, cpu-z8k.c isn't too bad but the other two are
horrible.

bfd/ChangeLog
	* cpu-pj.c (scan_mach, compatible, arch_info_struct): Remove.
	(bfd_pj_arch): Use bfd_default_scan.
	* cpu-v850.c (scan): Remove.
	(N): Use bfd_default_scan.
	* cpu-z8k.c (scan_mach): Remove.
	(arch_info_struct, bfd_z8k_arch): Reorganize so that the default is
	first.  Use bfd_default_scan.

Index: bfd/cpu-pj.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-pj.c,v
retrieving revision 1.4
diff -u -p -r1.4 cpu-pj.c
--- bfd/cpu-pj.c	18 Sep 2001 09:57:22 -0000	1.4
+++ bfd/cpu-pj.c	2 Sep 2002 11:48:53 -0000
@@ -22,52 +22,6 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "sysdep.h"
 #include "libbfd.h"
 
-static boolean scan_mach
-  PARAMS ((const struct bfd_arch_info *, const char *));
-
-static boolean
-scan_mach (info, string)
-     const struct bfd_arch_info *info;
-     const char *string;
-{
-  if (strcasecmp (info->printable_name, string) == 0)
-    return true;
-  return false;
-}
-
-#if 0
-/* This routine is provided two arch_infos and returns whether
-   they'd be compatible */
-
-static const bfd_arch_info_type *
-compatible (a,b)
-     const bfd_arch_info_type *a;
-     const bfd_arch_info_type *b;
-{
-  if (a->arch != b->arch || a->mach != b->mach)
-   return NULL;
-  return a;
-}
-#endif
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
-  {
-    32,				/* 32 bits in a word */
-    32,				/* 32 bits in an address */
-    8,				/* 8 bits in a byte */
-    bfd_arch_pj,
-    0,
-    "pj",			/* arch_name  */
-    "pj",			/* printable name */
-    1,
-    false,			/* not the default */
-    bfd_default_compatible,
-    scan_mach,
-    0,
-  },
-};
-
 const bfd_arch_info_type bfd_pj_arch =
 {
   32,				/* 32 bits in a word */
@@ -80,6 +34,6 @@ const bfd_arch_info_type bfd_pj_arch =
   1,
   true,				/* the default machine */
   bfd_default_compatible,
-  scan_mach,
-  &arch_info_struct [0]
+  bfd_default_scan,
+  0
 };
Index: bfd/cpu-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-v850.c,v
retrieving revision 1.6
diff -u -p -r1.6 cpu-v850.c
--- bfd/cpu-v850.c	29 Aug 2002 06:49:33 -0000	1.6
+++ bfd/cpu-v850.c	2 Sep 2002 11:48:53 -0000
@@ -22,67 +22,9 @@
 #include "libbfd.h"
 #include "safe-ctype.h"
 
-static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
-
-static boolean
-scan (info, string)
-     const struct bfd_arch_info * info;
-     const char * string;
-{
-  const char *ptr_src;
-  const char *ptr_tst;
-  unsigned long number;
-  enum bfd_architecture arch;
-
-  /* First test for an exact match.  */
-  if (strcasecmp (string, info->printable_name) == 0)
-    return true;
-
-  /* See how much of the supplied string matches with the
-     architecture, eg the string m68k:68020 would match the m68k entry
-     up to the :, then we get left with the machine number.  */
-  for (ptr_src = string, ptr_tst = info->arch_name;
-       *ptr_src && *ptr_tst;
-       ptr_src++, ptr_tst++)
-    if (*ptr_src != *ptr_tst)
-      break;
-
-  /* Chewed up as much of the architecture as will match;
-     if there is a colon present skip it.  */
-  if (*ptr_src == ':')
-    ptr_src ++;
-
-  if (*ptr_src == 0)
-    /* Nothing more, then only keep this one if it is
-       the default machine for this architecture.  */
-    return info->the_default;
-
-  number = 0;
-  while (ISDIGIT (*ptr_src))
-    {
-      number = number * 10 + * ptr_src  - '0';
-      ptr_src ++;
-    }
-
-  switch (number)
-    {
-    case bfd_mach_v850e:  arch = bfd_arch_v850; break;
-    default:
-      return false;
-    }
-
-  if (arch != info->arch)
-    return false;
-
-  if (number != info->mach)
-    return false;
-
-  return true;
-}
-
 #define N(number, print, default, next)  \
 {  32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
-     bfd_default_compatible, scan, next }
+     bfd_default_compatible, bfd_default_scan, next }
 
 #define NEXT NULL
 
Index: bfd/cpu-z8k.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-z8k.c,v
retrieving revision 1.4
diff -u -p -r1.4 cpu-z8k.c
--- bfd/cpu-z8k.c	18 Sep 2001 09:57:22 -0000	1.4
+++ bfd/cpu-z8k.c	2 Sep 2002 11:48:53 -0000
@@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "sysdep.h"
 #include "libbfd.h"
 
-static boolean scan_mach
-  PARAMS ((const struct bfd_arch_info *, const char *));
 static const bfd_arch_info_type *compatible
   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
 
@@ -153,22 +151,6 @@ local_bfd_reloc_type_lookup (arch, code)
 }
 #endif
 
-static boolean
-scan_mach (info, string)
-     const struct bfd_arch_info *info;
-     const char *string;
-{
-  if (strcmp (string, "z8001") == 0 || strcmp (string, "z8k") == 0)
-    {
-      return bfd_mach_z8001 == info->mach;
-    }
-  if (strcmp (string, "z8002") == 0)
-    {
-      return bfd_mach_z8002 == info->mach;
-    }
-  return false;
-}
-
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
 
@@ -184,10 +166,12 @@ compatible (a, b)
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
-  {32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,},
+  { 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, false,
+    compatible, bfd_default_scan, 0 }
 };
 
 const bfd_arch_info_type bfd_z8k_arch =
 {
-  32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, true, compatible, scan_mach, &arch_info_struct[0],
+  32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, true,
+  compatible, bfd_default_scan, &arch_info_struct[0]
 };

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]