Re: No warnings for unreferenced code in eu40b2 build r3025

new topic     » goto parent     » topic index » view thread      » older message » newer message
alanjohnoxley said...

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 

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu