Open drawkula opened 7 years ago
The first issue, when using the -u option, is because the compiler is compiling the code a second time when doing unused method removal, and it looks like it's not setting up the preprocessor correctly the second time. The second issue is showing a couple things, the first one is that child objects are not getting the preprocessor defines setup for their compile, and second parent objects get their first pass compile step redone after their child objects are compiled and it's not setting up the preprocessor properly when doing that. To have it only show the messages once per object instance, I'll need to add a "silent" mode for the second compiles of the same object instance.
Thanks for reporting this.
Looks like I have encountered the same issue, here: http://forums.parallax.com/discussion/167622/weird-issue-with-openspin-preprocessor
Examining the source code, seems that the definitions are cleared after each file is processed when calling pp_finish in GetPASCIISource so any included object will clear all definitions. The proposed patch removes the call to pp_clear_define_state from pp_finish which is called after each file is processed so the definitions are not cleared and adds a call to pp_clear_define_state to ShutdownCompiler to clear the memory. Any definition added by sub-objects are already cleared with a call to pp_restore_define_state in CompileRecursively so they will not be propagated to upper objects.
I think that a more correct patch should change pp_run to immediately return the text buffer and leave pp_finish at the end of the whole compile process, as the name implies.
@maccasoft I have applied your proposed patch. This at least fixes the main bug here.
When using -u, there will still be double messages because it compiles twice.
Changing from bug to enhancement, since the bug should be fixed, and all that remains is cosmetic enhancement.
Newton has no cat (subobject):
Compiling without defining
X
looks ok:Compiling with
-D
(-efining)X
and with and without-a
(-lternative preprocesor) looks ok too...Now adding
-u
(-ncertainty):But now for something not really completely different:
Schroedinger has a cat (subobject):
Compiling without a define and without
-u
(-ncertainty):Compiling with defining
X
and not using-u
(-ncertainty):This is confusing enough, so adding
-u
(-ncertainty) is not needed to make my head spin...Meow!
Can please someone explain this to me without using quantum physics?