Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
Program refactoring in the presence of preprocessor directives
Publisher:
  • University of Illinois at Urbana-Champaign
  • Champaign, IL
  • United States
ISBN:978-0-542-44639-9
Order Number:AAI3199001
Pages:
207
Reflects downloads up to 16 Jan 2025Bibliometrics
Skip Abstract Section
Abstract

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 refactoring 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.

Cited By

  1. Liebig J, Apel S, Janker A, Garbe F and Oster S (2017). Handling Static Configurability in Refactoring Engines, Computer, 50:7, (44-53), Online publication date: 1-Jan-2017.
  2. Hills M Variable feature usage patterns in PHP Proceedings of the 30th IEEE/ACM International Conference on Automated Software Engineering, (563-573)
  3. Liebig J, Janker A, Garbe F, Apel S and Lengauer C Morpheus Proceedings of the 37th International Conference on Software Engineering - Volume 1, (380-391)
  4. ACM
    Overbey J, Behrang F and Hafiz M A foundation for refactoring C with macros Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, (75-85)
  5. Méndez M, Tinetti F and Overbey J Climate models Proceedings of the 2nd International workshop on Software Engineering for High Performance Computing in Computational Science and Engineering, (6-12)
  6. ACM
    Hafiz M, Overbey J, Behrang F and Hall J OpenRefactory/C Proceedings of the 2013 ACM workshop on Workshop on refactoring tools, (1-4)
  7. ACM
    Hills M, Klint P and Vinju J An empirical study of PHP feature usage: a static analysis perspective Proceedings of the 2013 International Symposium on Software Testing and Analysis, (325-335)
  8. Overbey J Immutable source-mapped abstract syntax tree Proceedings of the 20th Conference on Pattern Languages of Programs, (1-8)
  9. Tartler R, Sincero J, Dietrich C, Schröder-Preikschat W and Lohmann D (2012). Revealing and repairing configuration inconsistencies in large-scale system software, International Journal on Software Tools for Technology Transfer (STTT), 14:5, (531-551), Online publication date: 1-Oct-2012.
  10. ACM
    Kästner C, Giarrusso P, Rendel T, Erdweg S, Ostermann K and Berger T (2011). Variability-aware parsing in the presence of lexical macros and conditional compilation, ACM SIGPLAN Notices, 46:10, (805-824), Online publication date: 18-Oct-2011.
  11. ACM
    Kästner C, Giarrusso P, Rendel T, Erdweg S, Ostermann K and Berger T Variability-aware parsing in the presence of lexical macros and conditional compilation Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications, (805-824)
  12. ACM
    Liebig J, Kästner C and Apel S Analyzing the discipline of preprocessor annotations in 30 million lines of C code Proceedings of the tenth international conference on Aspect-oriented software development, (191-202)
  13. ACM
    Sincero J, Tartler R, Lohmann D and Schröder-Preikschat W (2010). Efficient extraction and analysis of preprocessor-based variability, ACM SIGPLAN Notices, 46:2, (33-42), Online publication date: 26-Jan-2011.
  14. ACM
    Kenner A, Kästner C, Haase S and Leich T TypeChef Proceedings of the 2nd International Workshop on Feature-Oriented Software Development, (25-32)
  15. ACM
    Sincero J, Tartler R, Lohmann D and Schröder-Preikschat W Efficient extraction and analysis of preprocessor-based variability Proceedings of the ninth international conference on Generative programming and component engineering, (33-42)
  16. ACM
    Kitlei R, Bozó I, Kozsik T, Tejfel M and Tóth M Analysis of preprocessor constructs in Erlang Proceedings of the 9th ACM SIGPLAN workshop on Erlang, (45-56)
  17. Spinellis D (2010). CScout, Science of Computer Programming, 75:4, (216-231), Online publication date: 1-Apr-2010.
  18. ACM
    Overbey J and Johnson R Regrowing a language Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications, (493-502)
  19. ACM
    Overbey J and Johnson R (2009). Regrowing a language, ACM SIGPLAN Notices, 44:10, (493-502), Online publication date: 25-Oct-2009.
  20. ACM
    Adams B, De Meuter W, Tromp H and Hassan A Can we refactor conditional compilation into aspects? Proceedings of the 8th ACM international conference on Aspect-oriented software development, (243-254)
  21. Overbey J, Negara S and Johnson R Refactoring and the evolution of Fortran Proceedings of the 2009 ICSE Workshop on Software Engineering for Computational Science and Engineering, (28-34)
  22. ACM
    Adams B, Van Rompaey B, Gibbs C and Coady Y Aspect mining in the presence of the C preprocessor Proceedings of the 2008 AOSD workshop on Linking aspect technology and evolution, (1-6)
  23. ACM
    Padioleau Y, Lawall J, Hansen R and Muller G (2008). Documenting and automating collateral evolutions in linux device drivers, ACM SIGOPS Operating Systems Review, 42:4, (247-260), Online publication date: 25-Apr-2008.
  24. ACM
    Padioleau Y, Lawall J, Hansen R and Muller G Documenting and automating collateral evolutions in linux device drivers Proceedings of the 3rd ACM SIGOPS/EuroSys European Conference on Computer Systems 2008, (247-260)
  25. ACM
    Sultana N and Thompson S Mechanical verification of refactorings Proceedings of the 2008 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, (51-60)
  26. Meseguer J and Rou G (2007). The rewriting logic semantics project, Theoretical Computer Science, 373:3, (213-237), Online publication date: 30-Mar-2007.
  27. ACM
    Padioleau Y, Hansen R, Lawall J and Muller G Semantic patches for documenting and automating collateral evolutions in Linux device drivers Proceedings of the 3rd workshop on Programming languages and operating systems: linguistic support for modern operating systems, (10-es)
Contributors
  • University of Illinois Urbana-Champaign
  • Facultad de Informática, Universidad Nacional de La Plata

Recommendations