mirror of
https://github.com/cc65/cc65.git
synced 2025-02-07 20:30:49 +00:00
Despite not technically needed, it seems to be desirable to remove all trailing whitespace from inline assembly
This commit is contained in:
parent
6096a24f1d
commit
d371046ae4
@ -4921,5 +4921,25 @@ void g_switch (Collection* Nodes, unsigned DefaultLabel, unsigned Depth)
|
||||
void g_asmcode (struct StrBuf* B)
|
||||
/* Output one line of assembler code. */
|
||||
{
|
||||
AddCodeLine ("%.*s", (int) SB_GetLen (B), SB_GetConstBuf (B));
|
||||
int len = (int) SB_GetLen(B);
|
||||
const char *buf = SB_GetConstBuf(B);
|
||||
|
||||
/* remove whitespace at end of line */
|
||||
/* NOTE: This masks problems in ParseInsn(), which in some cases seems to
|
||||
rely on no whitespace being present at the end of a line in generated
|
||||
code (see issue #1252). However, it generally seems to be a good
|
||||
idea to remove trailing whitespace from (inline) assembly, so we
|
||||
do it anyway. */
|
||||
while (len) {
|
||||
switch (buf[len - 1]) {
|
||||
case '\n':
|
||||
case ' ':
|
||||
case '\t':
|
||||
--len;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
AddCodeLine ("%.*s", len, buf);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user