[1/7] gas: don't open-code LEX_*NAME

Message ID 3da25acd-6e35-4ba6-b570-ef9b2034233b@suse.com
State New
Headers
Series gas: whitespace handling |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich Aug. 9, 2024, 12:51 p.m. UTC
  ... except in read.c's definition of lex_type[], where readbility would
otherwise suffer.
---
read.c:read_begin()'s overriding of '?' is suspicious: flag_mri can
change later on, so shouldn't lex_type[] also be updated at such points,
if it is relevant in this mode to permit '?' in symbol names? Otherwise
can the override be dropped?
  

Comments

Alan Modra Aug. 13, 2024, 5:49 a.m. UTC | #1
On Fri, Aug 09, 2024 at 02:51:18PM +0200, Jan Beulich wrote:
> ... except in read.c's definition of lex_type[], where readbility would
> otherwise suffer.
> ---
> read.c:read_begin()'s overriding of '?' is suspicious: flag_mri can
> change later on, so shouldn't lex_type[] also be updated at such points,

Probably.  Commit 1356d77df3 in 1995 introduced the lex_type change,
commit 20710f1c0c in 1996 added the .mri directive.

> if it is relevant in this mode to permit '?' in symbol names? Otherwise
> can the override be dropped?
  

Patch

--- a/gas/config/tc-bfin.h
+++ b/gas/config/tc-bfin.h
@@ -44,7 +44,7 @@  extern bool bfin_start_label (char *);
 #define md_convert_frag(b,s,f)	as_fatal ("bfin convert_frag\n");
 
 /* Allow for [, ], etc.  */
-#define LEX_BR 6
+#define LEX_BR (LEX_BEGIN_NAME | LEX_END_NAME)
 
 #define TC_EOL_IN_INSN(PTR) (bfin_eol_in_insn(PTR) ? 1 : 0)
 extern bool bfin_eol_in_insn (char *);
--- a/gas/config/tc-dlx.h
+++ b/gas/config/tc-dlx.h
@@ -29,7 +29,7 @@ 
 
 #define WORKING_DOT_WORD
 
-#define LEX_DOLLAR 1
+#define LEX_DOLLAR LEX_NAME
 
 #include "bit_fix.h"
 
--- a/gas/config/tc-msp430.h
+++ b/gas/config/tc-msp430.h
@@ -99,7 +99,7 @@ 
 
 /* Support symbols like: C$$IO$$.  */
 #undef  LEX_DOLLAR
-#define LEX_DOLLAR 1
+#define LEX_DOLLAR LEX_NAME
 
 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 0
 /*   An `.lcomm' directive with no explicit alignment parameter will
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -149,7 +149,7 @@  struct ppc_tc_sy
 #define OBJ_COFF_MAX_AUXENTRIES 4
 
 /* Square and curly brackets are permitted in symbol names.  */
-#define LEX_BR 3
+#define LEX_BR (LEX_BEGIN_NAME | LEX_NAME)
 
 /* Canonicalize the symbol name.  */
 #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
--- a/gas/config/te-interix.h
+++ b/gas/config/te-interix.h
@@ -19,8 +19,8 @@ 
 
 #define TE_PE_DYN /* PE with dynamic linking (UNIX shared lib) support */
 #define TE_PE
-#define LEX_AT 1 /* can have @'s inside labels */
-#define LEX_QM 3 /* can have ?'s in or begin labels */
+#define LEX_AT LEX_NAME /* can have @'s inside labels */
+#define LEX_QM (LEX_BEGIN_NAME | LEX_NAME) /* can have ?'s in or begin labels */
 
 /* The PE format supports long section names.  */
 #define COFF_LONG_SECTION_NAMES
--- a/gas/read.c
+++ b/gas/read.c
@@ -285,7 +285,8 @@  read_begin (void)
   /* Use more.  FIXME-SOMEDAY.  */
 
   if (flag_mri)
-    lex_type['?'] = 3;
+    lex_type['?'] = LEX_BEGIN_NAME | LEX_NAME;
+
   stabs_begin ();
 
 #ifndef WORKING_DOT_WORD