Replace <sys/dir.h> (and <dirent.h>) with "gdb_dirent.h".
[deliverable/binutils-gdb.git] / gas / gasp.c
index 1b72838ed458197b291835582d0698c6417d665e..a8f56192aeeb3cb96568d74713373347274b6a85 100644 (file)
@@ -1,5 +1,6 @@
 /* gasp.c - Gnu assembler preprocessor main program.
-   Copyright (C) 1994, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    Written by Steve and Judy Chamberlain of Cygnus Support,
       sac@cygnus.com
@@ -49,6 +50,7 @@ suitable for gas to consume.
 */
 
 #include "config.h"
+#include "bin-bugs.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -76,6 +78,11 @@ char *program_version = "1.2";
    it.  */
 extern void as_abort PARAMS ((const char *, int, const char *));
 
+/* The default obstack chunk size.  If we set this to zero, the
+   obstack code will use whatever will fit in a 4096 byte block.  This
+   is used by the hash table code used by macro.c.  */
+int chunksize = 0;
+
 #define MAX_INCLUDES 30                /* Maximum include depth */
 #define MAX_REASONABLE 1000    /* Maximum number of expansions */
 
@@ -187,37 +194,6 @@ typedef struct
   } hash_table;
 
 
-/* Structures used to store macros. 
-
-   Each macro knows its name and included text.  It gets built with a
-   list of formal arguments, and also keeps a hash table which points
-   into the list to speed up formal search.  Each formal knows its
-   name and its default value.  Each time the macro is expanded, the
-   formals get the actual values attatched to them. */
-
-/* describe the formal arguments to a macro */
-
-typedef struct formal_struct
-  {
-    struct formal_struct *next;        /* next formal in list */
-    sb name;                   /* name of the formal */
-    sb def;                    /* the default value */
-    sb actual;                 /* the actual argument (changed on each expansion) */
-    int index;                 /* the index of the formal 0..formal_count-1 */
-  }
-formal_entry;
-
-/* describe the macro. */
-
-typedef struct macro_struct
-  {
-    sb sub;                    /* substitution text. */
-    int formal_count;          /* number of formal args. */
-    formal_entry *formals;     /* pointer to list of formal_structs */
-    hash_table formal_hash;    /* hash table of formals. */
-  }
-macro_entry;
-
 /* how we nest files and expand macros etc.
 
    we keep a stack of of include_stack structs.  each include file
@@ -888,7 +864,7 @@ exp_get_abs (emsg, idx, in, val)
   exp_t res;
   idx = exp_parse (idx, in, &res);
   if (res.add_symbol.len || res.sub_symbol.len)
-    ERROR ((stderr, emsg));
+    ERROR ((stderr, "%s", emsg));
   *val = res.value;
   return idx;
 }
@@ -1080,7 +1056,7 @@ grab_label (in, out)
 {
   int i = 0;
   sb_reset (out);
-  if (ISFIRSTCHAR (in->ptr[i]))
+  if (ISFIRSTCHAR (in->ptr[i]) || in->ptr[i] == '\\')
     {
       sb_add_char (out, in->ptr[i]);
       i++;
@@ -1379,7 +1355,7 @@ do_data (idx, in, size)
          idx = exp_parse (idx, in, &e);
          exp_string (&e, &acc);
          sb_add_char (&acc, 0);
-         fprintf (outfile, acc.ptr);
+         fprintf (outfile, "%s", acc.ptr);
          if (idx < in->len && in->ptr[idx] == ',')
            {
              fprintf (outfile, ",");
@@ -1433,11 +1409,6 @@ do_align (idx, in)
       have_fill = 1;
     }
 
-  if (al != 1
-      && al != 2
-      && al != 4)
-    WARNING ((stderr, _("alignment must be one of 1, 2 or 4.\n")));
-
   fprintf (outfile, ".align    %d", al);
   if (have_fill)
     fprintf (outfile, ",%d", fill);
@@ -1917,7 +1888,7 @@ process_file ()
                   || line.ptr[0] == '!'))
        {
          /* MRI line comment.  */
-         fprintf (outfile, sb_name (&line));
+         fprintf (outfile, "%s", sb_name (&line));
        }
       else
        {
@@ -2654,8 +2625,8 @@ do_irp (idx, in, irpc)
 static
 void 
 do_local (idx, line)
-     int idx;
-     sb *line;
+     int idx ATTRIBUTE_UNUSED;
+     sb *line ATTRIBUTE_UNUSED;
 {
   ERROR ((stderr, _("LOCAL outside of MACRO")));
 }
@@ -2686,7 +2657,7 @@ macro_op (idx, in)
     return 0;
 
   sb_terminate (in);
-  if (! check_macro (in->ptr + idx, &out, comment_char, &err))
+  if (! check_macro (in->ptr + idx, &out, comment_char, &err, NULL))
     return 0;
 
   if (err != NULL)
@@ -3580,7 +3551,7 @@ Usage: %s \n\
   [-Ipath]                        add to include path list\n\
   [in-file]\n"));
   if (status == 0)
-    printf (_("\nReport bugs to bug-gnu-utils@gnu.org\n"));
+    printf (_("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
 
@@ -3605,7 +3576,9 @@ main (argc, argv)
   ifstack[0].on = 1;
   ifi = 0;
 
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
+#endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
This page took 0.024843 seconds and 4 git commands to generate.