[GASPP,2/2] Handle whitespace being matched as branch condition code

Message ID 1539983272-802-2-git-send-email-martin@martin.st
State New
Headers show
Series
  • [GASPP,1/2] Fix the regexp used for replacing .align
Related show

Commit Message

Martin Storsjö Oct. 19, 2018, 9:07 p.m.
For cases like "b    1b", this is matched as $cond = "  ". This fixes
preprocessing with a preprocessor that preserves multiple spaces as such,
which cl.exe does.
---
 gas-preprocessor.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index b22ee8a..e7a135d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -885,7 +885,7 @@  sub handle_serialized_line {
             my $width = $4;
             my $target = $5;
             # Don't interpret e.g. bic as b<cc> with ic as conditional code
-            if ($cond !~ /^(|$arm_cond_codes)$/) {
+            if ($cond !~ /^(\s*|$arm_cond_codes)$/) {
                 # Not actually a branch
             } elsif ($target =~ /^(\d+)([bf])$/) {
                 # The target is a local label