[SOLVED] Clean up at ide/include/ide.inc lazarus / 6-IDE-CodeTools ---------------------------------------------------------------------- lagprogramming · 2023-06-01 08:59 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IF FPC_FULLVERSION<20700}// fpc 2.6.2 and 2.6.3 have a bug with -O2 and for..in// see http://bugs.freepascal.org/view.php?id=25588  {$OPTIMIZATION NOSTACKFRAME}{$ENDIF}Here is the patch: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i diff --git a/ide/include/ide.inc b/ide/include/ide.incindex 2596bd2e23..a60875eace 100644--- a/ide/include/ide.inc+++ b/ide/include/ide.inc@@ -48,12 +48,6 @@   {$ENDIF} {$ENDIF} -{$IF FPC_FULLVERSION<20700}-// fpc 2.6.2 and 2.6.3 have a bug with -O2 and for..in-// see http://bugs.freepascal.org/view.php?id=25588-  {$OPTIMIZATION NOSTACKFRAME}-{$ENDIF}- {$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}   {$DEFINE EnableRedirectStdErr} {$ENDIF} ---------------------------------------------------------------------- Thaddy · 2023-06-01 09:11 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. ---------------------------------------------------------------------- JuhaManninen · 2023-06-01 09:34 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. ---------------------------------------------------------------------- PascalDragon · 2023-06-01 20:40 Quote from: Thaddy on June 01, 2023, 11:11:20 amWhy 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 · 2023-06-02 11:55 Which is what I wrote... The exact same... ---------------------------------------------------------------------- PascalDragon · 2023-06-02 20:42 I really wonder what kind of reality distortion field you're using... Let's look at what you wrote, again: Quote from: Thaddy on June 01, 2023, 11:11:20 amWhy 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 · 2023-06-02 21:10 Quote from: lagprogramming on June 01, 2023, 10:59:56 amLazarus can't be built with a version of FPC prior to 3.0.0. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i diff --git a/ide/include/ide.inc b/ide/include/ide.inc {$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}   {$DEFINE EnableRedirectStdErr} {$ENDIF} From that the and (FPC_FULLVERSION>=20701) could be removed as well, since the compile will be 3.0 or higher. Bart ---------------------------------------------------------------------- Warfley · 2023-06-03 10:29 I just ran the following: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i grep -rnP "FPC_FULLVERSION *(<|<=|>|>=) *(2\d+|30000)" lcl ideThere are alot of occurances: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lcl/dbgrids.pas:39:{$if FPC_FULLVERSION<20701}lcl/graphics.pp:28:{$IF FPC_FULLVERSION>=20601}lcl/graphics.pp:32:{$IF FPC_FULLVERSION>=20603}lcl/graphics.pp:36:{$IF FPC_FULLVERSION>=20603}lcl/imglist.pp:335:      {$IF FPC_FULLVERSION>=20402}override;{$ENDIF}lcl/include/canvas.inc:1581:  {$IF FPC_FULLVERSION>=20602}lcl/include/imglist.inc:2345:    {$IF FPC_FULLVERSION>20402}lcl/include/lcl_defines.inc:6:{$IF FPC_FULLVERSION>=20701}lcl/include/tiffimage.inc:28:  {$IF FPC_FULLVERSION>=20601}lcl/interfaces/carbon/carbonstrings.pp:21:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}lcl/interfaces/cu stomdrawn/customdrawnwinapi.inc:4074:  {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}lcl/interfaces/gtk2/gtk2defines.inc:99:{$IF FPC_FULLVERSION>=20701}lcl/interfaces/gtk2/gtk2extrah.inc:18:  {$IF FPC_FULLVERSION<20600}lcl/interfaces/gtk2/gtk2extrah.inc:48:{$IF FPC_FULLVERSION<20600}lcl/interfaces/gtk2/gtk2extrah.inc:86:{$IF FPC_FULLVERSION<20600}lcl/interfaces/gtk2/gtk2extrah.inc:132:{$IF FPC_FULLVERSION<20501}lcl/interfaces/gtk2/gtk2extrah.inc:141:{$IF FPC_FULLVERSION<20600}lcl/interfaces/gtk2/gtk2extrah.inc:281:{$IF FPC_FULLVERSION<20600}lcl/interfaces/qt/qtprivate.pp:26:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}lcl/interfaces/qt5/qtprivate.pp:26:{$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)}lcl/interfaces/win32/win32callback.inc:1280:  {$IF FPC_FULLVERSION>=30000}lcl/interfaces/win32/win32int.pp:34:  {$IF FPC_FULLVERSION>=30000}lcl/intfgraphics.pas:603:  {$IF FPC_FULLVERSION<20601}lcl/lazcanvas.pas:822:  {$IF (FPC_FULLVERSION<=20600)}lcl/lclmemmanager.pas:87:{$IF FPC_FULLVERSION>20402}lcl/lclproc.pas:2267:{$IF FPC_FULLVERSION>=20701}lcl/lclversion.pas:21:  {$if defined(ver1) or (FPC_FULLVERSION<20200)}lcl/lclversion.pas:25:  {$if defined(ver1) or (FPC_FULLVERSION<20402) }lcl/lresources.pp:804://{$if (FPC_FULLVERSION>=20605) and defined(WinCE)}ide/include/ide.inc:51:{$IF FPC_FULLVERSION<20700}ide/include/ide.inc:57:{$IF defined(Windows) and defined(HEAPTRC_WINDOW) and (FPC_FULLVERSION>=20701)}ide/lazadvancedipc.pp:38:  {$IF FPC_FULLVERSION<20701}ide/lazadvancedipc.pp:187:  TIPCSearchRec = {$IF FPC_FULLVERSION>=20701}TRawByteSearchRec{$ELSE}TSearchRec{$ENDIF};ide/ lazbuild.lpr:278:    {$IF FPC_FULLVERSION >= 20701}ide/raw_window.pas:32:{$IF FPC_FULLVERSION>=20701}ide/raw_window.pas:45:{$IF FPC_FULLVERSION>=20701} When searching in components there are also a few more: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i components/aggpas/src/agg_fpimage.pas:385:    {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}components/cairocanvas/cairocanvas.pas:23:{$if (FPC_FULLVERSION>=20701)}components/cairocanvas/cairocanvasall.pas:10: {$IF ((FPC_FULLVERSION>=20701) or not defined(win64)) and not defined(WinCE)}components/chmhelp/lhelp/chmcontentprovider.pas:13:{$IF FPC_FULLVERSION>=20400}components/codetools/eventcodetool.pas:202:    Len:={$IF FPC_FULLVERSION>=30000}SizeOf(TParamFlags){$ELSE}1{$ENDIF}; components/fpdebug/test/testdata/dwarfsetup1.lpr:3:{$IF FPC_FULLVERSIO N>=20701}components/fpdebug/test/testdata/dwarfsetuparray.lpr:3:{$IF F PC_FULLVERSION>=20701}components/fpdebug/test/testdata/dwarfsetupbasic .lpr:3:{$IF FPC_FULLVERSION>=20701}components/fpdebug/test/testdwarfse tup1.pas:4:{$IF FPC_FULLVERSION>=20701}components/fpdebug/test/testdwa rfsetuparray.pas:4:{$IF FPC_FULLVERSION>=20701}components/fpdebug/test /testdwarfsetupbasic.pas:4:{$IF FPC_FULLVERSION>=20701}components/fpre port/design/reportconns.pp:16:{$IF FPC_FULLVERSION >= 20601}components/fpreport/design/reportconns.pp:25:{$IF FPC_FULLVERSION >= 20603}components/fpreport/design/reportconns.pp:28:{$IF FPC_FULLVERSION >= 20701}components/fpvectorial/fpvectorial.pas:4609:  {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}components/freetype/ttfile.pas:367: {$IF FPC_FULLVERSION<20701}components/freetype/ttfile.pas:373:   {$IF FPC_FULLVERSION<20701}Binary file components/lazdebuggers/lazdebugtestbase/sources.res matchescomponents /lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:300:  {$if FPC_FULLVERSION >= 30000}components/lazdebuggers/lazdebugtestbase/test apps/WatchesValuePrg.pas:308:  {$if FPC_FULLVERSION >= 30000}component s/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:407:  {$if FPC_FULLVERSION >= 30000}components/lazdebuggers/lazdebugtestbas e/testapps/WatchesValuePrg.pas:475:{$if FPC_FULLVERSION >= 30000}compo nents/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas:820:  {$if FPC_FULLVERSION >= 30000}components/lazreport/source/lr_rrect.pas:27:{$if (FPC_FULLVERSIO N>=20701)}components/lazreport/source/lr_vers.inc:59:{$if FPC_FULLVERSION<20701}components/lazutils/lazsysutils.pas:29:      {$If defined(Linux) and (FPC_FULLVERSION<30000)}components/lazutils/lazsysutils.pas:36:{$IF FPC_FULLVERSION>=30000}components/lazutils/lazsysutils.pas:53:{$IF FPC_FULLVERSION<30000}components/lazutils/lazsysutils.pas:118:{$IF FPC_FULLVERSION<30000}components/lazutils/lazsysutils.pas:145:{$IF FPC_FULLVERSION<30000}components/lazutils/lazutf8.pas:266:    {$IF FPC_FULLVERSION>=20701}components/lazutils/winlazutf8.inc:263:{$IF FPC_FULLVERSION>=30000}components/sqldb/registersqldb.pas:40:{$IF FPC_FULLVERSION >= 20601}components/sqldb/registersqldb.pas:49:{$IF FPC_FULLVERSION >= 20602}components/sqldb/registersqldb.pas:57:{$IF FPC_FULLVERSION >= 20603}components/sqldb/registersqldb.pas:60:{$IF FPC_FULLVERSION >= 20701}components/sqldbrest/editor/schemaconns.pp:16:{$IF FPC_FULLVERSION >= 20601}components/sqldbrest/editor/schemaconns.pp:25:{$IF FPC_FULLVERSION >= 20603}components/sqldbrest/editor/schemaconns.pp:28:{$IF FPC_FULLVERSION >= 20701}components/synedit/lazsynimm.pas:16:{$IFDEF WINCE} {$IF (FPC_FULLVERSION < 20700)}components/synedit/syncompletion.pas:467:{$IF FPC_FULLVERSION >= 20701}components/synedit/syncompletion.pas:477:  {$IF FPC_FULLVERSION >= 20701}components/synedit/synedittextdoublewidthchars.pas:430:  {$IF FPC_FULLVERSION>=20701}components/tachart/tachartutils.pas:22:{$IF FPC_FULLVERSION<20700}components/tachart/tadrawercanvas.pas:376:      {$IF (FPC_FULLVERSION<=20600) or (FPC_FULLVERSION=20602)}components/vlc/reglazvlc.pas:3:{$IF FPC_FULLVERSION<20701}components/wiki/test/wikihelpmanager.pas:1251:  {$IF FPC_FULLVERSION<30000}components/wiki/test/wikihelpmanager.pas:1304:  {$IF FPC_FULLVERSION<30000}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)} ---------------------------------------------------------------------- Bart · 2023-06-03 21:01 Quote from: Warfley on June 03, 2023, 12:29:46 pmPS: This is probably my favourite: {$if (FPC_FULLVERSION>=20701) OR (FPC_FULLVERSION>=20603)} LOL  Bart ---------------------------------------------------------------------- Bart · 2023-06-03 21:03 Quote from: Warfley on June 03, 2023, 12:29:46 pmThere 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 · 2023-06-04 09:21 Quote from: Warfley on June 03, 2023, 12:29:46 pmI just ran the following: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i grep -rnP "FPC_FULLVERSION *(<|<=|>|>=) *(2\d+|30000)" lcl ideNice RegExp. It can also be used in "Find in Files" window in Lazarus. Makes fixing them easy. ---------------------------------------------------------------------- JuhaManninen · 2023-07-07 14:53 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.