Bugs in the Delphi RTL/VCL

Top  Previous  Next

Pretranslated C# code > Preparing Delphi code > Bugs in the Delphi RTL/VCL

 

In some cases Delphi2C# cannot process a unit though the Delphi compiler can. That's because the automatically generated parser of Delphi2C# is more strict than the Delphi parser.  The Delphi parser might be handwritten and tolerates bugs like the following in the System.pas of RAD Studio 10.2 Tokyo inside of the function "FSetExceptFlag":

 

{$ELSEIF defined(CPUX64) and defined(Linux)) }

 

It is obvious, that there is a closing parenthesis too much and the code should be corrected to:

 

{$ELSEIF defined(CPUX64) and defined(Linux) }

 

The next bug in the same file is:

 

{$IF not (defined(PC_MAPPED_EXCEPTIONS) or defined(SJLJ_BASED_EXCEPTIONS)) or defined(ZCX_BASED_EXCEPTIONS)) }

 

 

Such bugs unfortunately exist in all versions of the RTL/VCL at different positions. They can be found inside of the Delphi2C# IDE quite easily, because the position where the preprocessor or the parser stops is shown in the input editor. If you have moved the cursor, the position is shown again by use of the ShowLastError button.

 

 

Here is a list of some flaws in the RTL/VCL of RAD Studio 10.2 Tokyo.

 

System.ObjAuto.pas line 23:

 

{$IF SizeOf(Extended) >= 10)} // 10,12,16

  {$DEFINE EXTENDEDHAS10BYTES}

{$ENDIF}

 

{$IF SizeOf(Extended) = 10)}

  {$DEFINE EXTENDEDIS10BYTES}

{$ENDIF}

 

should be:

 

{$IF SizeOf(Extended) >= 10} // 10,12,16

  {$DEFINE EXTENDEDHAS10BYTES}

{$ENDIF}

 

{$IF SizeOf(Extended) = 10}

  {$DEFINE EXTENDEDIS10BYTES}

{$ENDIF}  

 

 

Internal.Unwinder.pas:

 

{$IFDEF MACOS}

const

  _U = '_';

  {$EXTERNALSYM _U}

{$ELSE !MACOS}

  _U = '';

  {$EXTERNALSYM _U}

{$ENDIF}

 

 

could be:

 

{$IFDEF MACOS}

const

  _U = '_';

  {$EXTERNALSYM _U}

{$ELSE !MACOS}

const

  _U = '';

  {$EXTERNALSYM _U}

{$ENDIF}

 

 

System.pas  line 6643:

 

 

{$ELSEIF defined(CPUX64) and defined(Linux)) }

->

{$ELSEIF defined(CPUX64) and defined(Linux) }

 

line 24087:

 

{$IF not (defined(PC_MAPPED_EXCEPTIONS) or defined(SJLJ_BASED_EXCEPTIONS)) or defined(ZCX_BASED_EXCEPTIONS)) }

->

{$IF not (defined(PC_MAPPED_EXCEPTIONS) or defined(SJLJ_BASED_EXCEPTIONS)) or defined(ZCX_BASED_EXCEPTIONS) }

 

 

Vcl.Imaging.GifImg.pas  line 2421:

 

SetColors(GetPaletteEntries(Palette, 0, 256, nil^));

->

SetColors(GetPaletteEntries(Palette, 0, 256, nil));

 

 

WinAPI.DXFile.pas line 37:

 

 

(*$HPPEMIT '#include "dxfile.h"'{*)

(*$HPPEMIT '#include "rmxfguid.h"'{*)

(*$HPPEMIT '#include "rmxftmpl.h"'{*)

 

->

 

(*$HPPEMIT '#include "dxfile.h"'*)

(*$HPPEMIT '#include "rmxfguid.h"'*)

(*$HPPEMIT '#include "rmxftmpl.h"'*)

 

 

ToolsApi/ToolsApi.pas line 123/250/252

 

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAStreamModifyTime,0x49F2F63F,0x60CB,0x4FD4,0xB1,0x2F,0x81,0x67,0xFC,0x79,0xB2,0x93);*)

...

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAToolsFilterNotifier,0xCEF1F13A,0xE877,0x4F20,0x88,0xF2,0xF7,0xE2,0xBA,0x61,0xAA,0xF4); *)

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAToolsFilter,0x8864B891,0x9B6D,0x4002,0xBB,0x2E,0x1D,0x6E,0x59,0xBF,0xA4,0x9A); *)

.

(*$HPPEMIT 'DEFINE_GUID(IID_IOTATypeLibrary, 0x7A2F5910,0x58D2,0x448E,0xB4,0x57,0x2D,0xC0,0x1E,0x85,0x3D,0x46);*)

 

->

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAStreamModifyTime,0x49F2F63F,0x60CB,0x4FD4,0xB1,0x2F,0x81,0x67,0xFC,0x79,0xB2,0x93);'*)

...

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAToolsFilterNotifier,0xCEF1F13A,0xE877,0x4F20,0x88,0xF2,0xF7,0xE2,0xBA,0x61,0xAA,0xF4);'*)

(*$HPPEMIT 'DEFINE_GUID(IID_IOTAToolsFilter,0x8864B891,0x9B6D,0x4002,0xBB,0x2E,0x1D,0x6E,0x59,0xBF,0xA4,0x9A);'*)

.

(*$HPPEMIT 'DEFINE_GUID(IID_IOTATypeLibrary, 0x7A2F5910,0x58D2,0x448E,0xB4,0x57,0x2D,0xC0,0x1E,0x85,0x3D,0x46);'*)

 

 

 

 

 

 

 

 

 

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content