Recent

Author Topic: [Solved] Variant;marked as inline is not inlined  (Read 2855 times)

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
[Solved] Variant;marked as inline is not inlined
« on: July 14, 2020, 06:50:51 pm »
Is there any way to prevent this Note/Warning from appearing? It's now popping up on all my TDataset.Locate lines. I realize it's merely a warning but it slows down development when I review those Messages.
« Last Edit: July 14, 2020, 07:46:40 pm by bobonwhidbey »
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: Variant;marked as inline is not inlined
« Reply #1 on: July 14, 2020, 07:23:44 pm »
Is there any way to prevent this Note/Warning from appearing?
Code: Pascal  [Select][+][-]
  1. {$MODE OBJFPC}
  2.  
  3. procedure A; forward; inline;
  4.  
  5. {$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
  6. procedure B;
  7. begin
  8.   A;
  9. end;
  10.  
  11. procedure A;
  12. begin
  13. end;
  14.  
  15. begin
  16.   B;
  17. end.

andrevv

  • Newbie
  • Posts: 3
Re: [Solved] Variant;marked as inline is not inlined
« Reply #2 on: July 15, 2020, 01:41:54 pm »
It's not just Locate, but every assignment or parameter arguments with variant type. I have hundreds of warnings now. Maybe something is wrong in variant.inc with this new FPC 3.2.0, or SYSTEMINLINE was not true until now? We'll see...

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: [Solved] Variant;marked as inline is not inlined
« Reply #3 on: July 15, 2020, 02:56:10 pm »
There is nothing wrong, it is a note. handling variants takes just too much code to ever ever be inlined.
IOW it is not a reasonable assumption. (In any language)
« Last Edit: July 15, 2020, 03:04:04 pm by Thaddy »
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: [Solved] Variant;marked as inline is not inlined
« Reply #4 on: July 15, 2020, 03:04:44 pm »
Is there any way to prevent this Note/Warning from appearing? It's now popping up on all my TDataset.Locate lines. I realize it's merely a warning but it slows down development when I review those Messages.

Is it really a fcl-db TDataset? Because TDataset.Locate is not declared inline. Please provide an example (code plus compiler output).

It's not just Locate, but every assignment or parameter arguments with variant type. I have hundreds of warnings now. Maybe something is wrong in variant.inc with this new FPC 3.2.0, or SYSTEMINLINE was not true until now? We'll see...

No, FPC 3.2.0 simply now outputs this information, FPC 3.0.4 did not. It simply did not inline.

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
Re: [Solved] Variant;marked as inline is not inlined
« Reply #5 on: July 15, 2020, 03:27:54 pm »
No - it's NOT a fcl-db TDataset? The Note/Nag appears where Query is a TSQLQuery.

      Query.Locate('ID', trID, []);

 
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: [Solved] Variant;marked as inline is not inlined
« Reply #6 on: July 15, 2020, 04:53:54 pm »
TSQLQuery or any of the descendants till TDataset does not declare Locate as inline either.

So please provide a full example that shows this including the compiler output.

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
Re: [Solved] Variant;marked as inline is not inlined
« Reply #7 on: July 15, 2020, 05:34:11 pm »
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, sqldb;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     procedure FormShow(Sender: TObject);
  16.   private
  17.  
  18.   public
  19.  
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.lfm}
  28.  
  29. { TForm1 }
  30.  
  31. procedure TForm1.FormShow(Sender: TObject);
  32. var
  33.   Q: tSQLQuery;
  34. begin
  35.   Q.Locate('ID', '5', []);
  36. end;
  37.  
  38. end.

This code gives the message:
unit1.pas(35,21) Note: Call to subroutine "operator :=(const source:Char):Variant;" marked as inline is not inlined

Of course this code is not intended to run - just a small example of the "problem".
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: [Solved] Variant;marked as inline is not inlined
« Reply #8 on: July 15, 2020, 06:19:29 pm »
unit1.pas(35,21) Note: Call to subroutine "operator :=(const source:Char):Variant;" marked as inline is not inlined
Of course this code is not intended to run - just a small example of the "problem".
As I said earlier, place at the beginning of the unit or directly at the call point
Code: Pascal  [Select][+][-]
  1. {$WARN 6058 OFF}

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
Re: [Solved] Variant;marked as inline is not inlined
« Reply #9 on: July 15, 2020, 07:02:34 pm »
ASerge, your code works perfectly. I was just including a very simple example which answered the message for PascalDragon
« Last Edit: July 15, 2020, 07:11:07 pm by bobonwhidbey »
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: [Solved] Variant;marked as inline is not inlined
« Reply #10 on: July 15, 2020, 10:18:27 pm »
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, sqldb;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     procedure FormShow(Sender: TObject);
  16.   private
  17.  
  18.   public
  19.  
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.lfm}
  28.  
  29. { TForm1 }
  30.  
  31. procedure TForm1.FormShow(Sender: TObject);
  32. var
  33.   Q: tSQLQuery;
  34. begin
  35.   Q.Locate('ID', '5', []);
  36. end;
  37.  
  38. end.

This code gives the message:
unit1.pas(35,21) Note: Call to subroutine "operator :=(const source:Char):Variant;" marked as inline is not inlined

Of course this code is not intended to run - just a small example of the "problem".

Thank you. So it was the conversion to Variant that is the problem and not the Locate call itself. That's why I need a precise description of the problem.

That said: for 3.2.x you'll have to help yourself with disabling the hint if necessary, because the operator overload uses the VariantManager variable that is declared in the implementation section of the System unit.

For 3.3.1 the compiler can handle such "local" symbols and thus no warning will be generated anymore in this situation plus the compiler will indeed inline the operator overload. ;)

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
Re: [Solved] Variant;marked as inline is not inlined
« Reply #11 on: July 15, 2020, 10:27:25 pm »
I think we're all on the same page with this issue. Philosophically, I think it's a bad idea to ignore compiler notes/warnings/hints. Better to use commands like {$WARN 6058 OFF} and {$H-}...{$H+} to remove them after you've addressed the situation.
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

andrevv

  • Newbie
  • Posts: 3
Re: [Solved] Variant;marked as inline is not inlined
« Reply #12 on: July 16, 2020, 09:49:22 am »
The best solution I found is to right click on the message and press "Hide with project option (-vm6058)". This way I don't have to put it in every unit.

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 591
    • Double Dummy Solver - free download
Re: [Solved] Variant;marked as inline is not inlined
« Reply #13 on: July 16, 2020, 05:39:05 pm »
Excellent idea. ;D I didn't know about right-clicking those messages.
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: [Solved] Variant;marked as inline is not inlined
« Reply #14 on: September 02, 2020, 09:51:33 pm »
I just stumbed accross the same Hint/Warning... and since the issue is solved in the 3.3.1 compiler I'd suggest to disable the warning only in this version:
like
Code: Pascal  [Select][+][-]
  1. {$if FPC_FULLVERSION = 30200 }
  2.     {$WARN 6058 OFF}
  3. {$ENDIF}  
  4.  
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

 

TinyPortal © 2005-2018