admin管理员组文章数量:1122832
I'm looking at a LARGE code base 800 C files, 700 or so H files
There are a number of cases where: (A) a prototype exists in a header But (B) there is no actual implementation of the function.
I can solve (B) - but no (A).
To Solve (B) - I can compile everything and get symbol tables out of the object files that tells me what exists and is implemented.
To solve (A) - I have no means to extract DECLARED lists in header files etc in the form of a list.
NOTE: This is not a problem that: -Wimplicit-function-declaration will solve. The functions are implemented across the 800 or so C files (and some a few ASM files, these are covered because I will just run "nm" on all object files).
In some/many cases the developers wrote a list of "gee we should have these" functions, but never actually implemented the functions. Grr...
Is there a way to get this list of prototypes and globals vars out of GCC?
VISUAL studio does this - it puts squiggly green lines under the function name but - I'm not using Visual Studio
I'm looking at a LARGE code base 800 C files, 700 or so H files
There are a number of cases where: (A) a prototype exists in a header But (B) there is no actual implementation of the function.
I can solve (B) - but no (A).
To Solve (B) - I can compile everything and get symbol tables out of the object files that tells me what exists and is implemented.
To solve (A) - I have no means to extract DECLARED lists in header files etc in the form of a list.
NOTE: This is not a problem that: -Wimplicit-function-declaration will solve. The functions are implemented across the 800 or so C files (and some a few ASM files, these are covered because I will just run "nm" on all object files).
In some/many cases the developers wrote a list of "gee we should have these" functions, but never actually implemented the functions. Grr...
Is there a way to get this list of prototypes and globals vars out of GCC?
VISUAL studio does this - it puts squiggly green lines under the function name but - I'm not using Visual Studio
Share Improve this question asked Nov 22, 2024 at 0:33 user3696153user3696153 7527 silver badges16 bronze badges 4- It isn't quite clear what the actual problem is. Are you trying to extract a list of declared but unimplemented functions? – n. m. could be an AI Commented Nov 22, 2024 at 2:11
- yes exactly. put another way if i can get a list of all declared functions and variables in each of my 800 translation units, then i can later post process the 800 lists and come up with a list of missing implementations – user3696153 Commented Nov 22, 2024 at 14:32
- When you compile and link, you'll get "undefined function" errors for all the unimplemented functions. – Barmar Commented Nov 22, 2024 at 16:34
- Not the case - that only occurs if they are used in the application. If the function is not used, there is no error and no warning. – user3696153 Commented Nov 22, 2024 at 20:33
1 Answer
Reset to default 2ctags
is your friend.
ctags --kinds-c=f -ofunctions.lst -R .
ctags --kinds-c=p -oprototypes.lst -R .
You will get two files, one that lists function definitions and one with standalone function prototypes. You will need to diff
these files (suitably massaged) to get a list of prototypes that have no corresponding definitions anywhere.
For the same thing with variables, use --kinds-c=v
and --kinds-c=x
. You can combine several kinds, like --kinds-c=fv
.
I use Exuberant ctags, but there are other implementations out there which may or may not have these options.
本文标签: list of nonimpimented functions (GCC)Stack Overflow
版权声明:本文标题:list of non-impimented functions? (GCC) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736306360a1932928.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论