[PATCH] gas: Add a macro test for parenthesis arguments

H.J. Lu hjl.tools@gmail.com
Tue Aug 13 15:09:08 GMT 2024


Since we must support:

	.macro test arg1, arg2
	.byte \arg1
	.byte \arg2
	.endm

	.data
 	test  0x10 + 0, 0x10 + 1

and can't support:

	.macro test arg1, arg2
	.byte \arg1
	.byte \arg2
	.endm

	.data
 	test  (0x10 + 0) (0x10 + 1)

at the same time, add a test for latter.

	PR gas/32073
	* testsuite/gas/macros/arg2.l: New file.
	* testsuite/gas/macros/arg2.s: Likewise.
	* testsuite/gas/macros/macros.exp: Run arg2.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 gas/testsuite/gas/macros/arg2.l     | 4 ++++
 gas/testsuite/gas/macros/arg2.s     | 9 +++++++++
 gas/testsuite/gas/macros/macros.exp | 1 +
 3 files changed, 14 insertions(+)
 create mode 100644 gas/testsuite/gas/macros/arg2.l
 create mode 100644 gas/testsuite/gas/macros/arg2.s

diff --git a/gas/testsuite/gas/macros/arg2.l b/gas/testsuite/gas/macros/arg2.l
new file mode 100644
index 00000000000..3f9dc9398c2
--- /dev/null
+++ b/gas/testsuite/gas/macros/arg2.l
@@ -0,0 +1,4 @@
+.*: Assembler messages:
+.*:4: Error: junk at end of line, first unrecognized character is `\('
+.*:9:  Info: macro invoked from here
+#pass
diff --git a/gas/testsuite/gas/macros/arg2.s b/gas/testsuite/gas/macros/arg2.s
new file mode 100644
index 00000000000..b22a73744be
--- /dev/null
+++ b/gas/testsuite/gas/macros/arg2.s
@@ -0,0 +1,9 @@
+/* Treat parenthesis arguments separated by white spaces as error.  */
+
+	.macro test arg1, arg2
+	.byte \arg1
+	.byte \arg2
+	.endm
+
+	.data
+	test  (0x10 + 0) (0x10 + 1)
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
index 3e84902c65f..8d4ba86936e 100644
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -76,6 +76,7 @@ if { ![istarget tic30-*-*] } {
 }
 
 run_dump_test arg1
+run_list_test arg2 ""
 
 run_list_test badarg ""
 
-- 
2.46.0



More information about the Binutils mailing list