Found a bug in macro expansion that wasn't triggered in the bootstrap process

This commit is contained in:
Jeremiah Orians 2016-10-02 15:48:47 -04:00
parent 6383c9a5a0
commit bf6347d365
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
2 changed files with 13 additions and 1 deletions

View File

@ -159,7 +159,14 @@ void identify_macros(struct Token* p)
{ {
p->type = macro; p->type = macro;
p->Text = p->next->Text; p->Text = p->next->Text;
p->Expression = p->next->next->Text; if(p->next->next->type & str)
{
p->Expression = p->next->next->Text + 1;
}
else
{
p->Expression = p->next->next->Text;
}
p->next = p->next->next->next; p->next = p->next->next->next;
} }

View File

@ -327,6 +327,7 @@
PUSHR R0 R15 PUSHR R0 R15
PUSHR R1 R15 PUSHR R1 R15
PUSHR R2 R15 PUSHR R2 R15
PUSHR R3 R15
;; Main Loop ;; Main Loop
:Identify_Macros_0 :Identify_Macros_0
@ -350,6 +351,9 @@
;; Set p->Expression = p->next->next->Text ;; Set p->Expression = p->next->next->Text
LOAD32 R2 R2 0 ; Get Next->Next LOAD32 R2 R2 0 ; Get Next->Next
LOAD32 R0 R2 8 ; Get Next->Next->Text LOAD32 R0 R2 8 ; Get Next->Next->Text
LOAD32 R3 R2 4 ; Get Next->Next->type
CMPSKIP.NE R3 2 ; If node is a string
ADDUI R0 R0 1 ; Skip first char
STORE32 R0 R1 12 ; Set Expression = Next->Next->Text STORE32 R0 R1 12 ; Set Expression = Next->Next->Text
;; Set p->Next = p->Next->Next->Next ;; Set p->Next = p->Next->Next->Next
@ -366,6 +370,7 @@
:Identify_Macros_Done :Identify_Macros_Done
;; Restore registers ;; Restore registers
POPR R3 R15
POPR R2 R15 POPR R2 R15
POPR R1 R15 POPR R1 R15
POPR R0 R15 POPR R0 R15