Connecting Tech Pros Worldwide Forums | Help | Site Map

tool to check multiple inclusion of header file

techBoy
Guest
 
Posts: n/a
#1: Mar 14 '06
I am looking for a tool which can scan my source code and tell me if a
header file gets included more then once in a sequence of source file
or header files. Can some one guide me to such a tool !!


Vladimir S. Oka
Guest
 
Posts: n/a
#2: Mar 14 '06

re: tool to check multiple inclusion of header file


On Tuesday 14 March 2006 10:13, techBoy opined (in
<1142331182.440984.157950@i39g2000cwa.googlegroups .com>):
[color=blue]
> I am looking for a tool which can scan my source code and tell me if a
> header file gets included more then once in a sequence of source file
> or header files. Can some one guide me to such a tool !![/color]

This is off-topic here, but...

<OT>
Did you consider using `grep` to find all occurrences of #include lines
(`grep` can tell you which files they belong to, and/or their total
count, as well)? Further clever processing of the `grep` output should
be able to give you the answer you want.

There may be better ways/specialised tools, but I'm not aware of them.
</OT>

--
BR, Vladimir

UH-OH!! I think KEN is OVER-DUE on his R.V. PAYMENTS and HE'S having a
NERVOUS BREAKDOWN too!! Ha ha.

pemo
Guest
 
Posts: n/a
#3: Mar 14 '06

re: tool to check multiple inclusion of header file


techBoy wrote:[color=blue]
> I am looking for a tool which can scan my source code and tell me if a
> header file gets included more then once in a sequence of source file
> or header files. Can some one guide me to such a tool !![/color]

May I ask why you want to do this? If it's because you're getting circular
references, you should perhaps use the following technique ...

#ifndef MY_HEADER_H
#define MY_HEADER_H

// MY_HEADER_H stuff here.

#endif

If it's not for that - just through curiosity, I'd be interested in knowing
the 'why'.

--
==============
Not a pedant
==============


ranjmis
Guest
 
Posts: n/a
#4: Mar 14 '06

re: tool to check multiple inclusion of header file



techBoy wrote:
[color=blue]
> I am looking for a tool which can scan my source code and tell me if a
> header file gets included more then once in a sequence of source file
> or header files. Can some one guide me to such a tool !![/color]

gcc preprocessor source code may give some insight

Rod Pemberton
Guest
 
Posts: n/a
#5: Mar 14 '06

re: tool to check multiple inclusion of header file



"techBoy" <myaskingquestions@yahoo.com> wrote in message
news:1142331182.440984.157950@i39g2000cwa.googlegr oups.com...[color=blue]
> I am looking for a tool which can scan my source code and tell me if a
> header file gets included more then once in a sequence of source file
> or header files. Can some one guide me to such a tool !![/color]

You can look for check, cproto, cdecl, ctool, cxref, etc. I don't recall
which one does what. Most of these are available from comp.sources.unix or
DECUS. But, you can Google them.

comp.sources.unix, cxref is in volume1:
http://ftp.sunet.se/pub/usenet/ftp.u....sources.unix/

DECUS:
Index (files unavailable) http://www.decus.org/encompass/software/
Files ftp://ftp.encompassus.org/lib/


Rod Pemberton


techBoy
Guest
 
Posts: n/a
#6: Mar 15 '06

re: tool to check multiple inclusion of header file


Yaa a header gurad is a good idea, I am already using that. Trying to
bring dwon my compilation time. So wanted to eliminate this aspect
first, and see to it that a header file doesn't get included more than
once.

Vladimir S. Oka
Guest
 
Posts: n/a
#7: Mar 15 '06

re: tool to check multiple inclusion of header file



techBoy wrote:[color=blue]
> Yaa a header gurad is a good idea, I am already using that. Trying to
> bring dwon my compilation time. So wanted to eliminate this aspect
> first, and see to it that a header file doesn't get included more than
> once.[/color]

Quoting context is essential, especially so when you make so many
spelling mistakes that it's hard to figure out what you're saying. Read
and heed <http://cfaj.freeshell.org/google/>.

--
BR, Vladimir

Closed Thread