Skip to content

Commit

Permalink
Fixes Issue 6717 - Better diagnostic on wrong ASM end token.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrejMitrovic committed Feb 9, 2013
1 parent 86d758c commit e8b789b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/iasm.c
Expand Up @@ -103,7 +103,7 @@ const char *asmerrmsgs[] =
"align %d must be a power of 2",
"opcode expected, not %s",
"prefix",
"end of instruction",
"end of instruction expected, not '%s'",
"bad operand",
"bad integral operand",
"identifier expected",
Expand Down Expand Up @@ -4843,7 +4843,18 @@ Statement *AsmStatement::semantic(Scope *sc)
o1 = o2 = o3 = NULL;

if (tok_value != TOKeof)
asmerr(EM_eol); // end of line expected
{
try
{
asmerr(EM_eol, asmtok->toChars()); // end of line expected
}
catch (ASM_STATE *a)
{
asmtok = NULL;
tok_value = TOKeof;
exit(EXIT_FAILURE);
}
}
//return asmstate.bReturnax;
return this;
}
Expand Down
14 changes: 14 additions & 0 deletions test/fail_compilation/diag6717.d
@@ -0,0 +1,14 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag6717.d(12): Error: end of instruction expected, not 'h'
---
*/

void main()
{
asm
{
mov AX, 12h ;
}
}

0 comments on commit e8b789b

Please sign in to comment.