* * *

Author Topic: [SOLVED] Hint: "inherited" not yet supported inside inline procedure/function  (Read 1485 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
I've seen an "Hint: "inherited" not yet supported inside inline procedure/function" which is a very good one... but there's a problem, it doesn't point to any line of code or even to a corresponding unit. Is there any way to find the source line? Because the code is huge (over 20k lines) and I have an extensive use of inline/inherited logic...
« Last Edit: October 28, 2017, 07:22:19 am by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #1 on: August 03, 2017, 06:09:42 pm »
Compile with lineinfo.
Anyway: it is a hint. The logic of combining inline with inherited will not work. The compiler will NOT inline the code. At the moment it is useless but it may work in a future version.
Note that the code will work, just not inlined...
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #2 on: August 03, 2017, 06:16:34 pm »
Quote
Note that the code will work, just not inlined...
Yes, that's the problem. I inline only time-critical code. If it won't work inlined I'd better copy the whole "inherited" part than experience a FramesPerSecond drop.
Well... on the other hand it doesn't look very important (and the speed drop won't be critical anyway), so I'll find them eventually. Just with a point to specific lines of code it'd be faster and easier :)
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #3 on: August 05, 2017, 12:55:16 pm »
I've scanned all my code and... didn't found a single issue where inline is mixed with inherited (or virtual mehtods)...
What could that mean? What did I do wrong?
Maybe I've forgotten to specify inline twice? Where should it be specified for methods - both in class declaration in interface and in implementation, right?

Couldn't reproduce it on a "Clean" case - with any combination of "inline" statements / inheritance.
« Last Edit: August 05, 2017, 01:03:13 pm by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #4 on: August 05, 2017, 02:14:13 pm »
rtl-generics is a package that anticipates it and generates the hints... Not the only one in a trunk compile, btw...
You do not use it on a single line. It manifests itself when an inlined overridden method calls inherited in the body.
E.g:
Code: Pascal  [Select]
  1.    procedure TSomeClass.SomeMethod(const something:integer);inline;override;
  2.    begin
  3.       inherited SomeMethod(something);
  4.       DoSomethingExtra;
  5.   end;
Even if inherited and current SomeMethod are  very simple, the compiler can not resolve this yet and inline the whole of it. Hence (yet) in the hint. But the code works.
« Last Edit: August 05, 2017, 02:26:01 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #5 on: August 05, 2017, 02:25:34 pm »
procedure TSomeClass.SomeMethod(const something:integer);inline;override;
I'll double check that again, but I'm 100% sure there are no such occasions in the code...
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #6 on: August 05, 2017, 02:26:58 pm »
Then you are wrong.... Maybe YOUR code, but not a full FPC built...
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #7 on: August 05, 2017, 02:29:50 pm »
Maybe YOUR code, but not a full FPC built...
Or CastleGameEngine I extensively use... But for that reason it'd be very nice to know the lines where the hint is issued :)
I'll try to figure it out... or give up until some future... :)
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #8 on: August 05, 2017, 02:31:23 pm »
You will get the lines if you use lineinfo... You should know that. -glh
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #9 on: August 05, 2017, 10:09:51 pm »
Emmm... I'm using -gl, I can't find -glh in documentation / project options... did you mean -gl and -gh together? They're both on and display line numbers for other errors/hints/warnings and heap trace with line numbers perfectly.
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #10 on: August 05, 2017, 10:19:04 pm »
Maybe, something wrong with my Lazarus installation? It stopped showing ALL hints and warnings (even user-defined) at all after I've manually added -glh option to compiler (even after I removed it)... Even if I "build clean"...
« Last Edit: August 05, 2017, 10:23:01 pm by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Eugene Loza

  • Hero Member
  • *****
  • Posts: 531
    • My "almost daily" development blog
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #11 on: August 07, 2017, 02:21:04 pm »
Found the source of disappeared hints/warnings. For some reason they load only after I start editing the project (when the first delay before the suggestion passes), i.e. some part of IDE is not initialized at start-up (bug?).
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #12 on: August 07, 2017, 03:26:07 pm »
Emmm... I'm using -gl, I can't find -glh in documentation / project options... did you mean -gl and -gh together? They're both on and display line numbers for other errors/hints/warnings and heap trace with line numbers perfectly.
-glh is allowed: the -g option allows to specify its options in one go. -gl -gh means the same as -glh. There are many more compiler options that can  use this short notation, like -vwhiq or -XXc
This is also documented.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Thaddy

  • Hero Member
  • *****
  • Posts: 4805
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #13 on: August 07, 2017, 03:28:09 pm »
Found the source of disappeared hints/warnings. For some reason they load only after I start editing the project (when the first delay before the suggestion passes), i.e. some part of IDE is not initialized at start-up (bug?).

No it is not a bug: only when you really edit, the sourcecode gets parsed for validity.

Note you can get rid of the buggers by adding {$WARN 3123 OFF}{$WARN 3124 OFF} at the top of your *.lpr file (or main program.pas)
« Last Edit: August 07, 2017, 04:49:41 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

michalis

  • Jr. Member
  • **
  • Posts: 88
    • Homepage
Re: Hint: "inherited" not yet supported inside inline procedure/function
« Reply #14 on: August 21, 2017, 04:44:18 pm »
Three random remarks:

1. Note that the new CastleVectors API from Castle Game Engine uses "inline" for many methods. Are you sure that it's not the fault of my CastleVectors?

2. As Thaddy writes, inlining virtual methods doesn't work. Virtual methods are called through a pointer, the idea is that the compiler doesn't know (at compilation time) what is the actual code being executed. So, it also cannot inline the method.

  Note that the "Whole Program Optimization" can analyze the code and perform "devirtualisation", when possible. See the documentation on http://wiki.freepascal.org/Whole_Program_Optimization . Although I never tested it, and I have no idea whether the "devirtualization" is done early enough to allow inlining to work. But, *in theory*, it could enable inlining of (some) of the cases when you use virtual methods.

  (But it will only affect the cases when the analysis can prove that your virtual method call is actually always calling only the one possible method implementation. Which may not be helpful at all in your case.)

3. I don't think that "-gl" has any effect on the hints you see *when compiling*. At least it's not documented like that (documentation says "-gl" does "Use line info unit (show more info with backtraces)"). And I never observed it.

  The -gl does the same thing as adding the LineInfo unit at the beginning of the uses clause of your program. So it allows you to see the line information (e.g. in backtraces) at runtime, but I *think* it has no effect on the information you see at compile time. If you can show me an example when the "-gl" changes what you see at compile-time, I would happily be corrected :)
« Last Edit: August 21, 2017, 04:51:15 pm by michalis »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus