From 5d5bd472c637d8ec5304e1b152e2930abd8e3399 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 22 Aug 2022 00:27:21 +0800 Subject: [PATCH] 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). --- src/cc65/preproc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cc65/preproc.c b/src/cc65/preproc.c index 855d59844..76a625f53 100644 --- a/src/cc65/preproc.c +++ b/src/cc65/preproc.c @@ -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); }