Re: No warnings for unreferenced code in eu40b2 build r3025
- Posted by DerekParnell (admin) Jan 04, 2010
- 1098 views
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.