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 条
  • [1] CScout: A refactoring browser for C
    Spinellis, Diomidis
    SCIENCE OF COMPUTER PROGRAMMING, 2010, 75 (04) : 216 - 231
  • [2] Refactoring GrPPI: Generic Refactoring for Generic Parallelism in C++
    Christopher Brown
    Vladimir Janjic
    Adam D. Barwell
    J. Daniel Garcia
    Kenneth MacKenzie
    International Journal of Parallel Programming, 2020, 48 : 603 - 625
  • [3] Refactoring GrPPI: Generic Refactoring for Generic Parallelism in C plus
    Brown, Christopher
    Janjic, Vladimir
    Barwell, Adam D.
    Garcia, J. Daniel
    MacKenzie, Kenneth
    INTERNATIONAL JOURNAL OF PARALLEL PROGRAMMING, 2020, 48 (04) : 603 - 625
  • [4] REFACTORING OF C/C plus plus PREPROCESSOR CONSTRUCTS AT THE MODEL LEVEL
    Vidacs, Laszlo
    ICSOFT 2009: PROCEEDINGS OF THE 4TH INTERNATIONAL CONFERENCE ON SOFTWARE AND DATA TECHNOLOGIES, VOL 1, 2009, : 232 - 237
  • [5] Embracing the C preprocessor during refactoring
    Garrido, Alejandra
    Johnson, Ralph
    JOURNAL OF SOFTWARE-EVOLUTION AND PROCESS, 2013, 25 (12) : 1285 - 1304
  • [6] Computing Summaries of String Loops in C for Better Testing and Refactoring
    Kapus, Timotej
    Ish-Shalom, Oren
    Itzhaky, Shachar
    Rinetzky, Noam
    Cadar, Cristian
    PROCEEDINGS OF THE 40TH ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION (PLDI '19), 2019, : 874 - 888
  • [7] Refactoring Inspection Support for Manual Refactoring Edits
    Alves, Everton L. G.
    Song, Myoungkyu
    Massoni, Tiago
    Machado, Patricia D. L.
    Kim, Miryung
    IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2018, 44 (04) : 365 - 383
  • [8] Refactoring Graphs: Assessing Refactoring over Time
    Brito, Aline
    Hora, Andre
    Valente, Marco Tulio
    PROCEEDINGS OF THE 2020 IEEE 27TH INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION, AND REENGINEERING (SANER '20), 2020, : 367 - 377
  • [9] Manual Refactoring Changes with Automated Refactoring Validation
    Ge, Xi
    Murphy-Hill, Emerson
    36TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2014), 2014, : 1095 - 1105
  • [10] Refactoring the Organization
    Power, Ken
    LEAN ENTERPRISE SOFTWARE AND SYSTEMS, 2010, 65 : 48 - 51