Page 1 of 1
How to ignore warnings?
Posted: Sun May 10, 2015 12:32 am
by bodom
Hi there,
is there a way to tell the compiler to ignore a warning once i have verified it?
Thank you
Re: How to ignore warnings?
Posted: Wed Jul 15, 2015 4:29 pm
by Yukiko
Have you tried clearing the DisplayWarnings setting in eCompile.cfg?
Re: How to ignore warnings?
Posted: Sun Jul 26, 2015 12:14 am
by bodom
Sadly, that will just hide ALL warnings, that's not what I am looking for, i just want to exclude some specific warnings.
Re: How to ignore warnings?
Posted: Fri Jul 31, 2015 2:40 pm
by CWO
What specific warnings would you like to ignore?
Giving one general example (bear with me, I haven't coded POL in years)
Code: Select all
foreach entry in SomeArrayOfStrings
SendSysMessage(who, SomeArrayOfStrings{_entry_iter]);
endforeach
The above code will generate a compiler warning that variable 'entry' is declared but never used. But I absolutely must have the variable and I do use it. So I stick in an entry := entry; to stop the warning.
Re: How to ignore warnings?
Posted: Sat Aug 01, 2015 11:39 pm
by Yukiko
CWO wrote:What specific warnings would you like to ignore?
Giving one general example (bear with me, I haven't coded POL in years)
Code: Select all
foreach entry in SomeArrayOfStrings
SendSysMessage(who, SomeArrayOfStrings{_entry_iter]);
endforeach
The above code will generate a compiler warning that variable 'entry' is declared but never used. But I absolutely must have the variable and I do use it. So I stick in an entry := entry; to stop the warning.
I know that's the type of warnings I want to suppress. I've used the same technique CWO but it is cumbersome.
You know, I never quite understood why that generates a "not used" warning because technically it is used as an iterator (is that the right word?) in the
foreach statement.
Re: How to ignore warnings?
Posted: Thu Aug 06, 2015 9:16 am
by bodom
Yep, your "entry .= entry" example does exactly what i am looking for. It sadly has the drawback of generating code that will waste instruction cycles when excuted.
My goal is to put some sort of annotation in the code to say the compiler "i know this should trigger a warning, but i have already checked it and it's ok like this, please don't warn me".
Thank you!
Re: How to ignore warnings?
Posted: Mon Aug 17, 2015 2:43 pm
by CWO
I believe you can do it before the foreach so you only do it once and get rid of the warning. Again, haven't programmed POL in a long time so this might be me just overthinking...
var entry := 0;
entry := entry;
foreach entry ....
Re: How to ignore warnings?
Posted: Thu Aug 27, 2015 5:25 am
by bodom
To follow up, I think time has come for me to give some contribution to the core.
I am not a C++ programmer, but I am used to learn fast, so I thought this easy mod was a good place where to start.
I have added a new "unused" keywork to the eScript language. It has no practical effect, but tell the compiler not to issue a warning if the given variable is not used. The compiler will instead issue a warning if the given variable is used.
Example:
Code: Select all
program onremovescript( character, container, unused item, unused item_amount, movetype )
<some code here...>
endprogram
function myfunc( parameter1, unused parameter_for_future_use )
<some code here...>
endfunction
Hope this will be useful to others who, like me, don't really like warnings

I will release the code as soon as I will complete testing.