summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/gas/macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/gas/macro.c')
-rw-r--r--contrib/binutils/gas/macro.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/contrib/binutils/gas/macro.c b/contrib/binutils/gas/macro.c
index af98bad..d7d470b 100644
--- a/contrib/binutils/gas/macro.c
+++ b/contrib/binutils/gas/macro.c
@@ -1,6 +1,6 @@
/* macro.c - macro support for gas
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
@@ -22,47 +22,11 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "config.h"
-
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
-/* Indented so that pre-ansi C compilers will ignore it, rather than
- choke on it. Some versions of AIX require this to be the first
- thing in the file. */
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-# if !defined (__STDC__) && !defined (__hpux)
-extern char *alloca ();
-# else
-extern void *alloca ();
-# endif /* __STDC__, __hpux */
-# endif /* alloca */
-# endif /* _AIX */
-# endif /* HAVE_ALLOCA_H */
-#endif /* __GNUC__ */
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#include "as.h"
-#include "libiberty.h"
#include "safe-ctype.h"
#include "sb.h"
-#include "hash.h"
#include "macro.h"
-#include "asintl.h"
-
/* The routines in this file handle macro definition and expansion.
They are called by gas. */
@@ -1025,7 +989,6 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out)
sb t;
formal_entry *ptr;
formal_entry *f;
- int is_positional = 0;
int is_keyword = 0;
int narg = 0;
const char *err = NULL;
@@ -1116,8 +1079,6 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out)
}
else
{
- /* This is a positional arg. */
- is_positional = 1;
if (is_keyword)
{
err = _("can't mix positional and keyword arguments");
@@ -1364,8 +1325,14 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *))
}
else
{
+ bfd_boolean in_quotes = FALSE;
+
if (irpc && in->ptr[idx] == '"')
- ++idx;
+ {
+ in_quotes = TRUE;
+ ++idx;
+ }
+
while (idx < in->len)
{
if (!irpc)
@@ -1376,6 +1343,9 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *))
{
int nxt;
+ if (irpc)
+ in_quotes = ! in_quotes;
+
nxt = sb_skip_white (idx + 1, in);
if (nxt >= in->len)
{
@@ -1387,12 +1357,13 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *))
sb_add_char (&f.actual, in->ptr[idx]);
++idx;
}
+
err = macro_expand_body (&sub, out, &f, h, 0);
if (err != NULL)
break;
if (!irpc)
idx = sb_skip_comma (idx, in);
- else
+ else if (! in_quotes)
idx = sb_skip_white (idx, in);
}
}
OpenPOWER on IntegriCloud