Recent

Author Topic: Compiler renamed my classes and all procedures  (Read 9771 times)

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Compiler renamed my classes and all procedures
« Reply #15 on: April 03, 2018, 10:44:08 am »
The Compiler changes code. That is clearly an issue. It should be reported as an issue.
First things first.
Did you get a message in the IDE that it wanted to reload the sources???
If not, then it's defenitly NOT a compiler issue but an IDE issue (which I suspect).

(Anyway, we can't report anything if we can't reproduce the problem)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #16 on: April 03, 2018, 11:18:39 am »
Yea, I got that message.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Compiler renamed my classes and all procedures
« Reply #17 on: April 03, 2018, 11:22:32 am »
Finally <sigh>
Specialize a type, not a var.

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Compiler renamed my classes and all procedures
« Reply #18 on: April 03, 2018, 11:24:34 am »
Yea, I got that message.
Yikes, that's not good.

Did you always get that message?
Did you answer: Yes, reload or don't reload?

What other software could be messing with the sources in this specific way?
Do you have the sources in a shared dropbox-like folder??

balazsszekely

  • Guest
Re: Compiler renamed my classes and all procedures
« Reply #19 on: April 03, 2018, 11:30:39 am »
Why should the compiler rewrite the source files? It makes no sense at all. If it's the compiler I pay you a beer.  :)
Now the solution is quite simple, use Process Monitor(Windows Sysinternals) to see what process modifies your file. You will see the killer in action. It will be the IDE not the compiler.
« Last Edit: April 03, 2018, 11:34:34 am by GetMem »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #20 on: April 03, 2018, 11:31:12 am »
Why not redo the whole thing ? Or if it is too long why not share all the files, so others can try to compile it and see if we also get it wrong ??
I am trying to redo it for the for the forth time.

Attached is the file where something renamed my code:

I don't see anything that was change in uMain.
Changes were made in prydotdat:

Line 19 Application.CreateForm(TlblHdrInfoType, lblHdrInfoType);     TblHdrinfoType is a label name on TForm2.

uParser :

Do a search on 'TlblHdrInfoType' and you will see where the changes were made.

Bring up the Object Inspector and look at the form name.
You have to edit the uParser.lfm to change it back to Form2 :TForm1



 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #21 on: April 03, 2018, 11:36:23 am »
Yea, I got that message.
Yikes, that's not good.

Did you always get that message?

Not everytime, at least I don't think everytime.

Did you answer: Yes, reload or don't reload?

Don't reload if I remember right.




What other software could be messing with the sources in this specific way?
Do you have the sources in a shared dropbox-like folder??

No it's on a personal computer. Connected to the network.


FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #22 on: April 03, 2018, 11:42:43 am »
Why should the compiler rewrite the source files? It makes no sense at all. If it's the compiler I pay you a beer.  :)
Now the solution is quite simple, use Process Monitor(Windows Sysinternals) to see what process modifies your file. You will see the killer in action. It will be the IDE not the compiler.

Process Monitor(Windows Sysinternals)

I have no idea what you are talking about.

It's a beginners form.

I googled it.

Have to investigate tomorrow.

It's 3am tomorrow is another day.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Compiler renamed my classes and all procedures
« Reply #23 on: April 03, 2018, 11:47:36 am »
The attached project shows signs of a form rename that wend bad. There are only 2 places where looks like the IDE failed to rename them properly one in the same unit as the form (uparser.pas) and the other in the umain.pas unit. After correcting both of them two more errors where found that can not be attributed to a failed rename at all. all of them in the method DisplayHdrField where the aRec.Fld1 was renamed to R.fle1 and R.fld1 after correcting them both the app seems to compile. There is no process that I know off that will rename aRec. to R. even if something wend wrong with unicode and all those strings it is more probable to see a complete line cut that renaming. Have you using an other computer (or a clean vm) to compile?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Compiler renamed my classes and all procedures
« Reply #24 on: April 03, 2018, 11:47:47 am »
On a personal computer you can still have those files in a dropbox folder.

But anyway... Although you mention you get the "source changed, reload" question, I still can't believe something other than the IDE changes your files in such a specific way. All indications are that it's the renaming of a variable or type that's doing this.

For instance, the renaming of Form2 and TForm2 to lblHdrInfotype can be easily reproduced by just renaming... well... Form2 to lblHdrInfotype.

I now have the source-code here which does compile (I renamed it back to Form2 and fixed the R record in DisplayHdrField().
Can you specify which steps you did to reproduce it from this point on?

Did you ever use the F2/Rename dialog?

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: Compiler renamed my classes and all procedures
« Reply #25 on: April 03, 2018, 11:57:09 am »
Hi

I too have corrected this version of the code, it seems to be much older than other versions you have posted?

Do you have any of the files open with a a different editor, ie notepad ++?
Do you have another instance of Lazarus running that has the Files Open? Check TaskManager
Do you have AUtoHotKey or similar app running, maybe this could be interferring.

Just to eliminate an anti virus application causing issues, canyou exclude your lazarus folder and your application folder from the Anti Virus Scanner.

If I were to rename the form2 to the lblHdrInfotype, it will appear like your code.
If you have entered text into an object inspector field by error and you realize before you press return or click away; the escape key will put it back; as long as it has not acted upon your changes.

Can you please let us know the OS, lazarus version, FPC version and anything else you think ,might be relevent.
« Last Edit: April 03, 2018, 12:35:07 pm by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Compiler renamed my classes and all procedures
« Reply #26 on: April 03, 2018, 05:26:07 pm »
@JLWest

Please do these 2 things below and provide us the screenshots of the results of:

1. The programs that run on your Windows startup
Start the Command Prompt > type: msconfig [enter] > click the Startup tab

2. The programs that running on the background
Do Ctrl+Alt+Del > choose: Start Task Manager > click the Processes tab

Note:
Those 2 above are for Win7, things may be a bit different if you're not using Win7.

By providing these info, we can understand that if your computer has some malware, virus, disk tool, or whatever that can cause the problem.

balazsszekely

  • Guest
Re: Compiler renamed my classes and all procedures
« Reply #27 on: April 03, 2018, 05:43:20 pm »
No seriously guys what virus, trojan, compiler etc.. would rename variables in a source file? More over the rename is done in a particular way. Most likely the IDE has some hidden bug, which is triggered by some particular configuration/action. Maybe two instances of Lazarus are running at the same time, or perhaps the OP is a funny man and he has a good laugh watching us jumping through his hoops(not likely though).
« Last Edit: April 03, 2018, 05:45:10 pm by GetMem »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #28 on: April 03, 2018, 05:47:44 pm »
The attached project shows signs of a form rename that wend bad. There are only 2 places where looks like the IDE failed to rename them properly one in the same unit as the form (uparser.pas) and the other in the umain.pas unit. After correcting both of them two more errors where found that can not be attributed to a failed rename at all. all of them in the method DisplayHdrField where the aRec.Fld1 was renamed to R.fle1 and R.fld1 after correcting them both the app seems to compile. There is no process that I know off that will rename aRec. to R. even if something wend wrong with unicode and all those strings it is more probable to see a complete line cut that renaming. Have you using an other computer (or a clean vm) to compile?

Not sure I fully understand your question. "VM" Virtual Machine maybe. If so the answer is no.

 I work on a PC. with 16 Gig Ram, 1080 GeForce video Card with 8 Gig of Mem. a .5 terabyte SSD drive and 1  terabyte regular disk. MS Ver. 10 PRO. with an Intel Intel i7.

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Compiler renamed my classes and all procedures
« Reply #29 on: April 03, 2018, 05:51:19 pm »
On a personal computer you can still have those files in a dropbox folder.

But anyway... Although you mention you get the "source changed, reload" question, I still can't believe something other than the IDE changes your files in such a specific way. All indications are that it's the renaming of a variable or type that's doing this.

For instance, the renaming of Form2 and TForm2 to lblHdrInfotype can be easily reproduced by just renaming... well... Form2 to lblHdrInfotype.

I now have the source-code here which does compile (I renamed it back to Form2 and fixed the R record in DisplayHdrField().
Can you specify which steps you did to reproduce it from this point on?

Did you ever use the F2/Rename dialog?

No I don't know what that is.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018