Re: No warnings for unreferenced code in eu40b2 build r3025
- Posted by DerekParnell (admin) Jan 03, 2010
- 1169 views
Hmm...
But what about the linker when the object code is compiled and linked...
Its job is make sure a jump/goto/branch target is valid?
Else it must be a self modifying program to know where to branch to..
If all possible entry points (procedure / function) are compared with all branches, won't this show what is redundant?
It would be possible to add a warning for this, but if the application contains just one routine_id() whose argument is not a literal, then all bets are off - any routine could be called and the parser would not know if an unreferenced routine is not being indirectly called via the routine_id() facility.
For example...
procedure notcalled() puts(1, "I wasn't called\n") end procedure sequence cmd cmd = command_line() for i = 3 to length(cmd) do r = routine_id(cmd[i]) if r != -1 then call_proc(r,{}) end if end for
Given this program, the routine notcalled is not directly referenced, but it might still be called if the user runs the program as ...
eui myapp notcalled