Skip to content

Commit

Permalink
allow a comma between macro name and first macro parameter
Browse files Browse the repository at this point in the history
Both gas and llvm's integrated assembler accept it.
  • Loading branch information
Janne Grunau committed Aug 12, 2014
1 parent 6bbbfbe commit 72887b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gas-preprocessor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ sub parse_line {
} elsif ($macro_level == 0) {
expand_macros($line);
} else {
if ($line =~ /\.macro\s+([\d\w\.]+)\s*(.*)/) {
if ($line =~ /\.macro\s+([\d\w\.]+)\s*,?\s*(.*)/) {
$current_macro = $1;

# commas in the argument list are optional, so only use whitespace as the separator
Expand Down
9 changes: 9 additions & 0 deletions test.S
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ m 0
mov r1, #\second
mov r1, #\third
.endm
# test for comma between macro name and first parameter
.macro argtest3, first, second, third
mov r0, #\first
mov r0, #\second
mov r0, #\third
.endm

argtest1 1, 2, 3
argtest1 1 2 3
argtest2 1, 2, 3
argtest2 1 2 3
argtest1 1 2 3 + 1
argtest2 1 2 < 1 3
argtest3 1, 2, 3
argtest3 1 2 3
argtest3 1 2 6 / 2

.irpc i, 0123
.irpc j, 0123
Expand Down

0 comments on commit 72887b9

Please sign in to comment.