View Issue Details

IDProjectCategoryView StatusLast Update
0036181FPCFCLpublic2019-10-19 16:08
ReporterRyan JosephAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0036181: fcl-passrc {$include} directive always requires file extension.
DescriptionFPC will attempt to resolve include files by adding common file extensions like .inc but fcl-passrc does not.

===============

// Error even though settings.inc is in the search path
{$i settings}

From the compiler source:

=== 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);
            end;

=== code end ===
Steps To ReproduceRun test.pas on the bug file and include settings.inc in the same directory.
TagsNo tags attached.
Fixed in Revision43227
FPCOldBugId
FPCTarget3.2.0
Attached Files
  • bug_3.pas (39 bytes)
    {$i settings}
    
    program bugs;
    begin
    end.
    bug_3.pas (39 bytes)
  • settings.inc (14 bytes)
    { empty file }
    settings.inc (14 bytes)
  • test.pas (1,041 bytes)
    {$mode objfpc}
    {$H+}
    
    program test;
    uses
      PasTree, PParser;
    
    type
      TSimpleEngine = class(TPasTreeContainer)
      public
        function CreateElement(AClass: TPTreeElement; const AName: String; AParent: TPasElement; AVisibility: TPasMemberVisibility; const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement; override;
        function FindElement(const AName: String): TPasElement; override;
       end;
    
    function TSimpleEngine.FindElement(const AName: String): TPasElement;
    begin
      result := nil;
    end;
    
    function TSimpleEngine.CreateElement(AClass: TPTreeElement; const AName: String; AParent: TPasElement; AVisibility: TPasMemberVisibility; const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
    begin
      result := AClass.Create(AName, AParent);
      result.Visibility := AVisibility;
      result.SourceFilename := ASourceFilename;
      result.SourceLinenumber := ASourceLinenumber;
    end;
    
    var
      engine: TSimpleEngine;
    begin
      engine := TSimpleEngine.Create;
      ParseSource(engine, '-Mobjfpc bug_3.pas', 'darwin', 'x86_64'); 
    end.
    test.pas (1,041 bytes)

Activities

Ryan Joseph

2019-10-14 16:35

reporter  

bug_3.pas (39 bytes)
{$i settings}

program bugs;
begin
end.
bug_3.pas (39 bytes)

Ryan Joseph

2019-10-14 16:37

reporter  

settings.inc (14 bytes)
{ empty file }
settings.inc (14 bytes)
test.pas (1,041 bytes)
{$mode objfpc}
{$H+}

program test;
uses
  PasTree, PParser;

type
  TSimpleEngine = class(TPasTreeContainer)
  public
    function CreateElement(AClass: TPTreeElement; const AName: String; AParent: TPasElement; AVisibility: TPasMemberVisibility; const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement; override;
    function FindElement(const AName: String): TPasElement; override;
   end;

function TSimpleEngine.FindElement(const AName: String): TPasElement;
begin
  result := nil;
end;

function TSimpleEngine.CreateElement(AClass: TPTreeElement; const AName: String; AParent: TPasElement; AVisibility: TPasMemberVisibility; const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
begin
  result := AClass.Create(AName, AParent);
  result.Visibility := AVisibility;
  result.SourceFilename := ASourceFilename;
  result.SourceLinenumber := ASourceLinenumber;
end;

var
  engine: TSimpleEngine;
begin
  engine := TSimpleEngine.Create;
  ParseSource(engine, '-Mobjfpc bug_3.pas', 'darwin', 'x86_64'); 
end.
test.pas (1,041 bytes)

Michael Van Canneyt

2019-10-19 15:12

administrator   ~0118694

Fixed. Please test and close if OK.

Ryan Joseph

2019-10-19 16:08

reporter   ~0118696

fixed, thanks Michael.

Issue History

Date Modified Username Field Change
2019-10-14 16:35 Ryan Joseph New Issue
2019-10-14 16:35 Ryan Joseph File Added: bug_3.pas
2019-10-14 16:37 Ryan Joseph File Added: settings.inc
2019-10-14 16:37 Ryan Joseph File Added: test.pas
2019-10-19 15:12 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-10-19 15:12 Michael Van Canneyt Status new => resolved
2019-10-19 15:12 Michael Van Canneyt Resolution open => fixed
2019-10-19 15:12 Michael Van Canneyt Fixed in Version => 3.3.1
2019-10-19 15:12 Michael Van Canneyt Fixed in Revision => 43227
2019-10-19 15:12 Michael Van Canneyt FPCTarget => 3.2.0
2019-10-19 15:12 Michael Van Canneyt Note Added: 0118694
2019-10-19 16:08 Ryan Joseph Status resolved => closed
2019-10-19 16:08 Ryan Joseph Note Added: 0118696