Re: [fpc-pascal] Warning "Local variable seems to be not initialized" on dyn array
Am 2015-03-10 um 17:40 schrieb Sven Barth: > > It mutes the warning with the ID 5089 (the ID can be seen with -vq). So as long as the managed and unmanaged ones use the same warning ID (AFAIR they do) they will both be silenced. > Ups, no, they are different. So at least if you use a current 2.7.1 or newer only the managed ones will be hidden. Currently I use Lazarus 1.4RC1 with FPC Version 2.6.4. Does this version already have different IDs for managed and non-managed types? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Help with Delphi ASM translation to FPC
Hi, Could somebody confirm if the Delphi ASM does the same as the FPC code? This code is used in a unit testing framework to help report the exact location of where an error was raised. It seems to work well in Delphi, but not in FPC. Under FPC it seems to always return the same address, even though I might have had multiple test cases fail. I'm trying to eliminate where the possible issue could be. == {$IFNDEF FPC} // Delphi code function IsBadPointer(const P: Pointer):boolean; register; begin try Result := (P = nil) or ((Pointer(P^) <> P) and (Pointer(P^) = P)); except Result := true; end end; function CallerAddr: Pointer; assembler; const CallerIP = $4; asm mov eax, ebp call IsBadPointer test eax,eax jne @@Error mov eax, [ebp].CallerIP sub eax, 5 // 5 bytes for call push eax call IsBadPointer test eax,eax pop eax je@@Finish @@Error: xor eax, eax @@Finish: end; {$ELSE} // FPC cross-platform implementation function CallerAddr: Pointer; begin Result := get_caller_addr(get_frame); end; {$ENDIF} == Here is sample code of its usage: procedure TTestProc.Check(const condition: boolean; const ErrorMsg: string); begin OnCheckCalled; if (not condition) then Fail(ErrorMsg, CallerAddr); end; Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Help with Delphi ASM translation to FPC
On 2015-03-12 23:15, Graeme Geldenhuys wrote: > // FPC cross-platform implementation > function CallerAddr: Pointer; > begin > Result := get_caller_addr(get_frame); > end; I was told from another source my FPC implementation was incorrect and should rather be: [Anybody that could explain the different to me? I would be very grateful.] function CallerAddr: Pointer; var bp: Pointer; begin bp := get_caller_frame(get_frame); if bp <> nil then Result := get_caller_addr(bp) else Result := nil; end; This now does cause different addresses for various unit test failures. Next part is to extract the line info information to confirm that the addresses I now see are indeed correct. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Help with Delphi ASM translation to FPC
On 2015-03-13 00:03, Graeme Geldenhuys wrote: > Next part is to extract the line info information to confirm that the > addresses I now see are indeed correct. Success!!! :) Finally I have full details of where a failure occurs. === tiOPFUnitTestsFPGui.Non persistent tests.TTestTIUtils.tiInsertStringToStream: ETestFailure at $006F1017 line 2835 of ../../UnitTests/Tests/tiUtils_TST.pas "Failed on 5" Expected: "EAssertionFailed" But was: "ETestFailure" === I would still like to know if anybody could explain the difference between the two FPC implementations of CallerAddr() please. Now on to the next part. For ETestErrors, I want to include a stack dump. This should be easy now. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal and Lazarus Nightly Builds
On 3 March 2015 at 17:47, Anthony Walter wrote: > This is a public notice. Get Lazarus has switched from hosting arbitrary > revisions to hosting setup programs from nightly builds. > > http://www.getlazarus.org/setup/ > > Going forward each night the current svn trunk sources of FPC and Lazarus > will be updated and converted into a Windows installer, Linux, and > Macintosh archives. The installer, setup scripts, application shortcuts, > and website have now prominently inform users that they have installed or > might be installing nightly build versions of FPC and Lazarus. > > As before any changes get Lazarus makes are hosted in a diff file > distributed with each install. This information is also mirrored on github. > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > Is there changes.diff kept up to date, regularly? On the Linux version the patch has failed for me a number of times, so I had to get the source directly from a local Git mirror. Including the option to get the source from a local Git mirror will save a lot of bandwidth. If the boot strapping FPC is not changed, then it may be better to test for its presence and skip the download and extraction as well. There is no sign that it ever gets changed by the script once it is downloaded -- Frank Church === http://devblog.brahmancreations.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal