tidy mri script extern

Message ID YRZx5cxAXB9uVstk@squeak.grove.modra.org
State New
Headers show
Series
  • tidy mri script extern
Related show

Commit Message

Cooper Qu via Binutils Aug. 13, 2021, 1:21 p.m.
MRI mode generally doesn't flip lexer states, so let's make MRI mode
"extern" not do so either.

	* ldgram.y (extern_name_list): Don't change lex state here.
	(ifile_p1): Change state here on EXTERN instead.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/ldgram.y b/ld/ldgram.y
index 794cf284a7b..24979deebbe 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -280,18 +280,12 @@  casesymlist:
 	| casesymlist ',' NAME
 	;
 
-/* Parsed as expressions so that commas separate entries */
 extern_name_list:
-	{ ldlex_expression (); }
-	extern_name_list_body
-	{ ldlex_popstate (); }
-
-extern_name_list_body:
-	  NAME
+	NAME
 			{ ldlang_add_undef ($1, false); }
-	| extern_name_list_body NAME
+	| extern_name_list NAME
 			{ ldlang_add_undef ($2, false); }
-	| extern_name_list_body ',' NAME
+	| extern_name_list ',' NAME
 			{ ldlang_add_undef ($3, false); }
 	;
 
@@ -355,7 +349,8 @@  ifile_p1:
 		{
 		  lang_add_nocrossref_to ($3);
 		}
-	|	EXTERN '(' extern_name_list ')'
+	|	EXTERN '(' { ldlex_expression (); } extern_name_list ')'
+			{ ldlex_popstate (); }
 	|	INSERT_K AFTER NAME
 		{ lang_add_insert ($3, 0); }
 	|	INSERT_K BEFORE NAME