Explorar el Código

Merge branch source:main into main

Curtis Hamilton hace 1 mes
padre
commit
7dff9ad3bd

+ 1 - 1
compiler/pmodules.pas

@@ -732,7 +732,7 @@ implementation
             if pu.in_uses and
             if pu.in_uses and
                (pu.in_interface=frominterface) then
                (pu.in_interface=frominterface) then
              begin
              begin
-               if (lu.state in [ms_processed, ms_compiled,ms_compiling_waitimpl]) then
+               if (lu.state in [ms_compiling_waitimpl..ms_compiled,ms_processed]) then
                  isLoaded:=true
                  isLoaded:=true
                else if (lu.state=ms_registered) then
                else if (lu.state=ms_registered) then
                   // try to load
                   // try to load

+ 1 - 1
compiler/symconst.pas

@@ -714,7 +714,7 @@ type
     sto_has_operator,     { contains at least one operator overload }
     sto_has_operator,     { contains at least one operator overload }
     sto_needs_init_final, { the symtable needs initialization and/or
     sto_needs_init_final, { the symtable needs initialization and/or
                             finalization of variables/constants }
                             finalization of variables/constants }
-    sto_has_non_trivial_init { contains at least on managed type that is not
+    sto_has_non_trivial_init { contains at least one managed type that is not
                                initialized to zero (e.g. a record with management
                                initialized to zero (e.g. a record with management
                                operators }
                                operators }
   );
   );

+ 2 - 0
packages/fcl-passrc/src/pastree.pp

@@ -823,7 +823,9 @@ type
   public
   public
     VariantEl: TPasElement; // nil or TPasVariable or TPasType
     VariantEl: TPasElement; // nil or TPasVariable or TPasType
     Variants: TFPList;	// list of TPasVariant elements, may be nil!
     Variants: TFPList;	// list of TPasVariant elements, may be nil!
+    Align : Integer;
     Function IsAdvancedRecord : Boolean;
     Function IsAdvancedRecord : Boolean;
+
   end;
   end;
 
 
   TPasObjKind = (
   TPasObjKind = (

+ 13 - 0
packages/fcl-passrc/src/pparser.pp

@@ -4814,6 +4814,11 @@ begin
                         (msAdvancedRecords in Scanner.CurrentModeSwitches)
                         (msAdvancedRecords in Scanner.CurrentModeSwitches)
                         and not (Parent is TProcedureBody)
                         and not (Parent is TProcedureBody)
                         and (RecordEl.Name<>''));
                         and (RecordEl.Name<>''));
+       NextToken;
+       if CurTokenIsIdentifier('align') then
+         // ParseRecordAlign
+       else
+         UngetToken;
        CheckHint(RecordEl,True);
        CheckHint(RecordEl,True);
        Engine.FinishScope(stTypeDef,RecordEl);
        Engine.FinishScope(stTypeDef,RecordEl);
        end;
        end;
@@ -7306,6 +7311,14 @@ begin
                  and not (Parent is TProcedureBody)
                  and not (Parent is TProcedureBody)
                  and (Result.Name<>'');
                  and (Result.Name<>'');
   ParseRecordMembers(Result,tkEnd,AllowAdvanced);
   ParseRecordMembers(Result,tkEnd,AllowAdvanced);
+  NextToken;
+  if CurTokenIsIdentifier('align') then
+    begin
+    ExpectToken(tkNumber);
+    Result.Align:=StrToInt(CurtokenString);
+    end
+  else
+    UngetToken;
   Engine.FinishScope(stTypeDef,Result);
   Engine.FinishScope(stTypeDef,Result);
 end;
 end;
 
 

+ 16 - 0
packages/fcl-passrc/tests/tctypeparser.pas

@@ -377,6 +377,7 @@ type
     Procedure TestAdvRecordClassOperator;
     Procedure TestAdvRecordClassOperator;
     Procedure TestAdvRecordInitOperator;
     Procedure TestAdvRecordInitOperator;
     Procedure TestAdvRecordGenericFunction;
     Procedure TestAdvRecordGenericFunction;
+    Procedure TestRecordAlign;
   end;
   end;
 
 
   { TTestProcedureTypeParser }
   { TTestProcedureTypeParser }
@@ -2816,6 +2817,21 @@ begin
   ParseModule;   // We're just interested in that it parses.
   ParseModule;   // We're just interested in that it parses.
 end;
 end;
 
 
+procedure TTestRecordTypeParser.TestRecordAlign;
+Const
+   SRC =
+    'program afile;'+sLineBreak+
+    'type'+sLineBreak+
+    '  TMyRecord = record'+sLineBreak+
+    '    x  : integer;'+sLineBreak+
+    '  end align 16;'+sLineBreak+
+    'begin'+sLineBreak+
+    'end.';
+begin
+  Source.Text:=Src;
+  ParseModule;   // We're just interested in that it parses.
+end;
+
 { TBaseTestTypeParser }
 { TBaseTestTypeParser }
 
 
 Function TBaseTestTypeParser.ParseType(ASource: String; ATypeClass: TClass;
 Function TBaseTestTypeParser.ParseType(ASource: String; ATypeClass: TClass;

+ 0 - 2
tests/test/cg/tcalext7.pp

@@ -1,5 +1,3 @@
-{ %CPU=x86_64 }
-{ %TARGET=linux }
 
 
 program tcalext7;
 program tcalext7;