From d1bbc99e4815cc1d70dbd9fa475150b8f0940613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sun, 5 Sep 2021 14:09:04 +0200 Subject: [PATCH] * Pass all directives through OnDirective --- packages/fcl-passrc/src/pscanner.pp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/fcl-passrc/src/pscanner.pp b/packages/fcl-passrc/src/pscanner.pp index 256179387e..31be4873a9 100644 --- a/packages/fcl-passrc/src/pscanner.pp +++ b/packages/fcl-passrc/src/pscanner.pp @@ -4388,7 +4388,7 @@ function TPascalScanner.HandleDirective(const ADirectiveText: String): TToken; Var Directive,Param : String; P : Integer; - Handled: Boolean; + IsFlowControl,Handled: Boolean; procedure DoBoolDirective(bs: TBoolSwitch); begin @@ -4416,7 +4416,8 @@ begin {$IFDEF VerbosePasDirectiveEval} Writeln('TPascalScanner.HandleDirective.Directive: "',Directive,'", Param : "',Param,'"'); {$ENDIF} - + Handled:=true; + IsFlowControl:=True; Case UpperCase(Directive) of 'IFDEF': HandleIFDEF(Param); @@ -4440,7 +4441,7 @@ begin HandleENDIF(Param); else if PPIsSkipping then exit; - + IsFlowControl:=False; Handled:=false; if (length(Directive)=2) and (Directive[1] in ['a'..'z','A'..'Z']) @@ -4540,13 +4541,12 @@ begin Handled:=false; end; end; - - DoHandleDirective(Self,Directive,Param,Handled); - if (not Handled) then - if LogEvent(sleDirective) then - DoLog(mtWarning,nWarnIllegalCompilerDirectiveX,sWarnIllegalCompilerDirectiveX, - [Directive]); end; + DoHandleDirective(Self,Directive,Param,Handled); + if not (Handled or IsFlowControl) then // in case of flowcontrol, it is definitely handled + if LogEvent(sleDirective) then + DoLog(mtWarning,nWarnIllegalCompilerDirectiveX,sWarnIllegalCompilerDirectiveX, + [Directive]); end; function TPascalScanner.HandleLetterDirective(Letter: char; Enable: boolean): TToken;