Skip to content

Commit

Permalink
parser-stmt: add missing space between outputs and clobbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mptre committed Aug 6, 2024
1 parent 0057a47 commit 8c56495
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parser-stmt-asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ parser_asm(struct parser *pr, struct doc *dc, struct doc **out)
struct token *qualifier = NULL;
struct token *assembly, *lparen, *rparen;
int ninputs = 0;
int noutputs = 0;
int error;

if (!lexer_peek_if(lx, TOKEN_ASSEMBLY, NULL))
Expand Down Expand Up @@ -213,12 +214,14 @@ parser_asm(struct parser *pr, struct doc *dc, struct doc **out)
parser_doc_token(pr, colon, concat);
concat = doc_indent(2, concat);
while (parser_stmt_asm_operand(pr, concat) & GOOD)
continue;
noutputs++;
}

/* clobbers */
if (lexer_if(lx, TOKEN_COLON, &colon)) {
concat = doc_alloc(DOC_CONCAT, doc_alloc(DOC_GROUP, opt));
if (noutputs > 0)
doc_alloc(DOC_LINE, concat);
parser_doc_token(pr, colon, concat);
if (!lexer_peek_if(lx, TOKEN_RPAREN, NULL))
doc_alloc(DOC_LINE, concat);
Expand Down
9 changes: 9 additions & 0 deletions tests/valid-394.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Inline assembler.
*/

int
main(void)
{
asm("cpuid" : "+c" (c), "+d" (d) : "a" (1), "c" (0) : "ebx");
}

0 comments on commit 8c56495

Please sign in to comment.