Commit: Move irp macro count test into a separate file

Message ID 8734qif35u.fsf@redhat.com
State New
Headers
Series Commit: Move irp macro count test into a separate file |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged

Commit Message

Nick Clifton May 16, 2024, 10:43 a.m. UTC
  Hi Guys,

  I am applying the attached patch to move the recent addition of tests
  of the \+ assembler psuedo-variable inside .irp and .irpc pseudos into
  their own separate file.  This is because there a couple of problems
  with this test:

  The first is that the assembler source will trigger an error message
  ("bad escaped character in string") on targets that define
  ONLY_STANDARD_ESCAPES.

  The second problem is weird.  On AIX targets the "\+" regexp in the
  listing file does not match the "\+" in the output file.  Instead an
  extended regexp is needed (ie "\\\+").  But this extended regexp does
  not work for any other target.  I have no idea why the AIX targets are
  special, but I have marked them as XFAIL for this particular test.

Cheers
  Nick
  

Comments

Andreas Schwab May 16, 2024, 11:17 a.m. UTC | #1
On Mai 16 2024, Nick Clifton wrote:

>   The second problem is weird.  On AIX targets the "\+" regexp in the
>   listing file does not match the "\+" in the output file.  Instead an
>   extended regexp is needed (ie "\\\+").  But this extended regexp does
>   not work for any other target.

On the other targets, print "\+" produces "+", not "\+".
  
Andreas Schwab May 16, 2024, 11:27 a.m. UTC | #2
On Mai 16 2024, Nick Clifton wrote:

>   The second problem is weird.  On AIX targets the "\+" regexp in the
>   listing file does not match the "\+" in the output file.  Instead an
>   extended regexp is needed (ie "\\\+").  But this extended regexp does
>   not work for any other target.  I have no idea why the AIX targets are
>   special, but I have marked them as XFAIL for this particular test.

ppc-aix defines TC_STRING_ESCAPES to 0, thus does not interpret
backslashes in strings.
  
Nick Clifton May 16, 2024, 11:38 a.m. UTC | #3
Hi Andreas,

>>    The second problem is weird.  On AIX targets the "\+" regexp in the
>>    listing file does not match the "\+" in the output file.  Instead an
>>    extended regexp is needed (ie "\\\+").  But this extended regexp does
>>    not work for any other target.  I have no idea why the AIX targets are
>>    special, but I have marked them as XFAIL for this particular test.
> 
> ppc-aix defines TC_STRING_ESCAPES to 0, thus does not interpret
> backslashes in strings.

Ah!  Thanks for the explanation.

Cheers
   Nick
  

Patch

diff --git a/gas/testsuite/gas/macros/count.l b/gas/testsuite/gas/macros/count.l
index ca666ea0195..dc4951dd699 100644
--- a/gas/testsuite/gas/macros/count.l
+++ b/gas/testsuite/gas/macros/count.l
@@ -1,3 +1,4 @@ 
+#...
 0
 0
 1
@@ -8,5 +9,3 @@ 
 1
 4
 2
-\+
-\+
diff --git a/gas/testsuite/gas/macros/count.s b/gas/testsuite/gas/macros/count.s
index 4a5b078ba60..c752ca8367d 100644
--- a/gas/testsuite/gas/macros/count.s
+++ b/gas/testsuite/gas/macros/count.s
@@ -17,10 +17,3 @@ 
 
 	mac1 2
 	mac2 3
-
-	.irp i,1
-	.print "\+"
-	.endr
-	.irpc i,1
-	.print "\+"
-	.endr
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
index 3108f3fcd56..ed08e75d543 100644
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -103,3 +103,9 @@  gas_test_error "exit.s" "" ".exitm outside of a macro"
 
 run_list_test altmacro
 run_list_test count
+
+# The AVR, CRIS, MSP430 and Z80 targets define ONLY_STANDARD_ESCAPES,
+#  so \+ is rejected.
+# AIX targets need an extended regexp to match "\+".
+setup_xfail "avr-*-*" "cris*-*-*" "msp430-*-*" "z80-*-*" "*-*-aix*"
+run_list_test irp-count
--- /dev/null	2024-05-16 07:41:38.219079632 +0100
+++ current/gas/testsuite/gas/macros/irp-count.d	2024-05-16 10:42:39.334037535 +0100
@@ -0,0 +1,2 @@ 
+#name: Macro counters inside IRP commands (irp-count.d)
+# Tests that \+ does not trip up IRP commands
--- /dev/null	2024-05-16 07:41:38.219079632 +0100
+++ current/gas/testsuite/gas/macros/irp-count.s	2024-05-16 10:42:57.140062184 +0100
@@ -0,0 +1,7 @@ 
+	.irp i,1
+	.print "\+"
+	.endr
+	
+	.irpc i,1
+	.print "\+"
+	.endr
--- /dev/null	2024-05-16 07:41:38.219079632 +0100
+++ current/gas/testsuite/gas/macros/irp-count.l	2024-05-16 10:43:26.784102912 +0100
@@ -0,0 +1,3 @@ 
+#...
+\+
+\+