Browse Source

+ compiler writes a hint if a subroutine marked as inline cannot be/is not inlined, resolves #31717
+ test

git-svn-id: trunk@38330 -

florian 7 years ago
parent
commit
73aef1402b
6 changed files with 386 additions and 353 deletions
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 347 351
      compiler/msgtxt.inc
  5. 2 0
      compiler/ncal.pas
  6. 29 0
      tests/webtbf/tw31717.pp

+ 1 - 0
.gitattributes

@@ -14350,6 +14350,7 @@ tests/webtbf/tw3126.pp svneol=native#text/plain
 tests/webtbf/tw31273.pp svneol=native#text/plain
 tests/webtbf/tw31273.pp svneol=native#text/plain
 tests/webtbf/tw3145.pp svneol=native#text/plain
 tests/webtbf/tw3145.pp svneol=native#text/plain
 tests/webtbf/tw31465.pp svneol=native#text/pascal
 tests/webtbf/tw31465.pp svneol=native#text/pascal
+tests/webtbf/tw31717.pp svneol=native#text/pascal
 tests/webtbf/tw3183.pp svneol=native#text/plain
 tests/webtbf/tw3183.pp svneol=native#text/plain
 tests/webtbf/tw3186.pp svneol=native#text/plain
 tests/webtbf/tw3186.pp svneol=native#text/plain
 tests/webtbf/tw31936.pp svneol=native#text/pascal
 tests/webtbf/tw31936.pp svneol=native#text/pascal

+ 4 - 0
compiler/msg/errore.msg

@@ -2481,6 +2481,10 @@ cg_e_function_not_support_by_selected_instruction_set=06056_E_The function used,
 cg_f_max_units_reached=06057_F_Maximum number of units ($1) reached for the current target
 cg_f_max_units_reached=06057_F_Maximum number of units ($1) reached for the current target
 % Depending of target architecture, the number of units is limited. This limit
 % Depending of target architecture, the number of units is limited. This limit
 % has been reached. A unit counts only if it contains initialization or finalization count.
 % has been reached. A unit counts only if it contains initialization or finalization count.
+cg_h_no_inline=06058_H_Call to subroutine "$1" marked as inline is not inlined
+% The directive inline is only a hint to the compiler. Sometimes the compiler ignores this hint, a subroutine
+% marked as inline is not inlined. In this case, this hint is given. Compiling with \var{-vd} might result in more information why
+% the directive inline is ignored.
 %
 %
 % \end{description}
 % \end{description}
 # EndOfTeX
 # EndOfTeX

+ 3 - 2
compiler/msgidx.inc

@@ -689,6 +689,7 @@ const
   cg_d_autoinlining=06055;
   cg_d_autoinlining=06055;
   cg_e_function_not_support_by_selected_instruction_set=06056;
   cg_e_function_not_support_by_selected_instruction_set=06056;
   cg_f_max_units_reached=06057;
   cg_f_max_units_reached=06057;
+  cg_h_no_inline=06058;
   asmr_d_start_reading=07000;
   asmr_d_start_reading=07000;
   asmr_d_finish_reading=07001;
   asmr_d_finish_reading=07001;
   asmr_e_none_label_contain_at=07002;
   asmr_e_none_label_contain_at=07002;
@@ -1094,9 +1095,9 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 81312;
+  MsgTxtSize = 81376;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
-    27,106,347,126,96,58,139,33,221,67,
+    27,106,347,126,96,59,139,33,221,67,
     61,20,30,1,1,1,1,1,1,1
     61,20,30,1,1,1,1,1,1,1
   );
   );

File diff suppressed because it is too large
+ 347 - 351
compiler/msgtxt.inc


+ 2 - 0
compiler/ncal.pas

@@ -4356,6 +4356,8 @@ implementation
              result:=pass1_inline
              result:=pass1_inline
            else
            else
              begin
              begin
+               if po_inline in procdefinition.procoptions then
+                 Message1(cg_h_no_inline,current_procinfo.procdef.fullprocname(false));
                mark_unregable_parameters;
                mark_unregable_parameters;
                result:=pass1_normal;
                result:=pass1_normal;
              end;
              end;

+ 29 - 0
tests/webtbf/tw31717.pp

@@ -0,0 +1,29 @@
+{ %fail }
+{ %OPT=-vh -Seh }
+{$mode objfpc}
+program Project1;
+
+type
+
+ TObj = Class
+
+  procedure proc1;
+  procedure proc2; inline;
+
+ End;
+
+procedure TObj.proc1;
+begin
+ proc2;
+end;
+
+procedure TObj.proc2;
+begin
+  writeln('2');
+end;
+
+begin
+
+ tobj.create.proc1;
+
+end.

Some files were not shown because too many files changed in this diff