Optimizing header file include directives

  • Authors:
  • Diomidis Spinellis

  • Affiliations:
  • Athens University of Economics and Business, Patision 76, GR-104 34 Athens, Greece

  • Venue:
  • Journal of Software Maintenance and Evolution: Research and Practice
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

A number of widely used programming languages use lexically included files as a way to share and encapsulate declarations, definitions, code, and data. As the code evolves files included in a compilation unit are often no longer required, yet locating and removing them is a haphazard operation, which is therefore neglected. The difficulty of reasoning about included files stems primarily from the fact that the definition and use of macros complicates the notions of scope and of identifier boundaries. By defining four successively refined identifier equivalence classes we can accurately derive dependencies between identifiers. A mapping of those dependencies on a relationship graph between included files can then be used to determine included files that are not required in a given compilation unit and can be safely removed. We validate our approach through a number of experiments on numerous large production systems. Copyright © 2008 John Wiley & Sons, Ltd.