[fpc-pascal] fcl-passrc errors

Michael Van Canneyt michael at freepascal.org
Sun Oct 13 12:18:42 CEST 2019



On Sun, 13 Oct 2019, Sven Barth via fpc-pascal wrote:

>>> Could the missing ".inc" be the problem? I have not checked, but it 
>>> could
>>> be that FPC always adds ".inc" if no extension is present.
>>
>> Well spotted. I didn't notice that the extension was missing.
>>
>> That will definitely not be done in fcl-passrc.

To be clear:

here I meant that 'currently that will definitely not be done in fcl-passrc.'

>> I was not aware FPC does this either. It's not documented, that's for 
>> sure:
>>
>> https://www.freepascal.org/docs-html/current/prog/progsu40.html
>>
>> Delphi also does not look for .inc files, I checked. It only adds 
>> extension
>> .pas
>>
>> So, conclusion: FPC is way too lenient. ;-)
>
> This is how FPC looks for an include file:
>
> === code begin ===
>
>            { try to find the file }
>            found:=findincludefile(path,name,foundfile);
>            if (not found) and (ExtractFileExt(name)='') then
>             begin
>               { try default extensions .inc , .pp and .pas }
>               if (not found) then
> found:=findincludefile(path,ChangeFileExt(name,'.inc'),foundfile);
>               if (not found) then
> found:=findincludefile(path,ChangeFileExt(name,sourceext),foundfile);
>               if (not found) then
> found:=findincludefile(path,ChangeFileExt(name,pasext),foundfile);

Thanks, I will adapt the mechanism in pas2js.

Michael.


More information about the fpc-pascal mailing list