1. Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by fizzpopsoft Feb 12, 2013
- 1517 views
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
2. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by fizzpopsoft Feb 12, 2013
- 1491 views
eui -STRICT also does not warn about the unreferenced procedure or function, it does warn about the unused parm in test2
3. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by jimcbrown (admin) Feb 12, 2013
- 1478 views
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?
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.)
4. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by DerekParnell (admin) Feb 12, 2013
- 1495 views
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.
5. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by mattlewis (admin) Feb 12, 2013
- 1469 views
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
6. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by fizzpopsoft Feb 12, 2013
- 1470 views
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
7. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by mattlewis (admin) Feb 12, 2013
- 1557 views
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
8. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by EUWX Feb 12, 2013
- 1475 views
It is NOT a bug.
At best, one can issue a warning during compilation, or at the beginning of interpretation.
9. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by useless_ Feb 12, 2013
- 1468 views
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.
Thanks Gents,
Alan
useless
(a non-gent)
10. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by petelomax Feb 13, 2013
- 1403 views
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
11. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by petelomax Feb 13, 2013
- 1398 views
Sometimes I wish I could just leave things alone...
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.
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?
12. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by mattlewis (admin) Feb 13, 2013
- 1397 views
Sometimes I wish I could just leave things alone...
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.
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
13. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by jimcbrown (admin) Feb 13, 2013
- 1382 views
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.
14. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by DerekParnell (admin) Feb 13, 2013
- 1364 views
Sometimes I wish I could just leave things alone...
Yep ...
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.
- What is helpful for one may be not so to another.
- 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.
- 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.
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.
15. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by SDPringle Feb 13, 2013
- 1363 views
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
16. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by jimcbrown (admin) Feb 13, 2013
- 1390 views
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.
17. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by SDPringle Feb 13, 2013
- 1359 views
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.
18. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by jimcbrown (admin) Feb 13, 2013
- 1366 views
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.
19. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by fizzpopsoft Feb 14, 2013
- 1326 views
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
20. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by mattlewis (admin) Feb 14, 2013
- 1328 views
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
21. Re: Bug in 4.0.5? EUI, no warning for unused procedures/functions
- Posted by fizzpopsoft Feb 14, 2013
- 1290 views
OK,
ticket request #850 has been raised for this.
Here's hoping :)