Recent

Author Topic: [SOLVED] Clean up at ide/include/ide.inc  (Read 1307 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 378
[SOLVED] Clean up at ide/include/ide.inc
« on: June 01, 2023, 10:59:56 am »
Lazarus can't be built with a version of FPC prior to 3.0.0.
The patch removes the following lines from file ide/include/ide.inc:
Code: Pascal  [Select][+][-]
  1. {$IF FPC_FULLVERSION<20700}
  2. // fpc 2.6.2 and 2.6.3 have a bug with -O2 and for..in
  3. // see http://bugs.freepascal.org/view.php?id=25588
  4.   {$OPTIMIZATION NOSTACKFRAME}
  5. {$ENDIF}
Here is the patch:
Code: Pascal  [Select][+][-]
  1. diff --git a/ide/include/ide.inc b/ide/include/ide.inc
  2. index 2596bd2e23..a60875eace 100644
  3. --- a/ide/include/ide.inc
  4. +++ b/ide/include/ide.inc
  5. @@ -48,12 +48,6 @@
  6.    {$ENDIF}
  7.  {$ENDIF}
  8.  
  9. -{$IF FPC_FULLVERSION<20700}
  10. -// fpc 2.6.2 and 2.6.3 have a bug with -O2 and for..in
  11. -// see http://bugs.freepascal.org/view.php?id=25588
  12. -  {$OPTIMIZATION NOSTACKFRAME}
  13. -{$ENDIF}
  14. -
  15.  {$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}
  16.    {$DEFINE EnableRedirectStdErr}
  17.  {$ENDIF}
« Last Edit: July 07, 2023, 06:19:55 pm by lagprogramming »

Thaddy

  • Hero Member
  • *****
  • Posts: 13213
Re: Clean up at ide/include/ide.inc
« Reply #1 on: June 01, 2023, 11:11:20 am »
Why would you want to write bad patches? There is a reason you can't compile with older compilers: features. This thread should be deleted.
I actually get compliments for being rude... (well, Dutch, but that is the same)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4348
  • I like bugs.
Re: Clean up at ide/include/ide.inc
« Reply #2 on: June 01, 2023, 11:34:06 am »
The suggestion is valid. Searching "{$IF FPC_FULLVERSION<" in Lazarus sources reveals many other cases that can be removed.
Let's clean up trunk after the next main release gets forked. It should happen in few weeks.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5210
  • Compiler Developer
Re: Clean up at ide/include/ide.inc
« Reply #3 on: June 01, 2023, 10:40:11 pm »
Why would you want to write bad patches? There is a reason you can't compile with older compilers: features. This thread should be deleted.

What are you even talking about? This is about removing checks specifically to cater for older compilers that are not supported anymore anyway.

Thaddy

  • Hero Member
  • *****
  • Posts: 13213
Re: Clean up at ide/include/ide.inc
« Reply #4 on: June 02, 2023, 01:55:37 pm »
Which is what I wrote... The exact same...
I actually get compliments for being rude... (well, Dutch, but that is the same)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5210
  • Compiler Developer
Re: Clean up at ide/include/ide.inc
« Reply #5 on: June 02, 2023, 10:42:03 pm »
I really wonder what kind of reality distortion field you're using... ::)

Let's look at what you wrote, again:

Why would you want to write bad patches? There is a reason you can't compile with older compilers: features. This thread should be deleted.

So you wrote this is a bad patch and that this thread should be deleted, thus you're saying that lagprogramming's patch isn't correct. But it is, because it get's rid of a check that isn't used anymore anyway, because the corresponding compiler version isn't supported anymore anyway. We often clean up such code in the RTL as well.

Bart

  • Hero Member
  • *****
  • Posts: 5079
    • Bart en Mariska's Webstek
Re: Clean up at ide/include/ide.inc
« Reply #6 on: June 02, 2023, 11:10:05 pm »
Lazarus can't be built with a version of FPC prior to 3.0.0.
Code: Pascal  [Select][+][-]
  1. diff --git a/ide/include/ide.inc b/ide/include/ide.inc
  2.  {$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}
  3.    {$DEFINE EnableRedirectStdErr}
  4.  {$ENDIF}

From that the and (FPC_FULLVERSION>=20701) could be removed as well, since the compile will be 3.0 or higher.

Bart

Warfley

  • Hero Member
  • *****
  • Posts: 1437
Re: Clean up at ide/include/ide.inc
« Reply #7 on: June 03, 2023, 12:29:46 pm »
I just ran the following:
Code: Bash  [Select][+][-]
  1. grep -rnP "FPC_FULLVERSION *(<|<=|>|>=) *(2\d+|30000)" lcl ide
There are alot of occurances:
Code: Pascal  [Select][+][-]
  1. lcl/dbgrids.pas:39:{$if FPC_FULLVERSION<20701}
  2. lcl/graphics.pp:28:{$IF FPC_FULLVERSION>=20601}
  3. lcl/graphics.pp:32:{$IF FPC_FULLVERSION>=20603}
  4. lcl/graphics.pp:36:{$IF FPC_FULLVERSION>=20603}
  5. lcl/imglist.pp:335:      {$IF FPC_FULLVERSION>=20402}override;{$ENDIF}
  6. lcl/include/canvas.inc:1581:  {$IF FPC_FULLVERSION>=20602}
  7. lcl/include/imglist.inc:2345:    {$IF FPC_FULLVERSION>20402}
  8. lcl/include/lcl_defines.inc:6:{$IF FPC_FULLVERSION>=20701}
  9. lcl/include/tiffimage.inc:28:  {$IF FPC_FULLVERSION>=20601}
  10. lcl/interfaces/carbon/carbonstrings.pp:21:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}
  11. lcl/interfaces/customdrawn/customdrawnwinapi.inc:4074:  {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}
  12. lcl/interfaces/gtk2/gtk2defines.inc:99:{$IF FPC_FULLVERSION>=20701}
  13. lcl/interfaces/gtk2/gtk2extrah.inc:18:  {$IF FPC_FULLVERSION<20600}
  14. lcl/interfaces/gtk2/gtk2extrah.inc:48:{$IF FPC_FULLVERSION<20600}
  15. lcl/interfaces/gtk2/gtk2extrah.inc:86:{$IF FPC_FULLVERSION<20600}
  16. lcl/interfaces/gtk2/gtk2extrah.inc:132:{$IF FPC_FULLVERSION<20501}
  17. lcl/interfaces/gtk2/gtk2extrah.inc:141:{$IF FPC_FULLVERSION<20600}
  18. lcl/interfaces/gtk2/gtk2extrah.inc:281:{$IF FPC_FULLVERSION<20600}
  19. lcl/interfaces/qt/qtprivate.pp:26:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}
  20. lcl/interfaces/qt5/qtprivate.pp:26:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}
  21. lcl/interfaces/win32/win32callback.inc:1280:  {$IF FPC_FULLVERSION>=30000}
  22. lcl/interfaces/win32/win32int.pp:34:  {$IF FPC_FULLVERSION>=30000}
  23. lcl/intfgraphics.pas:603:  {$IF FPC_FULLVERSION<20601}
  24. lcl/lazcanvas.pas:822:  {$IF (FPC_FULLVERSION<=20600)}
  25. lcl/lclmemmanager.pas:87:{$IF FPC_FULLVERSION>20402}
  26. lcl/lclproc.pas:2267:{$IF FPC_FULLVERSION>=20701}
  27. lcl/lclversion.pas:21:  {$if defined(ver1) or (FPC_FULLVERSION<20200)}
  28. lcl/lclversion.pas:25:  {$if defined(ver1) or (FPC_FULLVERSION<20402) }
  29. lcl/lresources.pp:804://{$if (FPC_FULLVERSION>=20605) and defined(WinCE)}
  30. ide/include/ide.inc:51:{$IF FPC_FULLVERSION<20700}
  31. ide/include/ide.inc:57:{$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}
  32. ide/lazadvancedipc.pp:38:  {$IF FPC_FULLVERSION<20701}
  33. ide/lazadvancedipc.pp:187:  TIPCSearchRec = {$IF FPC_FULLVERSION>=20701}TRawByteSearchRec{$ELSE}TSearchRec{$ENDIF};
  34. ide/lazbuild.lpr:278:    {$IF FPC_FULLVERSION >= 20701}
  35. ide/raw_window.pas:32:{$IF FPC_FULLVERSION>=20701}
  36. ide/raw_window.pas:45:{$IF FPC_FULLVERSION>=20701}

When searching in components there are also a few more:
Code: Pascal  [Select][+][-]
  1. components/aggpas/src/agg_fpimage.pas:385:    {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}
  2. components/cairocanvas/cairocanvas.pas:23:{$if (FPC_FULLVERSION>=20701)}
  3. components/cairocanvas/cairocanvasall.pas:10:{$IF ((FPC_FULLVERSION>=20701) or not defined(win64)) and not defined(WinCE)}
  4. components/chmhelp/lhelp/chmcontentprovider.pas:13:{$IF FPC_FULLVERSION>=20400}
  5. components/codetools/eventcodetool.pas:202:      Len:={$IF FPC_FULLVERSION>=30000}SizeOf(TParamFlags){$ELSE}1{$ENDIF};
  6. components/fpdebug/test/testdata/dwarfsetup1.lpr:3:{$IF FPC_FULLVERSION>=20701}
  7. components/fpdebug/test/testdata/dwarfsetuparray.lpr:3:{$IF FPC_FULLVERSION>=20701}
  8. components/fpdebug/test/testdata/dwarfsetupbasic.lpr:3:{$IF FPC_FULLVERSION>=20701}
  9. components/fpdebug/test/testdwarfsetup1.pas:4:{$IF FPC_FULLVERSION>=20701}
  10. components/fpdebug/test/testdwarfsetuparray.pas:4:{$IF FPC_FULLVERSION>=20701}
  11. components/fpdebug/test/testdwarfsetupbasic.pas:4:{$IF FPC_FULLVERSION>=20701}
  12. components/fpreport/design/reportconns.pp:16:{$IF FPC_FULLVERSION >= 20601}
  13. components/fpreport/design/reportconns.pp:25:{$IF FPC_FULLVERSION >= 20603}
  14. components/fpreport/design/reportconns.pp:28:{$IF FPC_FULLVERSION >= 20701}
  15. components/fpvectorial/fpvectorial.pas:4609:  {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}
  16. components/freetype/ttfile.pas:367: {$IF FPC_FULLVERSION<20701}
  17. components/freetype/ttfile.pas:373:   {$IF FPC_FULLVERSION<20701}
  18. Binary file components/lazdebuggers/lazdebugtestbase/sources.res matches
  19. components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:300:  {$if FPC_FULLVERSION >= 30000}
  20. components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:308:  {$if FPC_FULLVERSION >= 30000}
  21. components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:407:  {$if FPC_FULLVERSION >= 30000}
  22. components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:475:{$if FPC_FULLVERSION >= 30000}
  23. components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:820:  {$if FPC_FULLVERSION >= 30000}
  24. components/lazreport/source/lr_rrect.pas:27:{$if (FPC_FULLVERSION>=20701)}
  25. components/lazreport/source/lr_vers.inc:59:{$if FPC_FULLVERSION<20701}
  26. components/lazutils/lazsysutils.pas:29:      {$If defined(Linux) and (FPC_FULLVERSION<30000)}
  27. components/lazutils/lazsysutils.pas:36:{$IF FPC_FULLVERSION>=30000}
  28. components/lazutils/lazsysutils.pas:53:{$IF FPC_FULLVERSION<30000}
  29. components/lazutils/lazsysutils.pas:118:{$IF FPC_FULLVERSION<30000}
  30. components/lazutils/lazsysutils.pas:145:{$IF FPC_FULLVERSION<30000}
  31. components/lazutils/lazutf8.pas:266:    {$IF FPC_FULLVERSION>=20701}
  32. components/lazutils/winlazutf8.inc:263:{$IF FPC_FULLVERSION>=30000}
  33. components/sqldb/registersqldb.pas:40:{$IF FPC_FULLVERSION >= 20601}
  34. components/sqldb/registersqldb.pas:49:{$IF FPC_FULLVERSION >= 20602}
  35. components/sqldb/registersqldb.pas:57:{$IF FPC_FULLVERSION >= 20603}
  36. components/sqldb/registersqldb.pas:60:{$IF FPC_FULLVERSION >= 20701}
  37. components/sqldbrest/editor/schemaconns.pp:16:{$IF FPC_FULLVERSION >= 20601}
  38. components/sqldbrest/editor/schemaconns.pp:25:{$IF FPC_FULLVERSION >= 20603}
  39. components/sqldbrest/editor/schemaconns.pp:28:{$IF FPC_FULLVERSION >= 20701}
  40. components/synedit/lazsynimm.pas:16:{$IFDEF WINCE} {$IF (FPC_FULLVERSION < 20700)}
  41. components/synedit/syncompletion.pas:467:{$IF FPC_FULLVERSION >= 20701}
  42. components/synedit/syncompletion.pas:477:  {$IF FPC_FULLVERSION >= 20701}
  43. components/synedit/synedittextdoublewidthchars.pas:430:  {$IF FPC_FULLVERSION>=20701}
  44. components/tachart/tachartutils.pas:22:{$IF FPC_FULLVERSION<20700}
  45. components/tachart/tadrawercanvas.pas:376:      {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}
  46. components/vlc/reglazvlc.pas:3:{$IF FPC_FULLVERSION<20701}
  47. components/wiki/test/wikihelpmanager.pas:1251:  {$IF FPC_FULLVERSION<30000}
  48. components/wiki/test/wikihelpmanager.pas:1304:    {$IF FPC_FULLVERSION<30000}
  49. components/wiki/test/wikihelpmanager.pas:1550:    {$IF FPC_FULLVERSION<=20403}

So there is alot that can be cleaned up if there is the requirement for 3.0.0 anyway

PS: This is probably my favourite: {$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}
« Last Edit: June 03, 2023, 12:31:46 pm by Warfley »

Bart

  • Hero Member
  • *****
  • Posts: 5079
    • Bart en Mariska's Webstek
Re: Clean up at ide/include/ide.inc
« Reply #8 on: June 03, 2023, 11:01:27 pm »
PS: This is probably my favourite: {$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}
LOL  :)

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5079
    • Bart en Mariska's Webstek
Re: Clean up at ide/include/ide.inc
« Reply #9 on: June 03, 2023, 11:03:10 pm »
There are alot of occurances:

Maybe put that lst on git, so we can fix that after the release of the next stable version.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4348
  • I like bugs.
Re: Clean up at ide/include/ide.inc
« Reply #10 on: June 04, 2023, 11:21:20 am »
I just ran the following:
Code: Bash  [Select][+][-]
  1. grep -rnP "FPC_FULLVERSION *(<|<=|>|>=) *(2\d+|30000)" lcl ide
Nice RegExp. It can also be used in "Find in Files" window in Lazarus. Makes fixing them easy.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4348
  • I like bugs.
Re: Clean up at ide/include/ide.inc
« Reply #11 on: July 07, 2023, 04:53:34 pm »
I used the RegExpr and other similar ones and cleaned code in Lazarus trunk.
Actually the minimum requirement for trunk is FPC 3.2.0. Lots of version tests and obsolete code was removed.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018