By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,649 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

Extracting undefined identifiers

P: n/a
Hi,
I have a collection of C source files (.c and .h). I need to find
all identifiers which are used in that collection but not defined
within the collection. The identifiers include pre-processor macros/
defines, structure types, and variable/function names. Thus, if a file
uses a symbol A but no file in the collection defines A, then A should
appear in the list.

ctags comes close, but its -x option produces only a list of defined
symbols. The undefined symbols don't appear in the cross-reference.

cscope conveniently builds a database of all identifiers. Is there any
way to coax cscope to print out the undefined symbols?

Thanks very much!

Regards,
Sundar.
Nov 7 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Nov 7, 8:41 pm, nd.sun...@gmail.com wrote:
Hi,
I have a collection of C source files (.c and .h). I need to find
all identifiers which are used in that collection but not defined
within the collection. The identifiers include pre-processor macros/
defines, structure types, and variable/function names. Thus, if a file
uses a symbol A but no file in the collection defines A, then A should
appear in the list.

ctags comes close, but its -x option produces only a list of defined
symbols. The undefined symbols don't appear in the cross-reference.

cscope conveniently builds a database of all identifiers. Is there any
way to coax cscope to print out the undefined symbols?
This is quite off-topic. I can't think of an on-topic group.
You said ctags produces a list of defined identifiers, and cscope
produces a database of all the identifiers...
cscope - ctags = what you want.
Nov 8 '08 #2

P: n/a
nd*******@gmail.com wrote:
>
I have a collection of C source files (.c and .h). I need to find
all identifiers which are used in that collection but not defined
within the collection. The identifiers include pre-processor
macros/ defines, structure types, and variable/function names.
Thus, if a file uses a symbol A but no file in the collection
defines A, then A should appear in the list.
Look for a cross-reference tool that can scan a herd of files,
including .h files, and can detect and mark definitions. I used to
have one, but I lost the sources in a disk crash and have never
reworked it. That version usually required recompilation to handle
big sources, which wouldn't be needed today.

This is OT on c.l.c, and I don't know what group to recommend.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 9 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.