Warning about unused lazy list function when in use
Closed this issue · 11 comments
// default.lsl
default
{
state_entry()
{
list a= ["b"];
llOwnerSay((string)a[0]);
}
}
and
default
{
state_entry()
{
list a= ["b"];
string c = (string)a[0];
llOwnerSay(c);
}
}
Emits the following:
> lslint --version
lslint v1.0.6
> lslint -m -z .\default.lsl
WARN:: ( 0, 0): function `lazy_list_set' declared but never used.
TOTAL:: Errors: 0 Warnings: 1
It basically happens on any script that lacks lazy list assignment, when you activate the -z
flag. Even the shortest script
default{timer(){}}
produces it. But a lazy list assignment gets rid of it:
default{timer(){list a;a[0]="";}}
I guess the function should only be added when an assignment exists, AND the function does not previously exist (the FS optimizer supports and relies on overwriting of functions: defining several functions with the same name is not an error, and the last function declared is the one that counts, which allows overriding the lazy_list_set
function).
I will look into that, thanks for the report.
I found that win xp build fails:
cl.exe -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_MT -MT /TP /D_MBCS /DYY_NO_UNISTD_H /EHsc /w lslmini.tab.c
lslmini.tab.c
z:\lslint\symtab.hh(19) : error C2059: syntax error : '{'
z:\lslint\symtab.hh(19) : error C2143: syntax error : missing ';' before '{'
z:\lslint\symtab.hh(19) : error C2143: syntax error : missing ';' before '}'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe"' : return code '0x2'
Stop.
Same for windows64: #61 (comment)
btw I'll departure for the trip in several hours, so anyway I'll merge coming PRs (and build if I can) next weekend...
All right.
z:\lslint\symtab.hh(19) : error C2059: syntax error : '{'
z:\lslint\symtab.hh(19) : error C2143: syntax error : missing ';' before '{'
z:\lslint\symtab.hh(19) : error C2143: syntax error : missing ';' before '}'
I didn't expect a syntax error. Could it be that builtins_txt.cc was not correctly generated for some reason?
Making a change in builtins.txt (e.g. something like the Unix touch
command) should force builtins_txt.cc to be regenerated.
Sorry, for some reason I expected the problem to be in builtins_txt.cc and I see that it has nothing to do with that.
The problem is the C++11 specific assignment:
lloc = {0,0,0,0};
Isn't the compiler C++11 capable?
Microsoft's Visual C++ Compiler v15.4.4
is mostly standard compliant, up to stdc++17
This might be an issue on windows XP, however.
Mako mentioned Windows XP, though, and I'm not sure what compiler she's using. If we have to support C++03 or earlier, then that patch needs to be rewritten in a different way (either with memset
or setting each field separately).
I would recommend keeping the C++11 version, and adding a WINXP preprocessor thing.. to wrap the C++03 code around