Re: No warnings for unreferenced code in eu40b2 build r3025
- Posted by LarryMiller Jan 03, 2010
- 1117 views
Hi, I did not find an open ticket for this.. perhaps I missed it?
-- show missing warnings about procedure / function never used -- Euphoria 4.0B2 build r3025 -- with warning with trace with type_check without profile -- procedure proc_not_called() atom a1, a2 a2 = 0 a1 = a2 a2 = a1 end procedure procedure proc_is_called() atom a1, a2 a2 = 0 a1 = a2 a2 = a1 end procedure function func_never_called(sequence junk) integer i1 i1 = 0 return i1 end function proc_is_called()
There are no eui (interpreter) or euc (watcom compiled) warnings about either the function or procedure never being used.
Regards, Alan
I believe this was a deliberate design decision, not a bug.
The problem is that it could be virtually impossible for the interpreter to reliably determine if a function or procedure is actually referenced. It may be called like this:
call_proc(routine_id("proc_not_called"),{})
This statement may or may not be called in a particular program run and may be in another file. The parameter for routine_id() isn't necessarily a literal but could be calculated at run time. In some programs specific procedures or functions are always called this way.
I believe that Rob Craig mentioned this in a post some years ago after v2.5 was released. At that time he was the only developer.