Is there a combination of cproto switches that can accomplish the following:
1. Extract all global variable definitions only (I believe -v comes close to that)
2. Extract all extern references (naturally.. after preprocessing)
(btw.. cproto is a great tool..)
1. Combine the -v and -f0 options to output only global variable definitions.
2. I don't think there's any way to extract extern references. The -v option does not generate definitions for variables defined with the extern specifier. It was implemented this way because it's a common practice for header files to declare extern variables.
The reason I ask is that I am trying to put together a few scripts that will check that extern references are true to their global.. (without reinventing the wheel)..
Right now I am using cproto to pull out the globals, and try and grep for extern references, and parse that.. But it's such a pain (since we use different macros that resolve to extern).. cproto is nice enough to preprocess the output so it's easy to parse the globals.. but the externs are 'any which way you like it'..
Log in to post a comment.