Browse Source

* give warning for disabling inline if assembler
is detected

git-svn-id: trunk@10473 -

peter 17 years ago
parent
commit
beb01e6e79
2 changed files with 37 additions and 42 deletions
  1. 1 33
      compiler/pdecsub.pas
  2. 36 9
      compiler/psub.pas

+ 1 - 33
compiler/pdecsub.pas

@@ -347,31 +347,6 @@ implementation
       end;
       end;
 
 
 
 
-    procedure check_inline_para(p:TObject;arg:pointer);
-      var
-        pd : tabstractprocdef absolute arg;
-      begin
-        if not(po_inline in pd.procoptions) or
-           (tsym(p).typ<>paravarsym) then
-         exit;
-        with tparavarsym(p) do
-         begin
-           case vardef.typ of
-             arraydef :
-               begin
-                 if is_array_constructor(vardef) or
-                    is_variant_array(vardef) then
-                   begin
-                     Message1(parser_w_not_supported_for_inline,'array of const');
-                     Message(parser_w_inlining_disabled);
-                     pd.proccalloption:=pocall_default;
-                   end;
-               end;
-           end;
-         end;
-      end;
-
-
     procedure set_addr_param_regable(p:TObject;arg:pointer);
     procedure set_addr_param_regable(p:TObject;arg:pointer);
       begin
       begin
         if (tsym(p).typ<>paravarsym) then
         if (tsym(p).typ<>paravarsym) then
@@ -1207,13 +1182,6 @@ begin
 end;
 end;
 
 
 
 
-procedure pd_inline(pd:tabstractprocdef);
-begin
-  { Check if there are parameters that can't be inlined }
-  pd.parast.SymList.ForEachCall(@check_inline_para,pd);
-end;
-
-
 procedure pd_internconst(pd:tabstractprocdef);
 procedure pd_internconst(pd:tabstractprocdef);
 
 
 var v:Tconstexprint;
 var v:Tconstexprint;
@@ -1779,7 +1747,7 @@ const
     ),(
     ),(
       idtok:_INLINE;
       idtok:_INLINE;
       pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
       pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
-      handler  : @pd_inline;
+      handler  : nil;
       pocall   : pocall_none;
       pocall   : pocall_none;
       pooption : [po_inline];
       pooption : [po_inline];
       mutexclpocall : [];
       mutexclpocall : [];

+ 36 - 9
compiler/psub.pas

@@ -1219,18 +1219,45 @@ implementation
       begin
       begin
         result := false;
         result := false;
         if (pi_has_assembler_block in current_procinfo.flags) then
         if (pi_has_assembler_block in current_procinfo.flags) then
-          exit;
+          begin
+            Message1(parser_w_not_supported_for_inline,'assembler');
+            Message(parser_w_inlining_disabled);
+            exit;
+          end;
         for i:=0 to procdef.paras.count-1 do
         for i:=0 to procdef.paras.count-1 do
           begin
           begin
             currpara:=tparavarsym(procdef.paras[i]);
             currpara:=tparavarsym(procdef.paras[i]);
-            { we can't handle formaldefs and special arrays (the latter may need a    }
-            { re-basing of the index, i.e. if you pass an array[1..10] as open array, }
-            { you have to add 1 to all index operations if you directly inline it     }
-            if ((currpara.varspez in [vs_out,vs_var,vs_const]) and
-                (currpara.vardef.typ=formaldef)) or
-               is_special_array(currpara.vardef)  then
-              exit;
-          end;
+            case currpara.vardef.typ of
+              formaldef :
+                begin
+                  if (currpara.varspez in [vs_out,vs_var,vs_const]) then
+                    begin
+                            Message1(parser_w_not_supported_for_inline,'formal parameter');
+                            Message(parser_w_inlining_disabled);
+                            exit;
+                    end;
+                end;
+              arraydef :
+                      begin
+                        if is_array_constructor(currpara.vardef) or
+                           is_variant_array(currpara.vardef) then
+                          begin
+                            Message1(parser_w_not_supported_for_inline,'array of const');
+                            Message(parser_w_inlining_disabled);
+                            exit;
+                    end;
+                  { open arrays might need re-basing of the index, i.e. if you pass
+                    an array[1..10] as open array, you have to add 1 to all index operations
+                    if you directly inline it }
+                  if is_open_array(currpara.vardef) then
+                    begin
+                            Message1(parser_w_not_supported_for_inline,'open array');
+                            Message(parser_w_inlining_disabled);
+                            exit;
+                    end;
+                      end;
+                  end;
+                end;
         result:=true;
         result:=true;
       end;
       end;