---
 gas-preprocessor.pl | 11 ++++++++++-
 test.S              |  6 ++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 16e91ab..6d8e57b 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -221,6 +221,7 @@ if ($ENV{GASPP_DEBUG}) {
 
 my $current_macro = '';
 my $macro_level = 0;
+my $rept_level = 0;
 my %macro_lines;
 my %macro_args;
 my %macro_args_default;
@@ -384,9 +385,17 @@ sub parse_line {
         }
     }
 
+    if ($macro_level == 0) {
+        if ($line =~ /\.(rept|irp)/) {
+            $rept_level++;
+        } elsif ($line =~ /.endr/) {
+            $rept_level--;
+        }
+    }
+
     if ($macro_level > 1) {
         push(@{$macro_lines{$current_macro}}, $line);
-    } elsif (scalar(@rept_lines) and $line !~ /\.endr/) {
+    } elsif (scalar(@rept_lines) and $rept_level >= 1) {
         push(@rept_lines, $line);
     } elsif ($macro_level == 0) {
         expand_macros($line);
diff --git a/test.S b/test.S
index f6ec894..ec0b861 100644
--- a/test.S
+++ b/test.S
@@ -66,3 +66,9 @@ argtest2 1, 2, 3
 argtest2 1 2 3
 argtest1 1 2 3 + 1
 argtest2 1 2 < 1 3
+
+.irpc i, 0123
+    .irpc j, 0123
+        mov r\i, #\j
+    .endr
+.endr
-- 
1.8.5.2 (Apple Git-48)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to