1. Bug in 4.0.5? EUI, no warning for unused procedures/functions

Hello gents and ladies,
I don't see a ticket for this:

-- demo of bug where no warning is given for a unused procedure or function 
-- 12 Feb 2013  with Euphoria v4.0.5 rev 2012-10-11, id 362497032f33 
-- using interpreter EUI 
-- 
with warning 
with type_check 
without profile 
with trace 
 
sequence public1 = "notimportant" 
integer public2 = 9 
 
function test1(sequence seq1) 
integer i1 
if compare(public1,seq1) = 0 then  
  i1 = 1 
 else  
  i1 = 0 
end if 
return i1   
end function 
 
procedure test3(sequence seq1) 
integer i1 
if compare(public1,seq1) = 0 then  
  i1 = 1 
 else  
  i1 = 0 
end if 
public2 = i1 
end procedure 
 
procedure test2(sequence seq1) 
integer i1 
i1 = 0 
public2 = i1 
end procedure 
 
procedure main() 
  test2("garbage") 
  sprintf("%d",{public2})  
end procedure 
 
main() 

There should be warnings about unused test1 and test3 shouldn't there?
Regards,
Alan

new topic     » topic index » view message » categorize

2. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

eui -STRICT also does not warn about the unreferenced procedure or function, it does warn about the unused parm in test2

new topic     » goto parent     » topic index » view message » categorize

3. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

fizzpopsoft said...

Hello gents and ladies,
I don't see a ticket for this:

Why not file a ticket yourself, if you think that you see a bug?

fizzpopsoft said...

demo of bug where no warning is given for a unused procedure or function

I don't think that's a bug - Euphoria doesn't give out warnings for unused procedures or functions.

I did test with Euphoria 2.3, and it doesn't give out warnings for these either. (Oddly enough, though, it gave a warning about parameter seq1 in test2() not being used, but the current Euphoria doesn't do that.)

new topic     » goto parent     » topic index » view message » categorize

4. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

fizzpopsoft said...

There should be warnings about unused test1 and test3 shouldn't there?

It's not a bug because interpreted Euphoria was not designed to give warnings about un-referenced routines. You might like to create a ticket as nominate it as an enhancement request. If you do, I'd suggest that only private routines be involved and then only warned about when the -STRICT option is used.

The bind process has options to list routines that are not referenced.

While developing a program or module, it is very common to have routines that are not used yet. That is why I would suggest that the -STRICT option be used to trigger the warnings.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

DerekParnell said...
fizzpopsoft said...

There should be warnings about unused test1 and test3 shouldn't there?

It's not a bug because interpreted Euphoria was not designed to give warnings about un-referenced routines. You might like to create a ticket as nominate it as an enhancement request. If you do, I'd suggest that only private routines be involved and then only warned about when the -STRICT option is used.

The bind process has options to list routines that are not referenced.

While developing a program or module, it is very common to have routines that are not used yet. That is why I would suggest that the -STRICT option be used to trigger the warnings.

I will add that you also have the capability to generate a code coverage report. It's documented under testing (i.e., eutest), but you can use it with any interpreted program.

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

OK,
I remember seeing the warnings about unused routines in an earlier Euphoria version;
this may have been the bind as you say, but yes it seems a enhancement request
where the warning will be produced with eui -STRICT is the way forward.
Perhaps an appropriate doc update too, once the enhancement has been incorporated.
I'll create that request.
I found the issue the "hard way" BTW with a 6000 line source program that is still not working ;)

Thanks Gents,
Alan

new topic     » goto parent     » topic index » view message » categorize

7. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

fizzpopsoft said...

OK,
I remember seeing the warnings about unused routines in an earlier Euphoria version;
this may have been the bind as you say, but yes it seems a enhancement request
where the warning will be produced with eui -STRICT is the way forward.
Perhaps an appropriate doc update too, once the enhancement has been incorporated.
I'll create that request.
I found the issue the "hard way" BTW with a 6000 line source program that is still not working ;)

This is getting to the range where unit tests can help a lot. Note that eutest works with euphoria's coverage feature. Also, coverage statistics can span multiple runs, so you can drive your code in different ways to make sure that you've covered all of your code paths.

Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

It is NOT a bug.
At best, one can issue a warning during compilation, or at the beginning of interpretation.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

fizzpopsoft said...

OK,
I remember seeing the warnings about unused routines in an earlier Euphoria version;
this may have been the bind as you say, but yes it seems a enhancement request
where the warning will be produced with eui -STRICT is the way forward.
Perhaps an appropriate doc update too, once the enhancement has been incorporated.
I'll create that request.
I found the issue the "hard way" BTW with a 6000 line source program that is still not working ;)


This was discussed before, and iirc the reason routines are not reported as unused is because routine_id() cannot be resolved until runtime.

fizzpopsoft said...


Thanks Gents,
Alan


useless
(a non-gent)

new topic     » goto parent     » topic index » view message » categorize

10. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

EUWX said...

It is NOT a bug.

Oh yes it is!

Nevermind, I just wanted to say that (in the original post)

    sprintf("%d",{public2}) 

will, btw, achieve diddly squat. It will create a string (such as "9") and then just throw it away, without displaying it or anything.

Pete

new topic     » goto parent     » topic index » view message » categorize

11. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

Sometimes I wish I could just leave things alone...

DerekParnell said...

It's not a bug because interpreted Euphoria was not designed to give warnings about un-referenced routines.

To me that reads the same as:

It's not a bug because Euphoria was not designed to be helpful. 

DerekParnell said...

While developing a program or module, it is very common to have routines that are not used yet. That is why I would suggest that the -STRICT option be used to trigger the warnings.

And if it did issue warnings that would anger or annoy you how, exactly?

new topic     » goto parent     » topic index » view message » categorize

12. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

petelomax said...

Sometimes I wish I could just leave things alone...

DerekParnell said...

It's not a bug because interpreted Euphoria was not designed to give warnings about un-referenced routines.

To me that reads the same as:

It's not a bug because Euphoria was not designed to be helpful. 

DerekParnell said...

While developing a program or module, it is very common to have routines that are not used yet. That is why I would suggest that the -STRICT option be used to trigger the warnings.

And if it did issue warnings that would anger or annoy you how, exactly?

At one point in 4.0 development, I think we had warnings for unused routines turned on. Nearly every program run ended with tons of such warnings. They were mostly library routines that you never used in your current program. That's the opposite of helpful. It's difficult to get the warning level tweaked correctly, and use of routine_id makes it even harder, of course.

I think the routine_id detection is quite a bit better now, so binding and getting the list might be useful. I'll also add that the coverage capabilities allow you to include or exclude files from coverage.

I recall unused parameters causing similar problems. Especially in a GUI app where your event handlers have a standard set of parameters, all of which rarely need to be used.

Matt

new topic     » goto parent     » topic index » view message » categorize

13. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

petelomax said...

And if it did issue warnings that would anger or annoy you how, exactly?

I can't see the output of my test program because of all the unused warnings coming from my unfinished library!!!

Of course, using the STRICT option would mitigate that significantly.

new topic     » goto parent     » topic index » view message » categorize

14. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

petelomax said...

Sometimes I wish I could just leave things alone...

Yep ... blink

petelomax said...
DerekParnell said...

It's not a bug because interpreted Euphoria was not designed to give warnings about un-referenced routines.

To me that reads the same as:

It's not a bug because Euphoria was not designed to be helpful. 

  1. What is helpful for one may be not so to another.
  2. There are many things that could have been added to the language that would be seen as helpful to some so does that also imply that the omission of these are all bugs? For example, parse-time enforcement of datatype usage.
  3. I'm pretty sure that as Euphoria is evolving, it is becoming more helpful. There are things in place now, which were never in Rob's edition of the language, that can be argued are helpful additions. This particular suggested enhancement would be helpful to some and that is why I recommend that it be added as a request for a future edition of the language.
-- Example of Parse-Time Datatyping. 
procedure Sample(integer x) 
   -- do something with 'x' 
end procedure 
Sample("ABC")  -- Fails at run time rather than at parse-time. 
petelomax said...
DerekParnell said...

While developing a program or module, it is very common to have routines that are not used yet. That is why I would suggest that the -STRICT option be used to trigger the warnings.

And if it did issue warnings that would anger or annoy you how, exactly?

It would not anger me, and I don't know where you got that idea from, but anyhow ... I can imagine that while developing an application or module, that during the repeated testing of it, messages that constantly reminded me that I haven't yet used certain routines would get tiresome and/or possibly mess up the intended console output of the program. However, towards the end of development or at specific cadence points in the development cycle, using the -STRICT command line option to double check for silly mistakes, would be a good idea, IMO.

new topic     » goto parent     » topic index » view message » categorize

15. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

petelomax said...
    sprintf("%d",{public2}) 

will, btw, achieve diddly squat. It will create a string (such as "9") and then just throw it away, without displaying it or anything.

Pete

Yes, in the pre-4.0 days that would be an error. It's a design decision that was made. I don't like it either but it's not a bug.

Shawn

new topic     » goto parent     » topic index » view message » categorize

16. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

SDPringle said...
petelomax said...
    sprintf("%d",{public2}) 

will, btw, achieve diddly squat. It will create a string (such as "9") and then just throw it away, without displaying it or anything.

Pete

Yes, in the pre-4.0 days that would be an error. It's a design decision that was made. I don't like it either but it's not a bug.

Shawn

I preferred using a tilde to mark it, to avoid having this happen by accident and also as a visual hook to make it more obvious that there was a return value that would be ignored.

new topic     » goto parent     » topic index » view message » categorize

17. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

jimcbrown said...
SDPringle said...
petelomax said...
    sprintf("%d",{public2}) 

will, btw, achieve diddly squat. It will create a string (such as "9") and then just throw it away, without displaying it or anything.

Pete

Yes, in the pre-4.0 days that would be an error. It's a design decision that was made. I don't like it either but it's not a bug.

Shawn

I preferred using a tilde to mark it, to avoid having this happen by accident and also as a visual hook to make it more obvious that there was a return value that would be ignored.

You really never needed any new syntax to this. Just have a global variable 'void' and assign to that.

new topic     » goto parent     » topic index » view message » categorize

18. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

SDPringle said...
jimcbrown said...
SDPringle said...
petelomax said...
    sprintf("%d",{public2}) 

will, btw, achieve diddly squat. It will create a string (such as "9") and then just throw it away, without displaying it or anything.

Pete

Yes, in the pre-4.0 days that would be an error. It's a design decision that was made. I don't like it either but it's not a bug.

Shawn

I preferred using a tilde to mark it, to avoid having this happen by accident and also as a visual hook to make it more obvious that there was a return value that would be ignored.

You really never needed any new syntax to this. Just have a global variable 'void' and assign to that.

Until someone used two libraries that both declared VOID. Then you have to deal with namespace headaches.

new topic     » goto parent     » topic index » view message » categorize

19. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

To summarize then,
have the warnings about unreferenced routines that are not from includes,
to be optionally generated. Any opinions as to if this option could be
via "eui -STRICT" or perhaps another parameter in eu.cfg ?
Regards, Alan

new topic     » goto parent     » topic index » view message » categorize

20. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

fizzpopsoft said...

To summarize then,
have the warnings about unreferenced routines that are not from includes,
to be optionally generated. Any opinions as to if this option could be
via "eui -STRICT" or perhaps another parameter in eu.cfg ?
Regards, Alan

There is actually a lot of configurability (beyond -strict) with the 4.0 warning system. I don't really use it much, but such a beast as we've been discussing in this thread would probably be added as a new with warning option.

We have not_used, but that appears to apply only to variables. Routines are a bit more difficult, of course, though if that option is turned on, we could run through the same process we use for binding. The translator is a lot more complex and does a more thorough job of removing routines, though I don't believe it gives a list of things it deletes.

Matt

new topic     » goto parent     » topic index » view message » categorize

21. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions

OK,
ticket request #850 has been raised for this.
Here's hoping :)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu