Tool to display h-file hierarchy

Tool to display h-file hierarchy

Post by Ulrich Hage » Sat, 10 Nov 2001 20:42:22



Hi,

I am looking for a tool that will display the hierarchy of include
files for a C(++) source. For example for the following files

a.c:
#include "b.h"
#include "c.h"

b.h:
#include "d.h"

c.h:
#include "b.h"

the output would look similar to

a.c
  #include "b.h"
    #include "d.h"
  #include "c.h"
    #include "b.h"
      #include "d.h"

I guess this should be doable by analysing the result of the
preprocessor run during compilation, e.g. when compiling with
'gcc -save-temps'.

Does anybody know if such a tool exists, and if so, where I can find
it? I would like to run it in RedHat Linux 7.1, compiler is gcc-3.0.

Thanks

Ulrich

PS: Probably someone will reply along the lines of "But this is
already included with RH Linux!", and make me look stupid. But what
the heck ...

 
 
 

Tool to display h-file hierarchy

Post by Thomas Dicke » Sat, 10 Nov 2001 23:41:08



> I am looking for a tool that will display the hierarchy of include
> files for a C(++) source. For example for the following files

...

Quote:> I guess this should be doable by analysing the result of the
> preprocessor run during compilation, e.g. when compiling with
> 'gcc -save-temps'.
> Does anybody know if such a tool exists, and if so, where I can find
> it? I would like to run it in RedHat Linux 7.1, compiler is gcc-3.0.

It would have to be gcc-specific (there's not enough info in the output from
some other compilers - Sun for instance lobotomized theirs 5-6 years ago).  I
did some related work in cproto (to keep track of levels of include-files to
selectively emit prototypes from a limited depth of includes).

        http://dickey.his.com/cproto

(it might be useful to make that generate a hierarchy listing)

But generally if I want to know the include structure, I just edit the .i file
and select the "#" lines into a different buffer.

--

http://dickey.his.com
ftp://dickey.his.com

 
 
 

Tool to display h-file hierarchy

Post by Denis V. Savi » Sat, 10 Nov 2001 23:07:32



> Hi,

> I am looking for a tool that will display the hierarchy of include
> files for a C(++) source. For example for the following files

> a.c:
> #include "b.h"
> #include "c.h"

> b.h:
> #include "d.h"

> c.h:
> #include "b.h"

> the output would look similar to

> a.c
>   #include "b.h"
>     #include "d.h"
>   #include "c.h"
>     #include "b.h"
>       #include "d.h"

> I guess this should be doable by analysing the result of the
> preprocessor run during compilation, e.g. when compiling with
> 'gcc -save-temps'.

> Does anybody know if such a tool exists, and if so, where I can find
> it? I would like to run it in RedHat Linux 7.1, compiler is gcc-3.0.

gcc -H
 
 
 

Tool to display h-file hierarchy

Post by Frank Pilhof » Sun, 11 Nov 2001 01:19:39



> I am looking for a tool that will display the hierarchy of include
> files for a C(++) source.

> a.c
>   #include "b.h"
>     #include "d.h"
>   #include "c.h"
>     #include "b.h"
>       #include "d.h"

 `cpp -H a.c > /dev/null' does the trick for me.

        Frank

--

The great advantage of compact cars is that you can get twice as
many of them into traffic jams. - Alfred E. Neuman

 
 
 

Tool to display h-file hierarchy

Post by Ulrich Hage » Tue, 13 Nov 2001 14:37:48





>> Hi,

>> I am looking for a tool that will display the hierarchy of include
>> files for a C(++) source. For example for the following files

... snip

Quote:

>> Does anybody know if such a tool exists, and if so, where I can find
>> it? I would like to run it in RedHat Linux 7.1, compiler is gcc-3.0.

>gcc -H

Ah, I just knew it had to be there, but I never thought it would be
that easy.

Thanks a lot.

Ulrich
(Making mental not to myself to read _all_ man pages before posting
next question)

 
 
 

1. make - target/source dependency hierarchy tools?

Now that I am on a real UNIX based application project, I need to dig into
make a lot more.  One of the first things I could really use is a tool to help
me better understand the makefiles that I must deal with. I want something that
will generate a target-source dependency hierarchy listing for any given
[Mm]akefile.

Given that following target-source relationships in a makefile (which I have
taken from "Managing Projects with Make", March 1990, page 6):

    program :   main.o iodat.o dorun.o lo.o \
                /usr/fred/lib/crtnb.a
        ld -o program main.o iodat.o dorun.o lo.o \
                /usr/fred/lib/crtnb.a

    main.o :    main.c
        cc -c main.c

    iodat.o :   iodat.c
        cc -c iodat.c

    dorun.o :   dorun.c
        cc -c dorun.c

    lo.o :  lo.s
        as -o lo.o lo.s

I want to generate something like the following, which gives me an overview of
the target-source relationships:

    program
    .   main.o
    .   .   main.c
    .   iodat.o
    .   .   iodat.c
    .   dorun.o
    .   .   dorun.c
    .   lo.o
    .   .   lo.s
    .   /usr/fred/lib/crtnb.a

2. video card questions

3. file system hierarchy

4. DOS Attack

5. How to save a compressed copy of a file hierarchy on tape ?

6. Is there a way to supress mail from cron?

7. uncompress all files in a hierarchy?

8. configure network

9. How to Printout AIX File Tree/Hierarchy?

10. Why do glib and clib have different include file hierarchy ?

11. *exclude* a file-hierarchy from "find"-cmd?

12. Read-only hierarchy in "tar" file

13. Copying certain file (types) to a parallel hierarchy?