public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] gas: tidy macro interfacing after removal of gasp
@ 2023-03-08 16:05 Jan Beulich
  2023-03-08 16:07 ` [PATCH 1/4] gas: drop function pointer parameter from macro_init() Jan Beulich
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jan Beulich @ 2023-03-08 16:05 UTC (permalink / raw)
  To: Binutils

It's been only about 20 years, but better late than never.

1: drop function pointer parameter from macro_init()
2: isolate macro_strip_at to macro.c
3: use flag_mri directly in macro processing
4: expose flag_macro_alternate globally

Jan

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

* [PATCH 1/4] gas: drop function pointer parameter from macro_init()
  2023-03-08 16:05 [PATCH 0/4] gas: tidy macro interfacing after removal of gasp Jan Beulich
@ 2023-03-08 16:07 ` Jan Beulich
  2023-03-08 16:08 ` [PATCH 2/4] gas: isolate macro_strip_at to macro.c Jan Beulich
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2023-03-08 16:07 UTC (permalink / raw)
  To: Binutils

With the removal of gasp (about 20 years ago) the need for this kind-
of-hook has disappeared. Go a step beyond merely moving the to be called
function: Inline its contents right at the sole call site.

--- a/gas/as.c
+++ b/gas/as.c
@@ -1167,28 +1167,6 @@ dump_statistics (void)
   obj_print_statistics (stderr);
 #endif
 }
-
-/* The interface between the macro code and gas expression handling.  */
-
-static size_t
-macro_expr (const char *emsg, size_t idx, sb *in, offsetT *val)
-{
-  expressionS ex;
-
-  sb_terminate (in);
-
-  temp_ilp (in->ptr + idx);
-  expression_and_evaluate (&ex);
-  idx = input_line_pointer - in->ptr;
-  restore_ilp ();
-
-  if (ex.X_op != O_constant)
-    as_bad ("%s", emsg);
-
-  *val = ex.X_add_number;
-
-  return idx;
-}
 \f
 /* Here to attempt 1 pass over each input file.
    We scan argv[*] looking for filenames or exactly "" which is
@@ -1333,7 +1311,7 @@ gas_init (void)
 #ifdef TC_I960
   macro_strip_at = flag_mri;
 #endif
-  macro_init (flag_macro_alternate, flag_mri, macro_strip_at, macro_expr);
+  macro_init (flag_macro_alternate, flag_mri, macro_strip_at);
 
   dwarf2_init ();
 
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -62,10 +62,6 @@ static int macro_mri;
 
 static int macro_strip_at;
 
-/* Function to use to parse an expression.  */
-
-static size_t (*macro_expr) (const char *, size_t, sb *, offsetT *);
-
 /* Number of macro expansions that have been done.  */
 
 static int macro_number;
@@ -82,8 +78,7 @@ macro_del_f (void *ent)
 /* Initialize macro processing.  */
 
 void
-macro_init (int alternate, int mri, int strip_at,
-	    size_t (*exp) (const char *, size_t, sb *, offsetT *))
+macro_init (int alternate, int mri, int strip_at)
 {
   macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
 				  macro_del_f, notes_calloc, NULL);
@@ -91,7 +86,6 @@ macro_init (int alternate, int mri, int
   macro_alternate = alternate;
   macro_mri = mri;
   macro_strip_at = strip_at;
-  macro_expr = exp;
 }
 
 void
@@ -412,16 +406,21 @@ get_any_string (size_t idx, sb *in, sb *
 	}
       else if (in->ptr[idx] == '%' && macro_alternate)
 	{
-	  offsetT val;
+	  /* Turn the following expression into a string.  */
+	  expressionS ex;
 	  char buf[64];
 
-	  /* Turns the next expression into a string.  */
-	  /* xgettext: no-c-format */
-	  idx = (*macro_expr) (_("% operator needs absolute expression"),
-			       idx + 1,
-			       in,
-			       &val);
-	  sprintf (buf, "%" PRId64, (int64_t) val);
+	  sb_terminate (in);
+
+	  temp_ilp (in->ptr + idx + 1);
+	  expression_and_evaluate (&ex);
+	  idx = input_line_pointer - in->ptr;
+	  restore_ilp ();
+
+	  if (ex.X_op != O_constant)
+	    as_bad (_("%% operator needs absolute expression"));
+
+	  sprintf (buf, "%" PRId64, (int64_t) ex.X_add_number);
 	  sb_add_string (out, buf);
 	}
       else if (in->ptr[idx] == '"'
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -83,8 +83,7 @@ extern htab_t macro_hash;
 
 extern int buffer_and_nest (const char *, const char *, sb *,
 			    size_t (*) (sb *));
-extern void macro_init (int, int, int,
-			size_t (*) (const char *, size_t, sb *, offsetT *));
+extern void macro_init (int, int, int);
 extern void macro_end (void);
 extern void macro_set_alternate (int);
 extern void macro_mri_mode (int);


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

* [PATCH 2/4] gas: isolate macro_strip_at to macro.c
  2023-03-08 16:05 [PATCH 0/4] gas: tidy macro interfacing after removal of gasp Jan Beulich
  2023-03-08 16:07 ` [PATCH 1/4] gas: drop function pointer parameter from macro_init() Jan Beulich
@ 2023-03-08 16:08 ` Jan Beulich
  2023-03-08 16:08 ` [PATCH 3/4] gas: use flag_mri directly in macro processing Jan Beulich
  2023-03-08 16:09 ` [PATCH 4/4] gas: expose flag_macro_alternate globally Jan Beulich
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2023-03-08 16:08 UTC (permalink / raw)
  To: Binutils

This removes a leftover from i960 support; with that nothing is left
which would set macro_strip_at to non-zero, so the variable is converted
to a #define (retaining the logic in case a new user would appear) and
macro_init()'s respective parameter is dropped.

--- a/gas/as.c
+++ b/gas/as.c
@@ -1307,11 +1307,7 @@ gas_init (void)
   input_scrub_begin ();
   expr_begin ();
 
-  int macro_strip_at = 0;
-#ifdef TC_I960
-  macro_strip_at = flag_mri;
-#endif
-  macro_init (flag_macro_alternate, flag_mri, macro_strip_at);
+  macro_init (flag_macro_alternate, flag_mri);
 
   dwarf2_init ();
 
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -60,7 +60,7 @@ static int macro_mri;
 
 /* Whether we should strip '@' characters.  */
 
-static int macro_strip_at;
+#define macro_strip_at false
 
 /* Number of macro expansions that have been done.  */
 
@@ -78,14 +78,13 @@ macro_del_f (void *ent)
 /* Initialize macro processing.  */
 
 void
-macro_init (int alternate, int mri, int strip_at)
+macro_init (int alternate, int mri)
 {
   macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
 				  macro_del_f, notes_calloc, NULL);
   macro_defined = 0;
   macro_alternate = alternate;
   macro_mri = mri;
-  macro_strip_at = strip_at;
 }
 
 void
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -83,7 +83,7 @@ extern htab_t macro_hash;
 
 extern int buffer_and_nest (const char *, const char *, sb *,
 			    size_t (*) (sb *));
-extern void macro_init (int, int, int);
+extern void macro_init (int, int);
 extern void macro_end (void);
 extern void macro_set_alternate (int);
 extern void macro_mri_mode (int);


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

* [PATCH 3/4] gas: use flag_mri directly in macro processing
  2023-03-08 16:05 [PATCH 0/4] gas: tidy macro interfacing after removal of gasp Jan Beulich
  2023-03-08 16:07 ` [PATCH 1/4] gas: drop function pointer parameter from macro_init() Jan Beulich
  2023-03-08 16:08 ` [PATCH 2/4] gas: isolate macro_strip_at to macro.c Jan Beulich
@ 2023-03-08 16:08 ` Jan Beulich
  2023-03-08 16:09 ` [PATCH 4/4] gas: expose flag_macro_alternate globally Jan Beulich
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2023-03-08 16:08 UTC (permalink / raw)
  To: Binutils

Again with the removal of gasp about 20 years ago the extra level of
indirection isn't necessary anymore. Drop macro.c's local variable and
use the global flag directly.

--- a/gas/as.c
+++ b/gas/as.c
@@ -1307,7 +1307,7 @@ gas_init (void)
   input_scrub_begin ();
   expr_begin ();
 
-  macro_init (flag_macro_alternate, flag_mri);
+  macro_init (flag_macro_alternate);
 
   dwarf2_init ();
 
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -34,7 +34,7 @@
 #define ISSEP(x) \
  ((x) == ' ' || (x) == '\t' || (x) == ',' || (x) == '"' || (x) == ';' \
   || (x) == ')' || (x) == '(' \
-  || ((macro_alternate || macro_mri) && ((x) == '<' || (x) == '>')))
+  || ((macro_alternate || flag_mri) && ((x) == '<' || (x) == '>')))
 
 #define ISBASE(x) \
   ((x) == 'b' || (x) == 'B' \
@@ -54,10 +54,6 @@ int macro_defined;
 
 static int macro_alternate;
 
-/* Whether we are in MRI mode.  */
-
-static int macro_mri;
-
 /* Whether we should strip '@' characters.  */
 
 #define macro_strip_at false
@@ -78,13 +74,12 @@ macro_del_f (void *ent)
 /* Initialize macro processing.  */
 
 void
-macro_init (int alternate, int mri)
+macro_init (int alternate)
 {
   macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
 				  macro_del_f, notes_calloc, NULL);
   macro_defined = 0;
   macro_alternate = alternate;
-  macro_mri = mri;
 }
 
 void
@@ -101,14 +96,6 @@ macro_set_alternate (int alternate)
   macro_alternate = alternate;
 }
 
-/* Switch in and out of MRI mode on the fly.  */
-
-void
-macro_mri_mode (int mri)
-{
-  macro_mri = mri;
-}
-
 /* Read input lines till we get to a TO string.
    Increase nesting depth if we get a FROM string.
    Put the results into sb at PTR.
@@ -205,7 +192,7 @@ buffer_and_nest (const char *from, const
 
       if (i < ptr->len && (ptr->ptr[i] == '.'
 			   || NO_PSEUDO_DOT
-			   || macro_mri))
+			   || flag_mri))
 	{
 	  if (! flag_m68k_mri && ptr->ptr[i] == '.')
 	    i++;
@@ -309,7 +296,7 @@ getstring (size_t idx, sb *in, sb *acc)
 {
   while (idx < in->len
 	 && (in->ptr[idx] == '"'
-	     || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
+	     || (in->ptr[idx] == '<' && (macro_alternate || flag_mri))
 	     || (in->ptr[idx] == '\'' && macro_alternate)))
     {
       if (in->ptr[idx] == '<')
@@ -423,7 +410,7 @@ get_any_string (size_t idx, sb *in, sb *
 	  sb_add_string (out, buf);
 	}
       else if (in->ptr[idx] == '"'
-	       || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
+	       || (in->ptr[idx] == '<' && (macro_alternate || flag_mri))
 	       || (macro_alternate && in->ptr[idx] == '\''))
 	{
 	  if (macro_alternate && ! macro_strip_at && in->ptr[idx] != '<')
@@ -450,7 +437,7 @@ get_any_string (size_t idx, sb *in, sb *
 			 && in->ptr[idx] != '\t'))
 		 && in->ptr[idx] != ','
 		 && (in->ptr[idx] != '<'
-		     || (! macro_alternate && ! macro_mri)))
+		     || (! macro_alternate && ! flag_mri)))
 	    {
 	      char tchar = in->ptr[idx];
 
@@ -553,7 +540,7 @@ do_formals (macro_entry *macro, size_t i
       idx = sb_skip_white (idx, in);
       /* This is a formal.  */
       name = sb_terminate (&formal->name);
-      if (! macro_mri
+      if (! flag_mri
 	  && idx < in->len
 	  && in->ptr[idx] == ':'
 	  && (! is_name_beginner (':')
@@ -625,7 +612,7 @@ do_formals (macro_entry *macro, size_t i
 	}
     }
 
-  if (macro_mri)
+  if (flag_mri)
     {
       formal_entry *formal = new_formal ();
 
@@ -764,7 +751,7 @@ get_apost_token (size_t idx, sb *in, sb
   idx = get_token (idx, in, name);
   if (idx < in->len
       && in->ptr[idx] == kind
-      && (! macro_mri || macro_strip_at)
+      && (! flag_mri || macro_strip_at)
       && (! macro_strip_at || kind == '@'))
     idx++;
   return idx;
@@ -838,7 +825,7 @@ macro_expand_body (sb *in, sb *out, form
       if (in->ptr[src] == '&')
 	{
 	  sb_reset (&t);
-	  if (macro_mri)
+	  if (flag_mri)
 	    {
 	      if (src + 1 < in->len && in->ptr[src + 1] == '&')
 		src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1);
@@ -887,7 +874,7 @@ macro_expand_body (sb *in, sb *out, form
 	      sb_add_char (out, '&');
 	      src++;
 	    }
-	  else if (macro_mri && src < in->len && ISALNUM (in->ptr[src]))
+	  else if (flag_mri && src < in->len && ISALNUM (in->ptr[src]))
 	    {
 	      int ind;
 	      formal_entry *f;
@@ -917,7 +904,7 @@ macro_expand_body (sb *in, sb *out, form
 	      src = sub_actual (src, in, &t, formal_hash, '\'', out, 0);
 	    }
 	}
-      else if ((macro_alternate || macro_mri)
+      else if ((macro_alternate || flag_mri)
 	       && is_name_beginner (in->ptr[src])
 	       && (! inquote
 		   || ! macro_strip_at
@@ -970,7 +957,7 @@ macro_expand_body (sb *in, sb *out, form
 	    }
 	}
       else if (in->ptr[src] == '"'
-	       || (macro_mri && in->ptr[src] == '\''))
+	       || (flag_mri && in->ptr[src] == '\''))
 	{
 	  inquote = !inquote;
 	  sb_add_char (out, in->ptr[src++]);
@@ -985,7 +972,7 @@ macro_expand_body (sb *in, sb *out, form
 	      ++src;
 	    }
 	}
-      else if (macro_mri
+      else if (flag_mri
 	       && in->ptr[src] == '='
 	       && src + 1 < in->len
 	       && in->ptr[src + 1] == '=')
@@ -1070,7 +1057,7 @@ macro_expand (size_t idx, sb *in, macro_
   while (f != NULL && f->index < 0)
     f = f->next;
 
-  if (macro_mri)
+  if (flag_mri)
     {
       /* The macro may be called with an optional qualifier, which may
 	 be referred to in the macro body as \0.  */
@@ -1105,7 +1092,7 @@ macro_expand (size_t idx, sb *in, macro_
       scan = idx;
       while (scan < in->len
 	     && !ISSEP (in->ptr[scan])
-	     && !(macro_mri && in->ptr[scan] == '\'')
+	     && !(flag_mri && in->ptr[scan] == '\'')
 	     && (!macro_alternate && in->ptr[scan] != '='))
 	scan++;
       if (scan < in->len && !macro_alternate && in->ptr[scan] == '=')
@@ -1162,7 +1149,7 @@ macro_expand (size_t idx, sb *in, macro_
 	      formal_entry **pf;
 	      int c;
 
-	      if (!macro_mri)
+	      if (!flag_mri)
 		{
 		  err = _("too many positional arguments");
 		  break;
@@ -1196,7 +1183,7 @@ macro_expand (size_t idx, sb *in, macro_
 	  while (f != NULL && f->index < 0);
 	}
 
-      if (! macro_mri)
+      if (! flag_mri)
 	idx = sb_skip_comma (idx, in);
       else
 	{
@@ -1217,7 +1204,7 @@ macro_expand (size_t idx, sb *in, macro_
 		    m->name);
 	}
 
-      if (macro_mri)
+      if (flag_mri)
 	{
 	  ptr = str_hash_find (m->formal_hash,
 			       macro_strip_at ? "$NARG" : "NARG");
@@ -1233,7 +1220,7 @@ macro_expand (size_t idx, sb *in, macro_
     }
 
   /* Discard any unnamed formal arguments.  */
-  if (macro_mri)
+  if (flag_mri)
     {
       formal_entry **pf;
 
@@ -1271,7 +1258,7 @@ check_macro (const char *line, sb *expan
   sb line_sb;
 
   if (! is_name_beginner (*line)
-      && (! macro_mri || *line != '.'))
+      && (! flag_mri || *line != '.'))
     return 0;
 
   s = line + 1;
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -83,10 +83,9 @@ extern htab_t macro_hash;
 
 extern int buffer_and_nest (const char *, const char *, sb *,
 			    size_t (*) (sb *));
-extern void macro_init (int, int);
+extern void macro_init (int);
 extern void macro_end (void);
 extern void macro_set_alternate (int);
-extern void macro_mri_mode (int);
 extern macro_entry *define_macro (sb *, sb *, size_t (*) (sb *));
 extern int check_macro (const char *, sb *, const char **, macro_entry **);
 extern void delete_macro (const char *);
--- a/gas/read.c
+++ b/gas/read.c
@@ -2746,7 +2746,6 @@ s_mri (int ignore ATTRIBUTE_UNUSED)
 #ifdef TC_M68K
       flag_m68k_mri = 1;
 #endif
-      macro_mri_mode (1);
     }
   else
     {
@@ -2754,7 +2753,6 @@ s_mri (int ignore ATTRIBUTE_UNUSED)
 #ifdef TC_M68K
       flag_m68k_mri = 0;
 #endif
-      macro_mri_mode (0);
     }
 
   /* Operator precedence changes in m68k MRI mode, so we need to


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

* [PATCH 4/4] gas: expose flag_macro_alternate globally
  2023-03-08 16:05 [PATCH 0/4] gas: tidy macro interfacing after removal of gasp Jan Beulich
                   ` (2 preceding siblings ...)
  2023-03-08 16:08 ` [PATCH 3/4] gas: use flag_mri directly in macro processing Jan Beulich
@ 2023-03-08 16:09 ` Jan Beulich
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2023-03-08 16:09 UTC (permalink / raw)
  To: Binutils

Yet again with the removal of gasp about 20 years ago this extra level
of indirection isn't necessary anymore either. Drop macro.c's local
variable and make as.c's global.

While doing the conversion, switch the variable to "bool".

--- a/gas/as.c
+++ b/gas/as.c
@@ -125,8 +125,6 @@ static struct defsym_list *defsyms;
 
 static long start_time;
 
-static int flag_macro_alternate;
-
 \f
 #ifdef USE_EMULATIONS
 #define EMULATION_ENVIRON "AS_EMULATION"
@@ -1307,7 +1305,7 @@ gas_init (void)
   input_scrub_begin ();
   expr_begin ();
 
-  macro_init (flag_macro_alternate);
+  macro_init ();
 
   dwarf2_init ();
 
--- a/gas/as.h
+++ b/gas/as.h
@@ -305,6 +305,9 @@ COMMON int flag_keep_locals; /* -L */
 /* True if we are assembling in MRI mode.  */
 COMMON int flag_mri;
 
+/* True if alternate macro mode is in effect.  */
+COMMON bool flag_macro_alternate;
+
 /* Should the data section be made read-only and appended to the text
    section?  */
 COMMON unsigned char flag_readonly_data_in_text; /* -R */
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -34,7 +34,7 @@
 #define ISSEP(x) \
  ((x) == ' ' || (x) == '\t' || (x) == ',' || (x) == '"' || (x) == ';' \
   || (x) == ')' || (x) == '(' \
-  || ((macro_alternate || flag_mri) && ((x) == '<' || (x) == '>')))
+  || ((flag_macro_alternate || flag_mri) && ((x) == '<' || (x) == '>')))
 
 #define ISBASE(x) \
   ((x) == 'b' || (x) == 'B' \
@@ -50,10 +50,6 @@ htab_t macro_hash;
 
 int macro_defined;
 
-/* Whether we are in alternate syntax mode.  */
-
-static int macro_alternate;
-
 /* Whether we should strip '@' characters.  */
 
 #define macro_strip_at false
@@ -74,12 +70,11 @@ macro_del_f (void *ent)
 /* Initialize macro processing.  */
 
 void
-macro_init (int alternate)
+macro_init (void)
 {
   macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
 				  macro_del_f, notes_calloc, NULL);
   macro_defined = 0;
-  macro_alternate = alternate;
 }
 
 void
@@ -88,14 +83,6 @@ macro_end (void)
   htab_delete (macro_hash);
 }
 
-/* Switch in and out of alternate mode on the fly.  */
-
-void
-macro_set_alternate (int alternate)
-{
-  macro_alternate = alternate;
-}
-
 /* Read input lines till we get to a TO string.
    Increase nesting depth if we get a FROM string.
    Put the results into sb at PTR.
@@ -284,7 +271,7 @@ get_token (size_t idx, sb *in, sb *name)
 	}
     }
   /* Ignore trailing &.  */
-  if (macro_alternate && idx < in->len && in->ptr[idx] == '&')
+  if (flag_macro_alternate && idx < in->len && in->ptr[idx] == '&')
     idx++;
   return idx;
 }
@@ -296,8 +283,8 @@ getstring (size_t idx, sb *in, sb *acc)
 {
   while (idx < in->len
 	 && (in->ptr[idx] == '"'
-	     || (in->ptr[idx] == '<' && (macro_alternate || flag_mri))
-	     || (in->ptr[idx] == '\'' && macro_alternate)))
+	     || (in->ptr[idx] == '<' && (flag_macro_alternate || flag_mri))
+	     || (in->ptr[idx] == '\'' && flag_macro_alternate)))
     {
       if (in->ptr[idx] == '<')
 	{
@@ -336,7 +323,7 @@ getstring (size_t idx, sb *in, sb *acc)
 	      else
 		escaped = 0;
 
-	      if (macro_alternate && in->ptr[idx] == '!')
+	      if (flag_macro_alternate && in->ptr[idx] == '!')
 		{
 		  idx ++;
 
@@ -390,7 +377,7 @@ get_any_string (size_t idx, sb *in, sb *
 	  while (idx < in->len && !ISSEP (in->ptr[idx]))
 	    sb_add_char (out, in->ptr[idx++]);
 	}
-      else if (in->ptr[idx] == '%' && macro_alternate)
+      else if (in->ptr[idx] == '%' && flag_macro_alternate)
 	{
 	  /* Turn the following expression into a string.  */
 	  expressionS ex;
@@ -410,10 +397,10 @@ get_any_string (size_t idx, sb *in, sb *
 	  sb_add_string (out, buf);
 	}
       else if (in->ptr[idx] == '"'
-	       || (in->ptr[idx] == '<' && (macro_alternate || flag_mri))
-	       || (macro_alternate && in->ptr[idx] == '\''))
+	       || (in->ptr[idx] == '<' && (flag_macro_alternate || flag_mri))
+	       || (flag_macro_alternate && in->ptr[idx] == '\''))
 	{
-	  if (macro_alternate && ! macro_strip_at && in->ptr[idx] != '<')
+	  if (flag_macro_alternate && ! macro_strip_at && in->ptr[idx] != '<')
 	    {
 	      /* Keep the quotes.  */
 	      sb_add_char (out, '"');
@@ -437,7 +424,7 @@ get_any_string (size_t idx, sb *in, sb *
 			 && in->ptr[idx] != '\t'))
 		 && in->ptr[idx] != ','
 		 && (in->ptr[idx] != '<'
-		     || (! macro_alternate && ! flag_mri)))
+		     || (! flag_macro_alternate && ! flag_mri)))
 	    {
 	      char tchar = in->ptr[idx];
 
@@ -904,7 +891,7 @@ macro_expand_body (sb *in, sb *out, form
 	      src = sub_actual (src, in, &t, formal_hash, '\'', out, 0);
 	    }
 	}
-      else if ((macro_alternate || flag_mri)
+      else if ((flag_macro_alternate || flag_mri)
 	       && is_name_beginner (in->ptr[src])
 	       && (! inquote
 		   || ! macro_strip_at
@@ -1093,9 +1080,9 @@ macro_expand (size_t idx, sb *in, macro_
       while (scan < in->len
 	     && !ISSEP (in->ptr[scan])
 	     && !(flag_mri && in->ptr[scan] == '\'')
-	     && (!macro_alternate && in->ptr[scan] != '='))
+	     && (!flag_macro_alternate && in->ptr[scan] != '='))
 	scan++;
-      if (scan < in->len && !macro_alternate && in->ptr[scan] == '=')
+      if (scan < in->len && !flag_macro_alternate && in->ptr[scan] == '=')
 	{
 	  is_keyword = 1;
 
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -83,9 +83,8 @@ extern htab_t macro_hash;
 
 extern int buffer_and_nest (const char *, const char *, sb *,
 			    size_t (*) (sb *));
-extern void macro_init (int);
+extern void macro_init (void);
 extern void macro_end (void);
-extern void macro_set_alternate (int);
 extern macro_entry *define_macro (sb *, sb *, size_t (*) (sb *));
 extern int check_macro (const char *, sb *, const char **, macro_entry **);
 extern void delete_macro (const char *);
--- a/gas/read.c
+++ b/gas/read.c
@@ -1578,7 +1578,7 @@ static void
 s_altmacro (int on)
 {
   demand_empty_rest_of_line ();
-  macro_set_alternate (on);
+  flag_macro_alternate = on;
 }
 
 /* Read a symbol name from input_line_pointer.


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

end of thread, other threads:[~2023-03-08 16:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 16:05 [PATCH 0/4] gas: tidy macro interfacing after removal of gasp Jan Beulich
2023-03-08 16:07 ` [PATCH 1/4] gas: drop function pointer parameter from macro_init() Jan Beulich
2023-03-08 16:08 ` [PATCH 2/4] gas: isolate macro_strip_at to macro.c Jan Beulich
2023-03-08 16:08 ` [PATCH 3/4] gas: use flag_mri directly in macro processing Jan Beulich
2023-03-08 16:09 ` [PATCH 4/4] gas: expose flag_macro_alternate globally Jan Beulich

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).