473,807 Members | 2,825 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 4055
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
3644
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
2096
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
1646
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
2582
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
1228
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
1744
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
4842
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
1733
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
1116
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
9720
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
10626
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10372
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
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
10112
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9193
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
7650
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
5546
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
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.