A Change-Centric Approach to Compile Configurable Systems with #ifdefs
Larissa Braz, Rohit Gheyi, Melina Mongiovi, Márcio Ribeiro, Flávio Medeiros, Leopoldo Teixeira


Configurable systems typically use #ifdefs to denote variability. Generating and compiling all configurations may be time-consuming. An alternative consists of using variability-aware parsers, such as TypeChef. However, they may not scale. In practice, developers can use sampling strategies to compile only a subset of the configurations. We propose a change-centric approach to compile configurable systems with #ifdefs by analyzing only configurations impacted by a code change. We implement it in a tool called CHECKCONFIGMX, which reports the new compilation errors introduced by the transformation. We perform an empirical study to evaluate 3,913 transformations applied to the 14 largest files of BusyBox, Apache HTTPD, and Expat configurable systems. CHECKCONFIGMX finds 595 compilation errors of 20 types introduced by 41 developers in 214 commits (5.46% of the analyzed transformations). In our study, it reduces at least 50% (an average of 99%) the number of compiled configurations by comparing with the exhaustive approach without considering a feature model. CHECKCONFIGMX may help developers to reduce compilation effort to evaluate fine-grained transformations applied to config- urable systems with #ifdefs.



Our approach

approach
Figure I: A change-centric approach to compile configurable systems with #ifdefs.
The approach receives two versions of a C configurable system. It performs a change
impact analysis to identify the macros impacted by the change (Step 1). Next, it
generates all possible impacted configurations and compiles all of them using GCC
(Step 2). Then, it identifies the compilation errors that only occur in the modified
version of the system (Step 3). Finally, it categorizes the compilation errors
introduced by the transformation into distinct ones (Step 4). The approach reports
the result of the categorization.


Evaluation

results
Table I: Compilation errors detected by CHECKCONFIGMX; CS = Configurable System;
File = Name of the analyzed file; Pairs = Pairs that intro- duced compilation
errors; Dev. = Developers that performed the commits that introduced the errors.

  

results
Table II: Total of compilation errors found in configurable system by Steps 3 and 4;
CS = Configurable System; File = Name of the analyzed file; Filter/Configs. = Impacted
configurations with compilation errors; Filter/Total = Introduced compilation error
messages; Categorization/Total = Different compilation errors; Categorization/Real =
Real compilation errors after a manual analysis removing false positives.

  

results
Table III: Kinds of compilation errors found in our study.

  

results
Table IV: Average of the runtime execution of CHECKCONFIGMX; CS = Configurable System;
File = Name of the analyzed file; Time (s) = Average time of: Impact Analysis = Step 1;
GCC = Step 2; Filter = Step 3; Categ. = Step 4; Total = Total time.

  
Spreadsheets
Informations of all analyzed transformations, such as commit hashs and total of impacted macros.
Informations of analyzed transformations that introduced compilation errors, such as total of errors.
  
Toy Examples of kinds of errors that TypeChef does not detect
1. Incomplete type definition
2. Unknown type name
3. Undeclared label
4. Function cannot return array type
5. Continue statement not in loop statement
6. Address of bit-field requested

SPG - Software Productivity Group