Sign in Join

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

Mailing lists / lazarus / 2012-09

range check errors in LCL packages

22 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Schnell

There was a discussion in "Custom Drawn" that seemingly should be handled here.

-Michael

Earlier message 23 lines
-------- Original Message -------- Subject: Re: [Customdrawn] Some patches for dialogs and palette Date: Wed, 12 Sep 2012 14:33:31 +0100 From: Graeme Geldenhuys To: On 12/09/12 14:22, Michael Schnell wrote: > > Thus it would be great if the "powers" would be inclined to activate Please raise this issue in the general Lazarus mailing list. I agree, that range checking should be enabled by default, and only disabled when "release builds" are made by developers. Really enabling Range Checking options in the LCL packages means that a LCL project can't even be run. This is VERY BAD. Regards, - Graeme -

Reply by email

Mattias Gaertner
to Michael Schnell
There was a discussion in "Custom Drawn" that seemingly should be handled here.

AFAIK many developers add range checking to the IDE build options so many lazarus packages, including the LCL, are tested with range checks.

Mattias

Reply by email

Michael Schnell
to Mattias Gaertner
Mattias Gaertner wrote 5 lines
AFAIK many developers add range checking to the IDE build options so many lazarus packages, including the LCL, are tested with range checks.

I found that ~/.fpc.cfg seems to acknowledge a "DEBUG" preset and activates several checks when this is found.

Is it possible to do this in the IDE for testing packages ?

-Michael

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Wed, 12 Sep 2012 15:56:19 +0200 AFAIK many developers add range checking to the IDE…
Mattias Gaertner wrote
AFAIK many developers add range checking to the IDE build options so many lazarus packages, including the LCL, are tested with range checks.

Fine, but various widgetsets have many compiler errors if -CRrt is enabled. Surely these must be fixed, and enabling -CRrt by default will prevent such missages/bugs in future.

eg: Try to compile LCL-GTK2 with -CRrt enabled.

/home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are not related

LCL-CustomDrawn compiles, but all apps give Segmentation haven't tested LCL-Win32 or LCL-Qt yet.

Regards,
- Graeme -

Reply by email

Martin
to Graeme Geldenhuys
Graeme Geldenhuys wrote 11 lines
eg: Try to compile LCL-GTK2 with -CRrt enabled. /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are not related LCL-CustomDrawn compiles, but all apps give Segmentation Faults at runtime.

-CR

does not work by design. The LCL interfaces use classes that intentionally need those typecasts... (not sure if all of them, but certainly some of them)

The details are from before my time, so don't ask me for the details.

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: Fine, but various widgetsets have many compiler errors if -CRrt is enabled. Surely these…
Show quoted text 8 lines
On 12/09/12 14:59, Mattias Gaertner wrote: > > AFAIK many developers add range checking to the IDE build options so > many lazarus packages, including the LCL, are tested with range > checks. Fine, but various widgetsets have many compiler errors if -CRrt is enabled.

Compiler or runtime errors?
Can you point me to the bug reports?

Surely these must be fixed, and enabling -CRrt by default will prevent such missages/bugs in future.

AFAIK -CT is not supported by the LCL.

Show quoted text 6 lines
eg: Try to compile LCL-GTK2 with -CRrt enabled. /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are not related

That's the old style class helper. Not usable with -CT.

LCL-CustomDrawn compiles, but all apps give Segmentation Felipe's answers on custom drawn mailing list. I haven't tested LCL-Win32 or LCL-Qt yet.

Mattias

Reply by email

Mattias Gaertner
to Michael Schnell: I found that ~/.fpc.cfg seems to acknowledge a "DEBUG" preset and activates several…
Show quoted text 10 lines
On 09/12/2012 03:59 PM, Mattias Gaertner wrote: > > AFAIK many developers add range checking to the IDE build options so > many lazarus packages, including the LCL, are tested with range > checks. > I found that ~/.fpc.cfg seems to acknowledge a "DEBUG" preset and activates several checks when this is found. Is it possible to do this in the IDE for testing packages ?

Add -dDEBUG to the IDE build options.

Mattias

Reply by email

Michael Schnell
to Mattias Gaertner
Mattias Gaertner wrote
Add -dDEBUG to the IDE build options.

That sounds easy, but is it really true ?

I understand that the package files are only compiled when necessary. So at least those that are related to a widget type that the IDE itself does not run on, are only compiled with the project, even though they are not compiled when building the IDE (I suppose that is when the "IDE build options" are used), nor seem the compiling of the packages be influenced by the project options (as they are not "project source files". )

-Michael

Reply by email

Sven Barth
to Mattias Gaertner: On Wed, 12 Sep 2012 16:02:40 +0100 Compiler or runtime errors? Can you point me to the…
Mattias Gaertner wrote 8 lines
> eg: Try to compile LCL-GTK2 with -CRrt enabled. > > > /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) > Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are > not related That's the old style class helper. Not usable with -CT.

Since Lazarus requires 2.6.0 anyway one could change that to use normal class helpers:

type
   TWinControlHelper = class helper for TWinControl
     function GetWinControlFlags: TWinControlFlags; inline; // I hope
inline works in that case, if not one might consider it as a bug and
report it :)
   end;
function TWinControlHelper.GetWinControlFlags: TWinControlFlags;
begin
   Result := FWinControlFlags;
end;

And then where TWinControlAccess was used:

if not (wcfInitializing in ABitBtn.GetWinControlFlags) and BuildNeeded then
   ...

Note: The code was not tested, but it *should* work.

Regards,
Sven

Reply by email

Mattias Gaertner
to Michael Schnell: That sounds easy, but is it really true ? I understand that the package files are only…

Michael Schnell hat am 13. September 2012 um 09:50 geschrieben:

Show quoted text 10 lines
On 09/12/2012 11:38 PM, Mattias Gaertner wrote: > Add -dDEBUG to the IDE build options. That sounds easy, but is it really true ? I understand that the package files are only compiled when necessary. So at least those that are related to a widget type that the IDE itself does not run on, are only compiled with the project, even though they are not compiled when building the IDE (I suppose that is when the "IDE build options" are used), nor seem the compiling of the packages be influenced by the project options (as they are not "project source files". )

The IDE build options are available via the IDE macro $(IDEBuildOptions). Many packages add this to their custom options. These options are always used - no matter if the package compilation was triggered by the the project or by the IDE.
If you want to add flags to all packages, even those that are not made for this, edit your fpc.cfg. That's the purpose of fpc.cfg.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/dcd6756b/attachment-0001.html>

Reply by email

Mattias Gaertner
to Sven Barth: Since Lazarus requires 2.6.0 anyway one could change that to use normal class helpers:…

Sven Barth hat am 13. September 2012 um 10:06
geschrieben:

Show quoted text 12 lines
Am 12.09.2012 23:38, schrieb Mattias Gaertner: >> eg: Try to compile LCL-GTK2 with -CRrt enabled. >> >> >> /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) >> Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are >> not related > > That's the old style class helper. Not usable with -CT. Since Lazarus requires 2.6.0 anyway one could change that to use normal class helpers:

The IDE needs 2.6.0. The LCL only needs 2.4.2.

[...]

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/7258094e/attachment.html>

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 18 lines
Sven Barth hat am 13. September 2012 um 10:06 geschrieben: > Am 12.09.2012 23:38, schrieb Mattias Gaertner: > >> eg: Try to compile LCL-GTK2 with -CRrt enabled. > >> > >> > >> /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) > >> Error: Class or Object types "TCustomBitBtn" and "TWinControlAccess" are > >> not related > > > > That's the old style class helper. Not usable with -CT. > > Since Lazarus requires 2.6.0 anyway one could change that to use normal > class helpers: The IDE needs 2.6.0. The LCL only needs 2.4.2.

But one could already prepare it using ifdefs. This way (if one does it consequently) the LCL could be compiled using -CT at least using 2.6.0+ . :)

Regards,
Sven

Reply by email

Michael Schnell
to Mattias Gaertner: Michael Schnell hat am 13. September 2012 um 09:50 geschrieben: The IDE build options…
Mattias Gaertner wrote 7 lines
The IDE build options are available via the IDE macro $(IDEBuildOptions). Many packages add this to their custom options. These options are always used - no matter if the package compilation was triggered by the the project or by the IDE. If you want to add flags to all packages, even those that are not made for this, edit your fpc.cfg. That's the purpose of fpc.cfg.

I see.

Hopefully the package-testers do know this.

Graeme, what did you experience ?

-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/925ffb88/attachment.html>

Reply by email

Mattias Gaertner
to Sven Barth: But one could already prepare it using ifdefs. This way (if one does it consequently) the…

Sven Barth hat am 13. September 2012 um 11:15
geschrieben:

Show quoted text 15 lines
Am 13.09.2012 11:00, schrieb Mattias Gaertner: > > Sven Barth hat am 13. September 2012 um > 10:06 geschrieben: > > Am 12.09.2012 23:38, schrieb Mattias Gaertner: > > >> eg: Try to compile LCL-GTK2 with -CRrt enabled. > > >> > > >> > > >> > /home/graemeg/devel/lazarus/lcl/interfaces/gtk2/gtk2wsbuttons.pp(237,35) > > >> Error: Class or Object types "TCustomBitBtn" and > "TWinControlAccess" are > > >> not related > > > > > > That's the old style class helper. Not usable with -CT.

I meant -CR

Show quoted text 6 lines
> > Since Lazarus requires 2.6.0 anyway one could change that to use normal > > class helpers: > The IDE needs 2.6.0. The LCL only needs 2.4.2. But one could already prepare it using ifdefs. This way (if one does it consequently) the LCL could be compiled using -CT at least using 2.6.0+ . :)

Accessing a private variable from outside is a hack. No matter how you do it. I replaced the hack.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/36c5cd9d/attachment.html>

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
> > > Since Lazarus requires 2.6.0 anyway one could change that to use normal > > > class helpers: > > The IDE needs 2.6.0. The LCL only needs 2.4.2. > > But one could already prepare it using ifdefs. This way (if one does it > consequently) the LCL could be compiled using -CT at least using 2.6.0+ . :) Accessing a private variable from outside is a hack. No matter how you do it.

The variable is "protected" otherwise class helpers (or the original hack) wouldn't have worked. And here class helpers are a officially supported method to do this (though one can of course argue whether it was a good decision by CodeGear to allow this or not...).

I replaced the hack.

Also a possibility...

Regards,
Sven

Reply by email

Graeme Geldenhuys
to Michael Schnell: I see. Hopefully the package-testers do know this. Graeme, what did you experience ?…
Michael Schnell wrote
Graeme, what did you experience ?

If I want compiler options to apply across all the code I use (my project, fpGUI, onguard, fptest, tiopf), I switch to MSEide.

Trying to overcome that hurdle with Lazarus Packages is just too much of a pain. MSEide is much simpler in this regard.

And yes, I frequently switch between Lazarus IDE and MSEide. I use the best tool for a specific job.

Regards,
- Graeme -

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk? I…

Graeme Geldenhuys hat am 13. September 2012 um 12:18 geschrieben:

Show quoted text 7 lines
On 13/09/12 10:00, Mattias Gaertner wrote: > > The IDE needs 2.6.0. The LCL only needs 2.4.2. So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk?

Is this a typo?

I don't think anybody does that. So I think it is safe to keep the two (IDE and LCL) in sync with what FPC version they need.

Due to incompatibilities and new bugs some people can not use a newer fpc, but they can use a newer LCL. For example the android target.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/75861115/attachment.html>

Reply by email

Martin
to Graeme Geldenhuys: So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk? I…
Graeme Geldenhuys wrote 9 lines
On 13/09/12 10:00, Mattias Gaertner wrote: > > The IDE needs 2.6.0. The LCL only needs 2.4.2. So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk? I don't think anybody does that. So I think it is safe to keep the two (IDE and LCL) in sync with what FPC version they need.

On w32 the IDE still builds with 2.4.4 (at least for me)

Reply by email

Mattias Gaertner
to Graeme Geldenhuys

Graeme Geldenhuys hat am 13. September 2012 um 13:42 geschrieben:

Show quoted text 5 lines
On 13/09/12 11:26, Mattias Gaertner wrote: > > Is this a typo? No... Old IDE (compiled with say FPC 2.4.4) and newer LCL.

Old IDE with newer LCL is not supported.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/c8cb5afc/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Graeme Geldenhuys: So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk? I…
Graeme Geldenhuys wrote
So "in the real world" is anybody using Lazarus IDE 0.9.30.x and LCL-only from trunk? I don't think anybody does that. So I think it is safe to keep the two (IDE and LCL) in sync with what FPC version they need.

You are missing the point of why the LCL supports older FPC versions. It is not for people using the LCL without the IDE. It is for people using platforms which are not supported in FPC 2.6.0

For example Android support is broken in FPC 2.6.x but worked fine in 2.5.x

Felipe Monteiro de Carvalho

Reply by email