
Now if it could only handle C style preprocessing...
Example:
CODE
default
{
state_entry()
{
integer e = llGetAttached();
integer f;
if(f = e)//monkey$[E20002]monkey
{
llOwnerSay("hello");
}
}
}
These forums are CLOSED. Please visit the new forums HERE
lslint - offline code checker for LSL |
|
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2006 04:30
Could you make it so that the error ignoring code can ignore warnings without having to use the "-A" switch (then i can pretend i have writen nice code, "see no warning ^_^"
![]() Now if it could only handle C style preprocessing... Example: CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2006 04:43
things get interesting when you use us $[Exxxx] on a line without an error on it.
use the "-A" switch to convert the assertions to errors. CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2006 04:53
wrong error code, right idea. top notch detecting this, i wasn't expecting it.
CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Masakazu Kojima
ケロ
![]() Join date: 23 Apr 2004
Posts: 232
|
02-15-2006 05:13
Could you make it so that the error ignoring code can ignore warnings without having to use the "-A" switch. The purpose of the assertions and the -A switch is so that I can automatically run a bunch of test scripts and ensure that nothing has snuck by me, and that the results are consistent across platforms. Now if it could only handle C style preprocessing... I have been playing with the idea of an optimizing LSL->LSL compiler with includes, constants, inline functions, and things like that though. edit: wrong error code, right idea. top notch detecting this, i wasn't expecting it. |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2006 19:15
I have been playing with the idea of an optimizing LSL->LSL compiler with includes, constants, inline functions, and things like that though. I know alot about how LSL works. I can give you tips on what programing methods will result in faster scripts. like CODE
EDIT: just to clear up any fears of a memory leak. The result of llGetFreeMemory stabilizes after a couple iterations. CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Folco Boffin
Mad Moo Cow Cultist
![]() Join date: 27 Feb 2005
Posts: 66
|
02-15-2006 20:44
Strife: You scare me sometimes. And on that note, how about a thread or a notecard available in world or somewhere that has a giant list of these types of code optimizations so we can start coding like that be default? I know I wouldn't have thought of setting a varible to ZERO_VECTOR for speed and space saving. It would definatly be an aid until we get a optimising LSL -> LSL compiler.
Even after we get mono, these types of things should still make it run faster and save space compared to not using them correct? Even with the speed boost (and I've heard more memory too) it still doesn't hurt to optimize it further. Bloat is bad even if it still works. _____________________
^-^
Signed, Gorgarath, Whom in this game called Second Life, plays the avatar Folco Boffin, and in this game called First Life, plays the avatar John McDonnell. |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2006 21:07
A good compiler CLI compiler will handle optimization as should the CLR IMHO. Though it cannot hurt to give it a jump start.
Alot of ways to make things run faster result in strange side-effects or very unreadable code. A tip: don't call a function more then once if you don't have to, store the results in a temp variable instead. This will be faster and save you memory. Function calls are *expensive* _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Logan Bauer
Inept Adept
![]() Join date: 13 Jun 2004
Posts: 2,237
|
02-16-2006 09:49
This is excellent, works well with SlickEdit too. I have just become that much more unproductive at my real job *laughs* My sentiments exactly. ![]() Masakazu I cannot thank you enough for this. ![]() _____________________
![]() PICS - BLOG - http://arcticgreenhouse.blogspot.com/ XSTREET - INWORLD -http://slurl.com/secondlife/Alternate Reality/144/138/54/ |
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
|
02-17-2006 21:29
Great work on this, very helpful. Love the 'declared but never used' warning.
![]() CODE default ERROR:: ( 5, 23): `PAY_HIDE' is undeclared. ERROR:: ( 5, 3 ![]() Also, could lslint give a warning if used in a state without a money() event handler since it has no effect? _____________________
|
Masakazu Kojima
ケロ
![]() Join date: 23 Apr 2004
Posts: 232
|
02-18-2006 07:51
0.2.3: 2006-02-18
- added error when exceeding SL's parser's max token stack depth (150) - fixed ZERO_VECTOR and ZERO_ROTATION expressions (0011, reported by Strife) - added PAY_HIDE, PAY_DEFAULT, DATA_SIM_RATING constants (0012, reported by Kayla Stonecutter) - changed to gcc-style if(a=x) warnings; if((a=x)) doesn't warn. http://w-hat.com/lslint/ Is anyone using the Mac or Linux versions? I've seen them downloaded, but nobody's said anything. I'd really like to hear if they are working, since the only machines I have to test them on are the ones I compiled them on. I am bz2'ing the Mac version now since UPX doesn't work on Macs and the binaries are huge, but if this gives anyone trouble I can switch to another compression format. Also, could lslint give a warning if [llSetPayPrice()] used in a state without a money() event handler since it has no effect? It could also warn about llSetTimer() in a script with no timer() event, llListen() in a state with no listen(), llGetNotecardLine() and friends with no dataserver(), llOpenRemoteDataChannel() with no remote_data(), and probably lots of others. Maybe even things like using llResetTime() without ever using llGetTime() or llGetAndResetTime() afterward. It could even warn about them when they're buried in functions, and skip some if you eventually change into a state that handles them. I am making some internal changes for 0.3 that will make it easier to track constants and follow code paths, so I will probably add them to that. |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-18-2006 12:42
It could also warn about llSetTimer() in a script with no timer() event... A warning about llSetTimerEvent() not being zero'ed on state change would probably be a good thing in multi-state scripts. Thread _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Kermitt Quirk
Registered User
![]() Join date: 4 Sep 2004
Posts: 267
|
02-25-2006 21:25
A little bit of oddness going on with one of the warnings. The script below returns...
WARN:: ( 12, 7): condition is always true Line 12 is the "if (count == 0)" line. Seems like it's assuming the result of llList2Integer will always be zero. I've also seen "condition is always false" raised as a result of the same thing. CODE default { |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
02-26-2006 04:00
Is anyone using the Mac or Linux versions? I've seen them downloaded, but nobody's said anything. |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-26-2006 07:19
Oh btw the compiler doesn't seem to be catching
while(a = b) so i suspect its also not going to catch for(;a=b;) like it does with if(a=b) _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Keknehv Psaltery
Hacker
![]() Join date: 11 Apr 2005
Posts: 1,185
|
02-26-2006 14:31
It could also warn about ... llGetNotecardLine() and friends with no dataserver(), llOpenRemoteDataChannel() with no remote_data(), Dataserver triggers an event on the prim, so other scripts in the prim could receive the information. I believe remote_data probably does the same thing, but I don't have a server to test this with. _____________________
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
02-26-2006 15:36
I believe remote_data probably does the same thing, but I don't have a server to test this with. Nope, remote_data is triggered on a per-script basis (the channel ID refers to the script specifically). You could have a warning trigger if llSensor is called without either a no_sensor or sensor event (the script would need at least one). The same applies to llTarget/llRotTarget and at_target/not_at_target and at_rot_target/not_at_rot_target, at least one of their associated events should be declared, or a warning issued. ==Chris _____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
|
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
|
03-01-2006 04:17
A little bit of oddness going on with one of the warnings. The script below returns... WARN:: ( 12, 7): condition is always true Line 12 is the "if (count == 0)" line. Seems like it's assuming the result of llList2Integer will always be zero. I've also seen "condition is always false" raised as a result of the same thing. Ran across this in one of my scripts and decided to mess around with it; here's what I found out: CODE list testlist = [0.3, 0.2, 0.5];returns: WARN:: ( 17, 12): Condition is always false. Which is the if(test == 3). But inworld the object says "True" as expected. However, if I don't specify test = 0 in the decleration as such: CODE list testlist = [0.3, 0.2, 0.5];There is no error ![]() _____________________
|
Masakazu Kojima
ケロ
![]() Join date: 23 Apr 2004
Posts: 232
|
03-01-2006 05:03
It is not counting ++/-- as an assignment when it looks for constants, so if you never assign to a variable normally, it (incorrectly) assumes that its value never changes. This is fixed in 0.3, which is much better at constant propagation in general (using SSA form) and lays the foundation for an optimizing compiler. I will release it in about a week.
|
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
03-01-2006 20:39
ERROR:: (672, 41): Invalid operator: integer + float.
bogus error. LSL supports this. _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
03-07-2006 20:33
Another bug, lslint thinks this is valid, it's not. "<<" only works on integer << integer
CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Masakazu Kojima
ケロ
![]() Join date: 23 Apr 2004
Posts: 232
|
03-08-2006 13:00
0.2.4: 2006-03-08
- fixed ++/-- not counted as assignment - fixed integer - float and integer + float http://w-hat.com/lslint/ |
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
|
03-09-2006 04:11
Wow! This is fantastic Masakazu !!!
Seems I'm last to discover this has been out ![]() Thanks for making it available |
Chris Widget
Widget Isles @ the Edge!
Join date: 22 Jan 2006
Posts: 67
|
03-09-2006 08:27
This is a great tool thanks so much. I am currently testing the Windows version but I will load it up tonight on my shiny new duo core imac and let you know if there are any issues with that distribution. Thanks again !
----- Chris Widget "testing another anti-productivity tool" |
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
|
03-10-2006 18:20
Masakazu,
You don't happen to know whether there is a way in SciTE to arrange it so after compiling if you double click on one of the errors in the bottom pane it could auto-highlight the line of code? i.e. this works in SciTE when you do something that "find in files", i.e. click on one of the match lines and it opens the file and takes you to the line in quesiton Greg |
Masakazu Kojima
ケロ
![]() Join date: 23 Apr 2004
Posts: 232
|
03-10-2006 18:38
You don't happen to know whether there is a way in SciTE to arrange it so after compiling if you double click on one of the errors in the bottom pane it could auto-highlight the line of code? I will add a switch in 0.3 to set the error format. |