Extracting GLOBALS only mode...

Help
2000-12-15
2000-12-15
  • Richard Lyon

    Richard Lyon - 2000-12-15

    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..)

    Richard

     
    • Chin Huang

      Chin Huang - 2000-12-15

      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.

       
      • Richard Lyon

        Richard Lyon - 2000-12-15

        Hrmmm... 

        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'..

        Richard

         

Log in to post a comment.