Browse Source

* made safecall working, handling not consistent yet though

git-svn-id: trunk@3418 -
florian 19 years ago
parent
commit
a5dfe315ec
2 changed files with 22 additions and 16 deletions
  1. 21 15
      compiler/i386/cpupara.pas
  2. 1 1
      compiler/pdecsub.pas

+ 21 - 15
compiler/i386/cpupara.pas

@@ -99,25 +99,31 @@ unit cpupara;
         case target_info.system of
           system_i386_win32 :
             begin
-              case def.deftype of
-                recorddef :
-                  begin
-                    { Win32 GCC returns small records in the FUNCTION_RETURN_REG.
-                      For stdcall we follow delphi instead of GCC }
-                    if (calloption in [pocall_cdecl,pocall_cppdecl]) and
-                       (def.size>0) and
-                       (def.size<=8) then
-                     begin
-                       result:=false;
-                       exit;
-                     end;
-                  end;
-              end;
+              if calloption=pocall_safecall then
+                begin
+                  result:=true;
+                  exit;
+                end
+              else
+                case def.deftype of
+                  recorddef :
+                    begin
+                      { Win32 GCC returns small records in the FUNCTION_RETURN_REG.
+                        For stdcall we follow delphi instead of GCC }
+                      if (calloption in [pocall_cdecl,pocall_cppdecl]) and
+                         (def.size>0) and
+                         (def.size<=8) then
+                       begin
+                         result:=false;
+                         exit;
+                       end;
+                    end;
+                end;
             end;
           system_i386_darwin :
             begin
               case def.deftype of
-                recorddef : 
+                recorddef :
                   begin
                     size := def.size;
                     if (size > 0) and

+ 1 - 1
compiler/pdecsub.pas

@@ -101,7 +101,7 @@ implementation
             akttokenpos:=tprocdef(pd).fileinfo;
 
            { For left to right add it at the end to be delphi compatible }
-           if pd.proccalloption in pushleftright_pocalls then
+           if pd.proccalloption in (pushleftright_pocalls+[pocall_safecall])  then
              paranr:=paranr_result_leftright
            else
              paranr:=paranr_result;