Extracting undefined identifiers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nd.sundar@gmail.com

    Extracting undefined identifiers

    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.
  • vippstar@gmail.com

    #2
    Re: Extracting undefined identifiers

    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.

    Comment

    • CBFalconer

      #3
      Re: Extracting undefined identifiers

      nd.sundar@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.

      Comment

      Working...