Skip to content

Commit

Permalink
Undefining HAS_System_RegisterExpectedMemoryLeak for non-Windows plat…
Browse files Browse the repository at this point in the history
…forms in Delphi 2006+. Tweaking the conditions that define REGISTER_EXPECTED_MEMORY_LEAK.
  • Loading branch information
rlebeau committed Jul 12, 2021
1 parent 4680429 commit a28882a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 66 deletions.
20 changes: 8 additions & 12 deletions Lib/Core/IdCompilerDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// as specified further below. This works in conjunction with the
// FREE_ON_FINAL define above.
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$UNDEF HAS_System_RegisterExpectedMemoryLeak}

// FastMM is natively available in BDS 2006 and higher. $DEFINE the
// following if FastMM has been installed manually in earlier versions
Expand Down Expand Up @@ -1140,11 +1141,9 @@
{$IFDEF VCL_2006_OR_ABOVE}
{$DEFINE USE_INLINE}
{$DEFINE HAS_2PARAM_FileAge}
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$IFNDEF FREE_ON_FINAL}
{$IFNDEF DOTNET}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF WINDOWS}
// System.RegisterExpectedMemoryLeak() is only available on Windows at this time
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$ENDIF}
// In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
// files instead of as unsigned __int64. This causes conflicts in overloaded
Expand Down Expand Up @@ -1890,7 +1889,10 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}

{$IFNDEF FREE_ON_FINAL}
{$IFNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFNDEF DOTNET}
{$IFDEF HAS_System_RegisterExpectedMemoryLeak}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF USE_FASTMM4}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
Expand All @@ -1903,12 +1905,6 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}
{$ENDIF}

{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF DOTNET}
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$ENDIF}

{
We must determine what the SocketType parameter is for the Socket function.
In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
Expand Down
20 changes: 8 additions & 12 deletions Lib/FCL/IdCompilerDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// as specified further below. This works in conjunction with the
// FREE_ON_FINAL define above.
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$UNDEF HAS_System_RegisterExpectedMemoryLeak}

// FastMM is natively available in BDS 2006 and higher. $DEFINE the
// following if FastMM has been installed manually in earlier versions
Expand Down Expand Up @@ -1140,11 +1141,9 @@
{$IFDEF VCL_2006_OR_ABOVE}
{$DEFINE USE_INLINE}
{$DEFINE HAS_2PARAM_FileAge}
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$IFNDEF FREE_ON_FINAL}
{$IFNDEF DOTNET}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF WINDOWS}
// System.RegisterExpectedMemoryLeak() is only available on Windows at this time
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$ENDIF}
// In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
// files instead of as unsigned __int64. This causes conflicts in overloaded
Expand Down Expand Up @@ -1890,7 +1889,10 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}

{$IFNDEF FREE_ON_FINAL}
{$IFNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFNDEF DOTNET}
{$IFDEF HAS_System_RegisterExpectedMemoryLeak}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF USE_FASTMM4}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
Expand All @@ -1903,12 +1905,6 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}
{$ENDIF}

{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF DOTNET}
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$ENDIF}

{
We must determine what the SocketType parameter is for the Socket function.
In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
Expand Down
20 changes: 8 additions & 12 deletions Lib/Protocols/IdCompilerDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// as specified further below. This works in conjunction with the
// FREE_ON_FINAL define above.
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$UNDEF HAS_System_RegisterExpectedMemoryLeak}

// FastMM is natively available in BDS 2006 and higher. $DEFINE the
// following if FastMM has been installed manually in earlier versions
Expand Down Expand Up @@ -1140,11 +1141,9 @@
{$IFDEF VCL_2006_OR_ABOVE}
{$DEFINE USE_INLINE}
{$DEFINE HAS_2PARAM_FileAge}
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$IFNDEF FREE_ON_FINAL}
{$IFNDEF DOTNET}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF WINDOWS}
// System.RegisterExpectedMemoryLeak() is only available on Windows at this time
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$ENDIF}
// In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
// files instead of as unsigned __int64. This causes conflicts in overloaded
Expand Down Expand Up @@ -1890,7 +1889,10 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}

{$IFNDEF FREE_ON_FINAL}
{$IFNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFNDEF DOTNET}
{$IFDEF HAS_System_RegisterExpectedMemoryLeak}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF USE_FASTMM4}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
Expand All @@ -1903,12 +1905,6 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}
{$ENDIF}

{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF DOTNET}
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$ENDIF}

{
We must determine what the SocketType parameter is for the Socket function.
In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
Expand Down
20 changes: 8 additions & 12 deletions Lib/SuperCore/IdCompilerDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// as specified further below. This works in conjunction with the
// FREE_ON_FINAL define above.
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$UNDEF HAS_System_RegisterExpectedMemoryLeak}

// FastMM is natively available in BDS 2006 and higher. $DEFINE the
// following if FastMM has been installed manually in earlier versions
Expand Down Expand Up @@ -1140,11 +1141,9 @@
{$IFDEF VCL_2006_OR_ABOVE}
{$DEFINE USE_INLINE}
{$DEFINE HAS_2PARAM_FileAge}
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$IFNDEF FREE_ON_FINAL}
{$IFNDEF DOTNET}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF WINDOWS}
// System.RegisterExpectedMemoryLeak() is only available on Windows at this time
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$ENDIF}
// In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
// files instead of as unsigned __int64. This causes conflicts in overloaded
Expand Down Expand Up @@ -1890,7 +1889,10 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}

{$IFNDEF FREE_ON_FINAL}
{$IFNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFNDEF DOTNET}
{$IFDEF HAS_System_RegisterExpectedMemoryLeak}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF USE_FASTMM4}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
Expand All @@ -1903,12 +1905,6 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}
{$ENDIF}

{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF DOTNET}
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$ENDIF}

{
We must determine what the SocketType parameter is for the Socket function.
In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
Expand Down
20 changes: 8 additions & 12 deletions Lib/System/IdCompilerDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// as specified further below. This works in conjunction with the
// FREE_ON_FINAL define above.
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$UNDEF HAS_System_RegisterExpectedMemoryLeak}

// FastMM is natively available in BDS 2006 and higher. $DEFINE the
// following if FastMM has been installed manually in earlier versions
Expand Down Expand Up @@ -1140,11 +1141,9 @@
{$IFDEF VCL_2006_OR_ABOVE}
{$DEFINE USE_INLINE}
{$DEFINE HAS_2PARAM_FileAge}
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$IFNDEF FREE_ON_FINAL}
{$IFNDEF DOTNET}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF WINDOWS}
// System.RegisterExpectedMemoryLeak() is only available on Windows at this time
{$DEFINE HAS_System_RegisterExpectedMemoryLeak}
{$ENDIF}
// In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
// files instead of as unsigned __int64. This causes conflicts in overloaded
Expand Down Expand Up @@ -1890,7 +1889,10 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}

{$IFNDEF FREE_ON_FINAL}
{$IFNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFNDEF DOTNET}
{$IFDEF HAS_System_RegisterExpectedMemoryLeak}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$IFDEF USE_FASTMM4}
{$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
Expand All @@ -1903,12 +1905,6 @@ word to an 8 bit byte and an 8 bit byte field named sa_len was added.
{$ENDIF}
{$ENDIF}

{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF DOTNET}
{$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$ENDIF}
{$ENDIF}

{
We must determine what the SocketType parameter is for the Socket function.
In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
Expand Down
8 changes: 2 additions & 6 deletions Lib/System/IdGlobal.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1848,10 +1848,8 @@ function IndyMax(const AValueOne, AValueTwo: Int32): Int32; overload;
function IndyMax(const AValueOne, AValueTwo: UInt16): UInt16; overload;
function IPv4MakeUInt32InRange(const AInt: Int64; const A256Power: Integer): UInt32;
function IPv4MakeLongWordInRange(const AInt: Int64; const A256Power: Integer): UInt32; {$IFDEF HAS_DEPRECATED}deprecated{$IFDEF HAS_DEPRECATED_MSG} 'Use IPv4MakeUInt32InRange()'{$ENDIF};{$ENDIF}
{$IFNDEF DOTNET}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
function IndyRegisterExpectedMemoryLeak(AAddress: Pointer): Boolean;
{$ENDIF}
{$ENDIF}
function LoadLibFunction(const ALibHandle: TIdLibHandle; const AProcName: TIdLibFuncName): Pointer;
{$IFDEF UNIX}
Expand Down Expand Up @@ -9746,8 +9744,7 @@ function ReadLnFromStream(AStream: TStream; var VLine: String; AMaxLineLength: I
Result := True;
end;

{$IFNDEF DOTNET}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
function IndyRegisterExpectedMemoryLeak(AAddress: Pointer): Boolean;
{$IFDEF USE_INLINE}inline;{$ENDIF}
begin
Expand Down Expand Up @@ -9801,7 +9798,6 @@ function IndyRegisterExpectedMemoryLeak(AAddress: Pointer): Boolean;
{$ENDIF}
{$ENDIF}
end;
{$ENDIF}
{$ENDIF}

function IndyAddPair(AStrings: TStrings; const AName, AValue: String): TStrings;
Expand Down

0 comments on commit a28882a

Please sign in to comment.