From e5c7aebb3ff3673d2e17a724b9d693ff867d1a81 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Thu, 6 Apr 2023 18:52:45 -0500 Subject: [PATCH] Avoid spurious undefined variable errors for functions returning structs/unions. When the lint check for undefined variables was enabled, a "lint: unused variable: @struct" would be produced for any function returning a struct or union, due to the special static variable that is created to hold the return value. That spurious lint message is now suppressed. --- Symbol.pas | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Symbol.pas b/Symbol.pas index ef8583b..9f2d471 100644 --- a/Symbol.pas +++ b/Symbol.pas @@ -489,11 +489,13 @@ if not tPtr^.isEmpty or not tPtr^.noStatics then if not (ip^.itype^.kind in [functionType,enumConst]) then if ip^.storage = private then if copy(ip^.name^,1,staticNumLen) = tPtr^.staticNum then - begin - new(nameStr); - nameStr^ := copy(ip^.name^, staticNumLen+1, maxint); - ErrorWithExtraString(185, nameStr); - end; {if} + if not (ip^.name^[staticNumLen+1] in ['~','@']) then + begin + new(nameStr); + nameStr^ := + copy(ip^.name^, staticNumLen+1, maxint); + ErrorWithExtraString(185, nameStr); + end; {if} ip := ip^.next; end; {while} end; {if}