Embracing the C preprocessor during refactoring
- 26 June 2013
- journal article
- research article
- Published by Wiley in Journal of Software: Evolution and Process
- Vol. 25 (12) , 1285-1304
Abstract
C preprocessor directives are heavily used in C programs because they provide useful and even necessary additions to the C language. However, they are usually executed and discarded before any analysis is applied on C programs. In refactoring, preprocessor directives must be preserved through the whole process of parsing, analysis and transformation to retain editable yet correct source code. We propose a new preprocessing approach and special program representations that allow a program to be analyzed and transformed without losing its preprocessor directives, but treating them as first‐class program entities. These representations are essential for a correct refactoring tool. We also describe the challenges that preprocessor directives bring to refactoring and how the program representations that we propose solve those challenges. Finally, we give details of two refactorings and present some case studies with our successfully applied solution. Copyright © 2013 John Wiley & Sons, Ltd.Keywords
This publication has 9 references indexed in Scilit:
- An analysis of the variability in forty preprocessor-based software product lines2010
- CScout: A refactoring browser for CScience of Computer Programming, 2010
- Parsing C/C++ Code without Pre-processing2009
- Generating Rewritable Abstract Syntax Trees2009
- High-Fidelity C/C++ Code TransformationElectronic Notes in Theoretical Computer Science, 2005
- Analyzing multiple configurations of a C program2005
- An empirical analysis of c preprocessor useIEEE Transactions on Software Engineering, 2002
- Challenges of refactoring C programs2002
- A framework for preprocessor-aware C source code analysesSoftware: Practice and Experience, 2000