Re: No warnings for unreferenced code in eu40b2 build r3025

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

I'm not sure that I agree with Derek that even "one routine_id() whose argument is not a literal" automatically means that "any routine could be called" thus defeating a check for unreferenced code. This is because routine_id() can only reach as far as it's scope allows - anything outside that is fair game for analysis.

While that is true, it's actually the call_proc() that is in question here. For example, a call to routine_id() can fetch a valid ID value then pass that value to another routine that in turn runs call_proc().

A library file ...

--- filea.e 
procedure PROC_foo() 
   puts(1, "called\n") 
end procedure 
 
public function getrid( sequence name) 
   return routine_id("PROC_" & name) 
end function 
---- end of filea.e --- 


The app file ...

-- myapp.ex 
include filea.e 
integer rid 
sequence cmds 
 
cmds = command_line() 
rid = getrid(cmds[3]) 
call_proc( rid,{}) 
-- end of myapp.ex 

Here is an example of the parser not knowing if 'PROC_foo' is ever called, and notice that if the user runs it as eui myapp foo then it will be called even though it is out of myapp's scope.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu