Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-06

Codetools in distress

11 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

Hi all,

Am I the only one who has problems with the codetools? Seems like it can not handle out-parameters in functions anymore.

like this: (variants.pp)

function VarIsError(const V: Variant; out AResult: HRESULT): Boolean;

But there are many others in the RTL and FCL.

Or is it a local issue?

Regards,

Joost,

Reply by email

Ondrej Pokorny
to Joost van der Sluis
Joost van der Sluis wrote
Am I the only one who has problems with the codetools? Seems like it can not handle out-parameters in functions anymore.

What CT function is not working in particular?

I tested with:

program CTTest1;
uses
   SysUtils, Classes;
function VarIsError(const V: Variant; out AResult: HRESULT): Boolean;
begin
end;
begin
   x := VarIsError(v, s);
end.

and everything seems to be OK to me.

Or is your problem that CT cannot resolve what overload to use:
function VarIsError(const V: Variant; out AResult: HRESULT): Boolean;
function VarIsError(const V: Variant): Boolean; inline;

AFAIK CT have always had this issue to find correct overloads, so no regression here. (At least Lazarus 1.4.2 has the issue as well.)

Ondrej

Reply by email

Joost van der Sluis
to Ondrej Pokorny
Ondrej Pokorny wrote 23 lines
On 13.06.2017 15:21, Joost van der Sluis via Lazarus wrote: > Am I the only one who has problems with the codetools? Seems like it > can not handle out-parameters in functions anymore. What CT function is not working in particular? I tested with: program CTTest1; uses SysUtils, Classes; function VarIsError(const V: Variant; out AResult: HRESULT): Boolean; begin end; begin x := VarIsError(v, s); end. and everything seems to be OK to me.

That one works for me also. Now when I add Variants to the uses, nothing works anymore. (Try identifier-completion in VarIsError -> move cursor to VarIs -> ctrl-space)
Same happens when you add contnrs to the uses-section.

Do you also have that problem?

Regards,

Joost.

Reply by email

Ondrej Pokorny
to Joost van der Sluis
Joost van der Sluis wrote 6 lines
Now when I add Variants to the uses, nothing works anymore. (Try identifier-completion in VarIsError -> move cursor to VarIs -> ctrl-space) Same happens when you add contnrs to the uses-section. Do you also have that problem?

Works fine for me:

I am on current Lazarus trunk with FPC trunk r36463.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170613/c2710907/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: engcoadccedimplm.png
Type: image/png
Size: 8248 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170613/c2710907/attachment.png>

Reply by email

Joost van der Sluis
to Ondrej Pokorny
Ondrej Pokorny wrote 11 lines
On 13.06.2017 16:03, Joost van der Sluis via Lazarus wrote: > Now when I add Variants to the uses, nothing works anymore. (Try > identifier-completion in VarIsError -> move cursor to VarIs -> > ctrl-space) > Same happens when you add contnrs to the uses-section. > > Do you also have that problem? Works fine for me: I am on current Lazarus trunk with FPC trunk r36463.

I don't get it. I have the same issue on two different systems. Both Lazarus- and FPC-trunk. For at least a week already...

This is what I see on the console:

Hint: [TFPCSourceCache.Update] /home/CNOC/joost/svn/fpc-trunk has changed. ApplyFPCSrcFiles BuildBoss.RescanCompilerDefines ... TFPCSrcScan.OnFilesGathered closing progress item ... TFPCSrcScan.OnFilesGathered END
### TCodeToolManager.HandleException: [20170421195425] "expected :, but AResult found" at Line=111 Col=43 in
"/home/CNOC/joost/svn/fpc-trunk/packages/rtl-objpas/src/inc/variants.pp" ### TCodeToolManager.HandleException: [20170421195348] "expected end., but AResult found" at Line=111 Col=43 in
"/home/CNOC/joost/svn/fpc-trunk/packages/rtl-objpas/src/inc/variants.pp" ### TCodeToolManager.HandleException: [20170421195348] "expected end., but AResult found" at Line=111 Col=43 in
"/home/CNOC/joost/svn/fpc-trunk/packages/rtl-objpas/src/inc/variants.pp"

etc etc

Any idea where to look?

Regards,

Joost.

Reply by email

Joost van der Sluis
to Joost van der Sluis

Op 13-06-17 om 19:08 schreef Joost van der Sluis via Lazarus:

Show quoted text 7 lines
On 06/13/2017 04:07 PM, Ondrej Pokorny via Lazarus wrote: ### TCodeToolManager.HandleException: [20170421195425] "expected :, but AResult found" at Line=111 Col=43 in "/home/CNOC/joost/svn/fpc-trunk/packages/rtl-objpas/src/inc/variants.pp" Any idea where to look?

Seems like Lazarus has a compilermode-flag cmsOut, to indicate that a compiler supports out-parameters. This flag is not set.

At a closer look, the variants.pp unit starts with:

{$IFDEF FPC}
{$MODE objfpc}
{$H+}
{$ENDIF}

But when showed in Lazarus, {$MODE objfpc} is grayed out. So Lazarus does not detect that FPC is defined...

In the defines-editor, I do see the FPC-define, but I don't see any value. Is that normal?

Any clue why 'fpc' is not defined according to the codetools?

Regards,

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis: Op 13-06-17 om 19:08 schreef Joost van der Sluis via Lazarus: Seems like Lazarus has a…
Show quoted text 11 lines
Op 13-06-17 om 19:08 schreef Joost van der Sluis via Lazarus: > On 06/13/2017 04:07 PM, Ondrej Pokorny via Lazarus wrote: > ### TCodeToolManager.HandleException: [20170421195425] "expected :, but > AResult found" at Line=111 Col=43 in > "/home/CNOC/joost/svn/fpc-trunk/packages/rtl-objpas/src/inc/variants.pp" > Any idea where to look? Seems like Lazarus has a compilermode-flag cmsOut, to indicate that a compiler supports out-parameters.

This corresponds to the {$modeswitch out}.

Show quoted text 14 lines
This flag is not set. At a closer look, the variants.pp unit starts with: {$IFDEF FPC} {$MODE objfpc} {$H+} {$ENDIF} But when showed in Lazarus, {$MODE objfpc} is grayed out. So Lazarus does not detect that FPC is defined... In the defines-editor, I do see the FPC-define, but I don't see any value. Is that normal?

No. The macro FPC comes from reading the compiler output. Try main menu
Tools / Rescan FPC Source Directory
to reread the compiler output.

Any clue why 'fpc' is not defined according to the codetools?

Open unit variants in source editor.
Main menu / Source / Unit information / Show Codetools defines In "Values" you should see a lot of defines, like VER3_1_1 and FPC.

Mattias

Reply by email

Joost van der Sluis
to Mattias Gaertner

Op 14-06-17 om 10:09 schreef Mattias Gaertner via Lazarus:

Show quoted text 18 lines
On Tue, 13 Jun 2017 23:05:03 +0200 > > But when showed in Lazarus, {$MODE objfpc} is grayed out. So Lazarus > does not detect that FPC is defined... > > In the defines-editor, I do see the FPC-define, but I don't see any > value. Is that normal? No. The macro FPC comes from reading the compiler output. Try main menu Tools / Rescan FPC Source Directory to reread the compiler output. > Any clue why 'fpc' is not defined according to the codetools? Open unit variants in source editor. Main menu / Source / Unit information / Show Codetools defines In "Values" you should see a lot of defines, like VER3_1_1 and FPC.

Fixed, not in Lazarus, but fpc.

Why is it, that when I (working mostly on fpc) discover Lazarus-bugs, they almost always appear to be fpc-issues?

One would thing I should be able to recognize and handle fpc-bugs... ;)

Regards,

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 5 lines
[...] Fixed, not in Lazarus, but fpc. Why is it, that when I (working mostly on fpc) discover Lazarus-bugs, they almost always appear to be fpc-issues?

Lazarus is a good test suite for fpc.

One would thing I should be able to recognize and handle fpc-bugs... ;)

May I ask what the bug was?

Mattias

Reply by email

Joost van der Sluis
to Mattias Gaertner

Op 14-06-17 om 10:29 schreef Mattias Gaertner via Lazarus:

Show quoted text 15 lines
On Wed, 14 Jun 2017 10:22:48 +0200 Joost van der Sluis via Lazarus wrote: > [...] > Fixed, not in Lazarus, but fpc. > > Why is it, that when I (working mostly on fpc) discover Lazarus-bugs, > they almost always appear to be fpc-issues? Lazarus is a good test suite for fpc. > One would thing I should be able to recognize and handle fpc-bugs... ;) May I ask what the bug was?

It's fixed in r36498 by Nikolay. It was a bug in the widestring-handling which was already there, but was hidden and got exposed by a recent change in the codepage-handling.

As a result #0-characters were added to fpc's output. Lazarus' parser got confused by that. (It uses pchar's, which considered the #0 characters the end of a line)

Regards,

Joost.

Reply by email