Removed extra whitespace at line ends in preprocess-only output (-E).

Increased threshold from 5 to 7 for skipped newlines with #line directives in preprocess-only output (-E).
This commit is contained in:
acqn
2022-08-22 00:27:21 +08:00
parent 79f97e7714
commit 5d5bd472c6

View File

@@ -299,7 +299,7 @@ static void AddPreLine (StrBuf* Str)
return;
}
if (FileChanged || PendingNewLines > 4) {
if (FileChanged || PendingNewLines > 6) {
/* Output #line directives as source info */
StrBuf Comment = AUTO_STRBUF_INITIALIZER;
if (SB_NotEmpty (Str) && SB_LookAtLast (Str) != '\n') {
@@ -933,6 +933,11 @@ static void MacroReplacement (StrBuf* Source, StrBuf* Target, unsigned ModeFlags
}
}
/* Drop whitespace at the end */
if (IsBlank (SB_LookAtLast (Target))) {
SB_Drop (Target, 1);
}
/* Switch back the input */
InitLine (OldSource);
}