Signed-off-by: Michael Buesch <mb@bu3sch.de>
ad->u.start = label;
$$ = ad;
}
- | ASM_ASSERT assertion {
+ | asm_assert {
+ $$ = NULL;
+ }
+ ;
+
+asm_assert : ASM_ASSERT assertion {
unsigned int ok = (unsigned int)(unsigned long)$2;
if (!ok)
assembler_assertion_failed();
| PAREN_OPEN complex_imm PAREN_CLOSE {
$$ = $2;
}
+ | PAREN_OPEN asm_assert PAREN_CLOSE {
+ /* Inline assertion. Always return zero */
+ $$ = (void *)(unsigned long)(unsigned int)0;
+ }
| PAREN_OPEN BITW_NOT complex_imm PAREN_CLOSE {
unsigned long n = (unsigned long)$3;
n = ~n;
^{WS}*"%"{WS}*arch { update_lineinfo(); return ASM_ARCH; }
^{WS}*"%"{WS}*start { update_lineinfo(); return ASM_START; }
-^{WS}*"%"{WS}*assert { update_lineinfo(); return ASM_ASSERT; }
+"%"{WS}*assert { update_lineinfo(); return ASM_ASSERT; }
^{WS}*\.text{WS}*$ { update_lineinfo(); return SECTION_TEXT; }
^{WS}*\.initvals/\({IDENTIFIER}\) { update_lineinfo(); return SECTION_IVALS; }
.text
+ /* Inline assertion inside of a complex immediate.
+ * The %assert() expression will always return zero. */
+ mov (1 + (%assert(1 == ((1 + 2) - 2)))), r0
+
label:
/* ADD instructions */
add r0,r1,r2 /* add */