How to ignore warnings?

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
bodom
Former Developer
Posts: 140
Joined: Sat Feb 21, 2015 7:52 pm

How to ignore warnings?

Post by bodom »

Hi there,

is there a way to tell the compiler to ignore a warning once i have verified it?

Thank you
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: How to ignore warnings?

Post by Yukiko »

Have you tried clearing the DisplayWarnings setting in eCompile.cfg?
bodom
Former Developer
Posts: 140
Joined: Sat Feb 21, 2015 7:52 pm

Re: How to ignore warnings?

Post 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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: How to ignore warnings?

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: How to ignore warnings?

Post 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.
bodom
Former Developer
Posts: 140
Joined: Sat Feb 21, 2015 7:52 pm

Re: How to ignore warnings?

Post 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!
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: How to ignore warnings?

Post 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 ....
bodom
Former Developer
Posts: 140
Joined: Sat Feb 21, 2015 7:52 pm

Re: How to ignore warnings?

Post 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 :D I will release the code as soon as I will complete testing.
Post Reply