public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Patch for gas (mri mode).
@ 1999-09-20 10:43 Vladimir Makarov
  1999-09-20 10:59 ` Richard Henderson
  1999-09-20 11:06 ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Vladimir Makarov @ 1999-09-20 10:43 UTC (permalink / raw)
  To: rth; +Cc: binutils

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];
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-09-20 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-20 10:43 Patch for gas (mri mode) Vladimir Makarov
1999-09-20 10:59 ` Richard Henderson
1999-09-20 11:03   ` Vladimir Makarov
1999-09-20 11:06 ` Ian Lance Taylor
1999-09-20 13:05   ` Vladimir Makarov
1999-09-20 13:51     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).