This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Patch for gas (mri mode).
- To: rth at cygnus dot com
- Subject: Patch for gas (mri mode).
- From: Vladimir Makarov <vmakarov at tootie dot to dot cygnus dot com>
- Date: Mon, 20 Sep 1999 13:41:55 -0400
- CC: binutils at sourceware dot cygnus dot com
Hi, Richard
The following patch is relative to net binutils repository. Please,
approve it or not. Without the patch, the assembler code likes the
following results in assembler crash because in MRI mode the assembler
does not define NARG, but in non-MRI mode the assembler expects that
NARG is defined.
.mri 0
.macro listing_off
.nolist
.endm
.macro listing_on
list
.endm
listing_off
.mri 1
listing_on
Vlad
1999-09-20 Vladimir Makarov <vmakarov@tootie.to.cygnus.com>
* macro.c (macro_entry): Add new member macro_mri.
(define_macro): Assign value to macro->macro_mri.
(do_formals): Use macro->macro_mri instead of macro_mri to decide
define formal NARG or not.
(macro_expand): Use m->macro_mri instead of macro_mri to decide
make expansion of NARG or not.
Index: macro.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/macro.c,v
retrieving revision 1.2
diff -p -c -r1.2 macro.c
*** macro.c 1999/06/03 00:23:27 1.2
--- macro.c 1999/09/20 17:09:25
*************** formal_entry;
*** 100,105 ****
--- 100,111 ----
typedef struct macro_struct
{
sb sub; /* substitution text. */
+ /* The following member value is MACRO_MRI when macro definition
+ is started. It is needed for complex cases when macro is
+ defined in mri mode and used in non-mri mode or vise versa.
+ For example, if a macro is defined in non-mri mode and expanded
+ in mri mode, we should not expand NARG formal. */
+ int macro_mri;
int formal_count; /* number of formal args. */
formal_entry *formals; /* pointer to list of formal_structs */
struct hash_control *formal_hash; /* hash table of formals. */
*************** do_formals (macro, idx, in)
*** 502,508 ****
*p = NULL;
}
! if (macro_mri)
{
formal_entry *formal;
const char *name;
--- 508,514 ----
*p = NULL;
}
! if (macro->macro_mri)
{
formal_entry *formal;
const char *name;
*************** define_macro (idx, in, label, get_line,
*** 556,561 ****
--- 562,568 ----
sb_new (&name);
macro->formal_count = 0;
+ macro->macro_mri = macro_mri;
macro->formals = 0;
idx = sb_skip_white (idx, in);
*************** macro_expand (idx, in, m, out, comment_c
*** 1056,1062 ****
}
}
! if (macro_mri)
{
char buffer[20];
--- 1063,1069 ----
}
}
! if (m->macro_mri)
{
char buffer[20];