473,587 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatic detection of "dead" headers?

Detecting dead headers is an extremely tiresome and lengthy process. Is
there an automated utility available which might do this for me? That is,
some utility that will check my .cpp and .h files and determine which
headers that are referenced are unnecessary?
Jul 22 '05 #1
3 1595
On Tue, 5 Oct 2004 23:17:49 -0400, "Donovan Martin"
<no****@nospam. spam> wrote in comp.lang.c++:
Detecting dead headers is an extremely tiresome and lengthy process. Is
there an automated utility available which might do this for me? That is,
some utility that will check my .cpp and .h files and determine which
headers that are referenced are unnecessary?


Commercial product PC Lint, http://www.gimpel.org. And it does much
more. Worth many times its price.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #2
Jack Klein wrote:
Commercial product PC Lint, http://www.gimpel.org.
And it does much more. Worth many times its price.


Are you sure that you didn't mean

http://www.gimpel.com/
Jul 22 '05 #3
Donovan Martin wrote:
Detecting dead headers is an extremely tiresome and lengthy process. Is
there an automated utility available which might do this for me? That is,
some utility that will check my .cpp and .h files and determine which
headers that are referenced are unnecessary?


I wrote a shell script several years ago to do that. It's far from perfect,
but it's a start (and free). It searches for the name of the included file
in the file doing the including. If the nameis found more than once I
assume the include needs to be there.
#!/bin/tcsh
set tmpfil=un.inc.$ $
foreach f ( $* )
# See what file f "includes" (ignore <includes> - those are usually
# system things).
grep '^#include' $f | cut -f2 -d'"' | grep -v include | cut -f1 -d. >
$tmpfil
set firstPass=0

#
# For each file thus included...
#
foreach i (`cat $tmpfil`)
# If the name included appears more than once in the file
# being checked...
expr `grep $i $f | wc -l` \> 1 > /dev/null
if ( $status == "1" ) then
# Print the filename the 1st time we find a possibly useless include.
if ( `expr $firstPass == 0` ) then
set firstPass=1
echo $f
endif
# Print the name of the included file.
echo "\t" $i
endif
end
end
rm $tmpfil


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4887
by: Paul Schmidinger | last post by:
Hello, I have a windows-IIS-Webserver running PHP 4.3.0. However, there is no GD-Lib, so I tried to install it. What I did is this: - copy the file php_gd2.dll (which I have from another win-webserver with working GD-Lib) to C:\PHP\extensions - set the extensions-folder in php.ini to C:\PHP\extensions - remove the ";" before the...
12
9682
by: bhennon | last post by:
Hey all, I have a small php script that calls a random image at the following page. http://www.2006ymcanationals.com/random.php IT WORKS IF I go directly to the above link. I am trying to call that in another page so that i get a random image the page is http://2006ymcanationals.com/index.php using <img
5
1541
by: Brandon Potter | last post by:
Forgive me if this has already been covered... I use dual displays and have 2 - 3 Visual Studio .NET 2003's open at the same time, however, without fail, at some point during my session, the title bar and border of one of the VS.NET's copies 1/2 of its height and 1/2 of its width, so I end up with this floating titlebar and border taking up...
24
3851
by: AES/newspost | last post by:
On many web sites or pages (including my own home page) clicking on certain links will start downloading a PDF file, sometimes without the author having provided any warning in the text of the page that this is going to happen (although in some -- all? -- browsers the "next link" line at the bottom of the browser window may show that the next...
0
2258
by: John D. | last post by:
I am having problems inserting Decimal values into a DB2 database via a .NET/C# application which is using an OdbcDataAdapter. Other field types such as VarChar, Int, Date, etc work ok, and I can insert literal values into a decimal field, but any attempt to insert a decimal field via an OdbcParameter causes a System.InvalidOperationException...
13
5776
by: Paul T. RONG | last post by:
Hello there, This is the case: the mde I made works alright on my machine, but there is a small problem when I installed it on a user's machine (His machine's OS is Windows XP Pro and it has a Access 2k Runtime, my machine is in XP Pro and Access 2k): when I try to close a form use "Alt+C" key, there is a error saying "module not found"...
81
7263
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there be any advantage in having strcat and strcpy return a pointer to the "end" of the destination string rather than returning a
37
2196
by: mdh | last post by:
In one of the answers to a K&R exercise, the first couple of lines are: enum loop { NO, YES}; enum loop okloop=YES; I get the first line, but not the second. Sorry about the LOL question. Thanks in advance
3
1130
by: nino.altran | last post by:
In an aspx page there is the possibility to download a file. I don't want to give the user a direct link, so I wrote the following code: ..... try { byte buff = System.IO.File.ReadAllBytes(path); int filesize = buff.Length; Response.ClearHeaders();
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.