gcc - Detect unused functions in C -
this question has answer here:
i'm looking way check if c project, compiles elf, has unused functions, , locate them. functions declared not called anywhere in code.
the solution can 1 of:
- a utility goes through .c files, analysing them
- a utility goes through compiled elf file, has symbols, analysing statically
- a way warn unused functions in gcc (and -wunused-functions doesn't global functions)
the solution cannot 1 of:
- deleting unused functions in compile time, without knowing functions deleted
- analysing elf file in run-time, since not every function called in every run such
gprof
(some functions take days until called, in code flow can see called) - a utility discovers dead-code inside functions (i.e. code after return function), rather unused functions
thank you
the easiest way process object files in project, rather linker would. doesn't have other notice unreferenced symbols, easier writing linker.
the unix/linux/cygwin utility called lorder
want.
Comments
Post a Comment