2
0
peter 22 жил өмнө
parent
commit
0a8bddc756

+ 17 - 7
compiler/pdecsub.pas

@@ -1573,13 +1573,14 @@ const
       { set calling convention }
       { set calling convention }
         if proc_direcdata[p].pocall<>pocall_none then
         if proc_direcdata[p].pocall<>pocall_none then
          begin
          begin
-           if pd.proccalloption<>pocall_none then
+           if (po_hascallingconvention in pd.procoptions) then
             begin
             begin
               Message2(parser_w_proc_overriding_calling,
               Message2(parser_w_proc_overriding_calling,
                 proccalloptionStr[pd.proccalloption],
                 proccalloptionStr[pd.proccalloption],
                 proccalloptionStr[proc_direcdata[p].pocall]);
                 proccalloptionStr[proc_direcdata[p].pocall]);
             end;
             end;
            pd.proccalloption:=proc_direcdata[p].pocall;
            pd.proccalloption:=proc_direcdata[p].pocall;
+           include(pd.procoptions,po_hascallingconvention);
          end;
          end;
 
 
         { check if method and directive not for object, like public.
         { check if method and directive not for object, like public.
@@ -1640,9 +1641,15 @@ const
 
 
     procedure handle_calling_convention(pd:tabstractprocdef);
     procedure handle_calling_convention(pd:tabstractprocdef);
       begin
       begin
-        { set the default calling convention }
-        if pd.proccalloption=pocall_none then
-          pd.proccalloption:=aktdefproccall;
+        { set the default calling convention if none provided }
+        if not(po_hascallingconvention in pd.procoptions) then
+          pd.proccalloption:=aktdefproccall
+        else
+          begin
+            if pd.proccalloption=pocall_none then
+              internalerror(200309081);
+          end;
+
         { handle proccall specific settings }
         { handle proccall specific settings }
         case pd.proccalloption of
         case pd.proccalloption of
           pocall_cdecl :
           pocall_cdecl :
@@ -1970,10 +1977,10 @@ const
                         part }
                         part }
                       if (m_delphi in aktmodeswitches) then
                       if (m_delphi in aktmodeswitches) then
                        begin
                        begin
-                         if (pd.proccalloption=pocall_none) then
+                         if not(po_hascallingconvention in pd.procoptions) then
                           pd.proccalloption:=hd.proccalloption
                           pd.proccalloption:=hd.proccalloption
                          else
                          else
-                          if (hd.proccalloption=pocall_none) then
+                          if not(po_hascallingconvention in hd.procoptions) then
                            hd.proccalloption:=pd.proccalloption
                            hd.proccalloption:=pd.proccalloption
                          else
                          else
                           begin
                           begin
@@ -2141,7 +2148,10 @@ const
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.131  2003-09-07 22:09:35  peter
+  Revision 1.132  2003-09-09 15:54:10  peter
+    * calling convention fix
+
+  Revision 1.131  2003/09/07 22:09:35  peter
     * preparations for different default calling conventions
     * preparations for different default calling conventions
     * various RA fixes
     * various RA fixes
 
 

+ 6 - 2
compiler/symconst.pas

@@ -201,7 +201,8 @@ type
     po_varargs,           { printf like arguments }
     po_varargs,           { printf like arguments }
     po_internconst,       { procedure has constant evaluator intern }
     po_internconst,       { procedure has constant evaluator intern }
     po_addressonly,       { flag that only the address of a method is returned and not a full methodpointer }
     po_addressonly,       { flag that only the address of a method is returned and not a full methodpointer }
-    po_public             { procedure is exported }
+    po_public,            { procedure is exported }
+    po_hascallingconvention { calling convention is specified explicitly }
   );
   );
   tprocoptions=set of tprocoption;
   tprocoptions=set of tprocoption;
 
 
@@ -372,7 +373,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.61  2003-09-07 22:09:35  peter
+  Revision 1.62  2003-09-09 15:54:10  peter
+    * calling convention fix
+
+  Revision 1.61  2003/09/07 22:09:35  peter
     * preparations for different default calling conventions
     * preparations for different default calling conventions
     * various RA fixes
     * various RA fixes