473,881 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tool to analyze header dependencies & eliminate redundancy

We have a mature project that suffers long build times because many
modules pull in far more than they need. In the long term I would like
to refactor to break some of the dependencies, but I would like to
start by eliminating unneeded header includes. Is there a tool that
can parse a set of source files and identify redundancies?
Jul 23 '05 #1
3 4064
On Tue, 19 Jul 2005 19:20:37 -0700, Code4u <co****@gmail.c om> wrote in
comp.lang.c++:
We have a mature project that suffers long build times because many
modules pull in far more than they need. In the long term I would like
to refactor to break some of the dependencies, but I would like to
start by eliminating unneeded header includes. Is there a tool that
can parse a set of source files and identify redundancies?


Redundancies should be limited by include guards, or perhaps
implementation-specific options that some provide that prevent even
opening the file a second time to get to the header guard.

As for a tool that detects unnecessary inclusions, PC-Lint
(www.gimpel.com) does an excellent job of that in C code. They claim
to do so in C++ as well, but I haven't verified that as extensively as
I have with C.

--
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 23 '05 #2
Code4u wrote:
We have a mature project that suffers long build times because many
modules pull in far more than they need.
Most large C++ projects make that mistake.
In the long term I would like
to refactor to break some of the dependencies, but I would like to
start by eliminating unneeded header includes. Is there a tool that
can parse a set of source files and identify redundancies?


g++ has a compiler switch that prints all included files of a given
source file. 'makedepend' also finds out include dependencies. You can
analyze the output with a hand-written tool.
AFAIK, no tool is available that tells you which #includes can be
changed to forward declarations. BTW, before you start you need to read
Lakos 'Large-Scale C++ Software Design'.

Jul 23 '05 #3
Also check if your project supports precompiled headers.

grep for #include within your .h files

Create a dependency file (makedepends or if Visual Studio export
makefile with dependencies). Scan this manually or with a script to
find heavily used include files.

Stuart

Jul 23 '05 #4

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

Similar topics

6
3646
by: Michael Rozdoba | last post by:
I want to set a background colour on one level of headings, but have their width span only the text & a small amount of padding. I was styling display to inline to achieve this. Then I realised I need to have clear: left, to keep the headings against the lefthand side, should they come near floats. I can't see how to do this without having to introduce unpleasant extra markup.
7
2098
by: header_question | last post by:
Is it best to place all #include files in one header file seperate from all the other files in a project? What is the logic that determines the order of the #include files, does it depend on the order of function calls in main?
0
1650
by: Joerg Schoen | last post by:
Hi folks! "JSCPP" is a ANSI-C preprocessor and language parser. It can analyze or instrument C-code. The most prominent application currently is to add function trace calls to existing C programs simply by recompiling it. The tracing will show when functions are entered or left along with the arguments. Default is to trace EVERY function, but fine-grained control is possible through a custom header file.
3
2583
by: italia | last post by:
I have a database with 2 columns and more than million rows. The first column is the id Example of the data (2 columns)- 04731 CRM 04731 CRM 04731 CRM 04731 RVB 04731 RVB
2
1232
by: Justin T. Gibbs | last post by:
I'm currently using MSVC.Net 2003. My task is to extract header dependencies from C++ source code. To that end, I invoke "cl /E" and parse the preprocessor output. While this approach is effective, it is quite slow. The runtime of this command is so similar to actually compiling a file that I'm guessing it really is compiled even though no output is created. Can anyone answer a few questions about how cl performs preprocessing? 1)...
9
1746
by: Andrew | last post by:
Hi, I see some people prefer to use in headers (where possible) class declaration: // B.h class A; class B {
14
4845
by: talktozee2 | last post by:
I'm basically trying to replicate Excel in an Access report. I have 30+ rows of data from my query, and I need all 30+ rows to perform some calculations in VBA to distill the 30+ rows down to 12. I'm able to get the data and perform the calculation AND hide the unwanted rows by setting their Height = 0, but they still take up whitespace. I've tried to set the Visible property on each row to False, but then I can't reference them in VBA...
1
1735
by: IntellectYog | last post by:
Hello, Here I am to find How to add Tool Tip to the Peroperty and Methods written in my class , so that I can see then after calling it using Object of that class in source code. I need this in ASP.NET Is it possible ? and How ? I want to do this in manual coding and not to use any tool. Plz. suggest.
0
1118
by: Jeff Gaines | last post by:
On 29/08/2008 in message <F58652AE-D036-4EF5-8078-36A60D90D0F3@microsoft.comEd Kramer wrote: There is a crude in-built sorter which will sort column 1 either ascending or descending - turn it on with the sorting property. You are much better off rolling your own to take account of the different data types the LV may contain, you can also use it to set the sort icons.
0
9928
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10816
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9554
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5781
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.