A Foundation for Refactoring C with Macros

被引:2
|
作者
Overbey, Jeffrey L. [1 ]
Behrang, Farnaz [1 ]
Hafiz, Munawar [1 ]
机构
[1] Auburn Univ, Dept Comp Sci & Software Engn, Auburn, AL 36849 USA
来源
22ND ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (FSE 2014) | 2014年
关键词
Refactoring; C; Preprocessor;
D O I
10.1145/2635868.2635908
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
This paper establishes the concept of preprocessor dependences as a foundation for building automated refactoring tools that transform source code containing lexical macros and conditional compilation directives, such as those provided by the C preprocessor (CPP). We define a preprocessor dependence graph (PPDG) that models the relationships among macro definitions, macro invocations, and conditional compilation directives in a file-the relationships that must be maintained for the semantics of the C preprocessor to be preserved. For many refactorings, a tool can construct a PPDG from the code before and after it is transformed, then perform a linear-time comparison of the two graphs to determine whether the refactoring will operate correctly in the presence of macros and conditional compilation directives. The proposed technique was implemented in OpenRefactory/C and tested by applying refactorings to GNU Coreutils version 8.21. Empirical results indicate that the technique is effective; it successfully handled refactoring scenarios in which Eclipse CDT, Visual Assist X, and XRefactory all refactored code incorrectly.
引用
收藏
页码:75 / 85
页数:11
相关论文
共 50 条
  • [41] Software Refactoring for System Modernization
    Santos, Bruno M.
    Garcia-Rodriguez de Guzman, Ignacio
    de Camargo, Valter V.
    Piattini, Mario
    Ebert, Christof
    IEEE SOFTWARE, 2018, 35 (06) : 62 - 67
  • [42] Refactoring-a Shot in the Dark?
    Leppanen, Marko
    Makinen, Simo
    Lahtinen, Samuel
    Sievi-Korte, Outi
    Tuovinen, Antti-Pekka
    Mannisto, Tomi
    IEEE SOFTWARE, 2015, 32 (06) : 62 - 70
  • [43] Towards Refactoring FRETish Requirements
    Farrell, Marie
    Luckcuck, Matt
    Sheridan, Oisin
    Monahan, Rosemary
    NASA FORMAL METHODS (NFM 2022), 2022, 13260 : 272 - 279
  • [44] Refactoring Code Clone Detection
    Othman, Zhala Sarkawt
    Kaya, Mehmet
    2019 7TH INTERNATIONAL SYMPOSIUM ON DIGITAL FORENSICS AND SECURITY (ISDFS), 2019,
  • [45] Refactoring Using Type Constraints
    Tip, Frank
    Fuhrer, Robert M.
    Kiezun, Adam
    Ernst, Michael D.
    Balaban, Ittai
    De Sutter, Bjorn
    ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2011, 33 (03):
  • [46] Quick Checking Refactoring Tools
    Drienyovszky, Daniel
    Horpacsi, Daniel
    Thompson, Simon
    ERLANG 2010: PROCEEDINGS OF THE 2010 ACM SIGPLAN, ERLANG WORKSHOP, 2010, : 75 - 80
  • [47] Scaling Testing of Refactoring Engines
    Mongiovi, Melina
    2016 IEEE/ACM 38TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING COMPANION (ICSE-C), 2016, : 674 - 676
  • [48] Automated process for code refactoring
    Riggs, KR
    Stoecklin, S
    6TH WORLD MULTICONFERENCE ON SYSTEMICS, CYBERNETICS AND INFORMATICS, VOL VII, PROCEEDINGS: INFORMATION SYSTEMS DEVELOPMENT II, 2002, : 504 - 509
  • [49] Development of a Refactoring Learning Environment
    Sandalski, Mincho
    Stoyanova-Doycheva, Asya
    Popchev, Ivan
    Stoyanov, Stanimir
    CYBERNETICS AND INFORMATION TECHNOLOGIES, 2011, 11 (02) : 46 - 64
  • [50] Constraint-Based Refactoring
    Steimann, Friedrich
    ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2018, 40 (01):