Program refactoring in the presence of preprocessor directives

作者: , Alejandra Garrido

DOI: 10.35537/10915/4167

关键词:

摘要: The C preprocessor is heavily used in C programs because it provides useful and even necessary additions to the C language. Since preprocessor directives are not part of C, they are removed before parsing and program analysis take place, during the phase called preprocessing. In the context of refactoring, it is inappropriate to remove preprocessor directives: if changes are applied on the preprocessed version of a program, it may not be possible to recover the un-preprocessed version. This means that after refactoring, all the source code would be contained in a single unit, targeted to a single configuration and without preprocessor macros. This thesis describes a novel approach to preserve preprocessor directives during parsing and program analysis, and integrate them in the program representations. Furthermore, it illustrates how the program representations are used during refactor ing and how transformations preserve preprocessor directives. Additionally, the semantics of the C preprocessor are formally specified, and the results of implementing this approach in a refactoring tool for C, CRefactory, are presented.

参考文章(37)
Mel Ó Cinnéide, Automated application of design patterns : a refactoring approach Trinity College (Dublin, Ireland). School of Computer Science & Statistics. ,(2001)
M. M. Lehman, Laws of Software Evolution Revisited european workshop on software process technology. pp. 108- 124 ,(1996) , 10.1007/BFB0017737
William F. Opdyke, Brian Foote, Lifecycle and refactoring patterns that support evolution and reuse Pattern languages of program design. pp. 239- 257 ,(1995)
Mitchell Wand, Daniel P. Friedman, Christopher T. Haynes, Essentials of Programming Languages ,(2008)
Peter A. Darnell, Philip E. Margolis, The C Preprocessor Springer Books on Professional Computing. pp. 316- 340 ,(1991) , 10.1007/978-1-4684-0383-1_10
Richard Helm, John Vlissides, Ralph Johnson, Erich Gamma, Design Patterns: Elements of Reusable Object-Oriented Software ,(1994)
S.S. Some, T.C. Lethbridge, Parsing minimization when extracting information from code in the presence of conditional compilation workshop on program comprehension. pp. 118- 125 ,(1998) , 10.1109/WPC.1998.693328
M.M. Lehman, On understanding laws, evolution, and conservation in the large-program life cycle Journal of Systems and Software. ,vol. 1, pp. 213- 221 ,(1979) , 10.1016/0164-1212(79)90022-0
Margaret-Anne D. Storey, Kenny Wong, Hausi A. Müller, Rigi: a visualization environment for reverse engineering international conference on software engineering. pp. 606- 607 ,(1997) , 10.1145/253228.253496
Darren C. Atkinson, William G. Griswold, Effective whole-program analysis in the presence of pointers foundations of software engineering. ,vol. 23, pp. 46- 55 ,(1998) , 10.1145/288195.288217