Remove #if 0 around bfd_mmo_mmix_vec
[deliverable/binutils-gdb.git] / binutils / srconv.c
index bd1ea6521f8680fe183accf427f7578b371a9a62..b55d2d9635340805dda0da7a61bbd4b3e2325d33 100644 (file)
@@ -1,5 +1,6 @@
 /* srconv.c -- Sysroff conversion program
-   Copyright (C) 1994, 95, 96, 1998 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
 #include "coff/internal.h"
 #include "../bfd/libcoff.h"
 
-#define PROGRAM_VERSION "1.5"
 /*#define FOOP1 1 */
 
 static int addrsize;
 static char *toolname;
 static char **rnames;
 
-static void wr_cs ();
-static void walk_tree_scope ();
-static void wr_globals ();
-static int find_base ();
+static int get_member_id PARAMS ((int));
+static int get_ordinary_id PARAMS ((int));
+static char *section_translate PARAMS ((char *));
+static char *strip_suffix PARAMS ((char *));
+static void checksum PARAMS ((FILE *, char *, int, int));
+static void writeINT PARAMS ((int, char *, int *, int, FILE *));
+static void writeBITS PARAMS ((int, char *, int *, int));
+static void writeBARRAY PARAMS ((barray, char *, int *, int, FILE *));
+static void writeCHARS PARAMS ((char *, char *, int *, int, FILE *));
+static void wr_tr PARAMS ((void));
+static void wr_un PARAMS ((struct coff_ofile *, struct coff_sfile *, int, int));
+static void wr_hd PARAMS ((struct coff_ofile *));
+static void wr_sh PARAMS ((struct coff_ofile *, struct coff_section *));
+static void wr_ob PARAMS ((struct coff_ofile *, struct coff_section *));
+static void wr_rl PARAMS ((struct coff_ofile *, struct coff_section *));
+static void wr_object_body PARAMS ((struct coff_ofile *));
+static void wr_dps_start
+  PARAMS ((struct coff_sfile *, struct coff_section *, struct coff_scope *,
+          int, int));
+static void wr_dps_end
+  PARAMS ((struct coff_section *, struct coff_scope *, int));
+static int *nints PARAMS ((int));
+static void walk_tree_type_1
+  PARAMS ((struct coff_sfile *, struct coff_symbol *, struct coff_type *,
+          int));
+static void walk_tree_type
+  PARAMS ((struct coff_sfile *, struct coff_symbol *, struct coff_type *,
+          int));
+static void walk_tree_symbol
+  PARAMS ((struct coff_sfile *, struct coff_section *,
+          struct coff_symbol *, int));
+static void walk_tree_scope
+  PARAMS ((struct coff_section *, struct coff_sfile *, struct coff_scope *,
+          int, int));
+static void walk_tree_sfile
+  PARAMS ((struct coff_section *, struct coff_sfile *));
+static void wr_program_structure
+  PARAMS ((struct coff_ofile *, struct coff_sfile *));
+static void wr_du PARAMS ((struct coff_ofile *, struct coff_sfile *, int));
+static void wr_dus PARAMS ((struct coff_ofile *, struct coff_sfile *));
+static int find_base PARAMS ((struct coff_sfile *, struct coff_section *));
+static void wr_dln PARAMS ((struct coff_ofile *, struct coff_sfile *, int));
+static void wr_globals
+  PARAMS ((struct coff_ofile *, struct coff_sfile *, int));
+static void wr_debug PARAMS ((struct coff_ofile *));
+static void wr_cs PARAMS ((void));
+static int wr_sc PARAMS ((struct coff_ofile *, struct coff_sfile *));
+static void wr_er PARAMS ((struct coff_ofile *, struct coff_sfile *, int));
+static void wr_ed PARAMS ((struct coff_ofile *, struct coff_sfile *, int));
+static void wr_unit_info PARAMS ((struct coff_ofile *));
+static void wr_module PARAMS ((struct coff_ofile *));
+static int align PARAMS ((int));
+static void prescan PARAMS ((struct coff_ofile *));
+static void show_usage PARAMS ((FILE *, int));
+static void show_help PARAMS ((void));
+extern int main PARAMS ((int, char **));
 
 static FILE *file;
 static bfd *abfd;
@@ -66,16 +118,6 @@ static int ids2[20000];
 static int base1 = 0x18;
 static int base2 = 0x2018;
 
-char *
-xcalloc (a, b)
-     int a;
-     int b;
-{
-  char *r = xmalloc (a * b);
-  memset (r, 0, a * b);
-  return r;
-}
-
 static int
 get_member_id (x)
      int x;
@@ -234,7 +276,7 @@ writeBARRAY (data, ptr, idx, size, file)
      barray data;
      char *ptr;
      int *idx;
-     int size;
+     int size ATTRIBUTE_UNUSED;
      FILE *file;
 {
   int i;
@@ -309,7 +351,7 @@ wr_un (ptr, sfile, first, nsecs)
      struct coff_ofile *ptr;
      struct coff_sfile *sfile;
      int first;
-     int nsecs;
+     int nsecs ATTRIBUTE_UNUSED;
 {
   struct IT_un un;
 
@@ -448,7 +490,7 @@ wr_hd (p)
 
 static void
 wr_sh (p, sec)
-     struct coff_ofile *p;
+     struct coff_ofile *p ATTRIBUTE_UNUSED;
      struct coff_section *sec;
 {
   struct IT_sh sh;
@@ -463,7 +505,7 @@ wr_sh (p, sec)
 
 static void
 wr_ob (p, section)
-     struct coff_ofile *p;
+     struct coff_ofile *p ATTRIBUTE_UNUSED;
      struct coff_section *section;
 {
   bfd_size_type i;
@@ -524,7 +566,7 @@ wr_ob (p, section)
 
 static void
 wr_rl (ptr, sec)
-     struct coff_ofile *ptr;
+     struct coff_ofile *ptr ATTRIBUTE_UNUSED;
      struct coff_section *sec;
 {
   int nr = sec->nrelocs;
@@ -596,7 +638,7 @@ wr_object_body (p)
 static void
 wr_dps_start (sfile, section, scope, type, nest)
      struct coff_sfile *sfile;
-     struct coff_section *section;
+     struct coff_section *section ATTRIBUTE_UNUSED;
      struct coff_scope *scope;
      int type;
      int nest;
@@ -633,8 +675,8 @@ wr_dps_start (sfile, section, scope, type, nest)
 
 static void
 wr_dps_end (section, scope, type)
-     struct coff_section *section;
-     struct coff_scope *scope;
+     struct coff_section *section ATTRIBUTE_UNUSED;
+     struct coff_scope *scope ATTRIBUTE_UNUSED;
      int type;
 {
   struct IT_dps dps;
@@ -650,7 +692,6 @@ nints (x)
   return (int *) (xcalloc (sizeof (int), x));
 }
 
-static void walk_tree_symbol ();
 static void
 walk_tree_type_1 (sfile, symbol, type, nest)
      struct coff_sfile *sfile;
@@ -970,7 +1011,7 @@ walk_tree_type (sfile, symbol, type, nest)
 static void
 walk_tree_symbol (sfile, section, symbol, nest)
      struct coff_sfile *sfile;
-     struct coff_section *section;
+     struct coff_section *section ATTRIBUTE_UNUSED;
      struct coff_symbol *symbol;
      int nest;
 {
@@ -1339,7 +1380,7 @@ wr_du (p, sfile, n)
 
 static void
 wr_dus (p, sfile)
-     struct coff_ofile *p;
+     struct coff_ofile *p ATTRIBUTE_UNUSED;
      struct coff_sfile *sfile;
 {
 
@@ -1383,11 +1424,12 @@ find_base (sfile, section)
 {
   return sfile->section[section->number].low;
 }
+
 static void
 wr_dln (p, sfile, n)
-     struct coff_ofile *p;
+     struct coff_ofile *p ATTRIBUTE_UNUSED;
      struct coff_sfile *sfile;
-     int n;
+     int n ATTRIBUTE_UNUSED;
 
 {
 #if 0
@@ -1527,7 +1569,7 @@ static void
 wr_globals (p, sfile, n)
      struct coff_ofile *p;
      struct coff_sfile *sfile;
-     int n;
+     int n ATTRIBUTE_UNUSED;
 {
   struct coff_symbol *sy;
   for (sy = p->symbol_list_head;
@@ -1744,7 +1786,7 @@ return scount;
 static void
 wr_er (ptr, sfile, first)
      struct coff_ofile *ptr;
-     struct coff_sfile *sfile;
+     struct coff_sfile *sfile ATTRIBUTE_UNUSED;
      int first;
 {
   int idx = 0;
@@ -1770,7 +1812,7 @@ wr_er (ptr, sfile, first)
 static void
 wr_ed (ptr, sfile, first)
      struct coff_ofile *ptr;
-     struct coff_sfile *sfile;
+     struct coff_sfile *sfile ATTRIBUTE_UNUSED;
      int first;
 {
   struct coff_symbol *s;
@@ -1919,7 +1961,12 @@ main (ac, av)
   char *input_file;
   char *output_file;
 
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+  setlocale (LC_CTYPE, "");
+#endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
@@ -1945,7 +1992,7 @@ main (ac, av)
          show_help ();
          /*NOTREACHED */
        case 'V':
-         printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION);
+         print_version ("srconv");
          exit (0);
          /*NOTREACHED */
        case 0:
@@ -1970,10 +2017,7 @@ main (ac, av)
            show_usage (stderr, 1);
          if (strcmp (input_file, output_file) == 0)
            {
-             fprintf (stderr,
-                      _("%s: input and output files must be different\n"),
-                      program_name);
-             exit (1);
+             fatal (_("input and output files must be different"));
            }
        }
     }
@@ -1982,9 +2026,7 @@ main (ac, av)
 
   if (!input_file)
     {
-      fprintf (stderr, _("%s: no input file specified\n"),
-              program_name);
-      exit (1);
+      fatal (_("no input file specified"));
     }
 
   if (!output_file)
@@ -2029,9 +2071,7 @@ main (ac, av)
 
   if (!file)
     {
-      fprintf (stderr, _("%s: unable to open output file %s\n"),
-              program_name, output_file);
-      exit (1);
+      fatal (_("unable to open output file %s"), output_file);
     }
 
   if (debug)
This page took 0.041186 seconds and 4 git commands to generate.