ABSTRACT
Since the 70s, the C preprocessor is still widely used in practice in a numbers of projects, including Apache, Linux, and Libssh, to tailor systems to different platforms. To better understand the C preprocessor challenges, we conducted 40 interviews and a survey among 202 developers. We found that developers deal with three common problems: configuration-related bugs, combinatorial testing, and code comprehension. To safely evolve preprocessor-based configurable systems, we proposed strategies to detect preprocessor-related bugs and bad smells, and a set of 16 refactorings to remove bad smells. To better deal with exponential configuration spaces, we compared 10 sampling algorithms with respect to effort (i.e., number of configurations to test) and bug-detection capabilities (i.e., number of bugs detected in the sampled configurations). Based on the results, we proposed a sampling algorithm with a useful balance between effort and bug-detection capability. By evaluating the proposed solution using 40 popular projects, we found 131 preprocessor-related bugs and more than 5K opportunities to apply the refactorings in practice.
- I. Abal, C. Brabrand, and A. Wasowski. 42 variability bugs in the Linux kernel: A qualitative analysis. In Proceedings of the International Conference on Automated Software Engineering. IEEE/ACM, 2014. Google ScholarDigital Library
- B. Adams, K. De Schutter, H. Tromp, and W. De Meuter. The evolution of the Linux build system. Electronic Communications of the European Association for the Study of Science and Technology, 2008.Google Scholar
- M. Anastasopoules and C. Gacek. Implementing product line variabilities. In Proceedings of the Symposium on Software Reusability, SSR. ACM, 2001. Google ScholarDigital Library
- I. Baxter and M. Mehlich. Preprocessor conditional removal by simple partial evaluation. In Proceedings of the Working Conference on Reverse Engineering. IEEE Computer Society, 2001. Google ScholarDigital Library
- M. Ernst, G. Badros, and D. Notkin. An empirical analysis of C preprocessor use. IEEE Transactions on Software Engineering, 28(12), 2002. Google ScholarDigital Library
- J.-M. Favre. Understanding-in-the-large. In Proceedings of the International Workshop on Program Comprehension, IWPC, 1997. Google ScholarDigital Library
- A. Garrido and R. Johnson. Analyzing multiple configurations of a C program. In Proceedings of the International Conference on Software Maintenance. IEEE, 2005. Google ScholarDigital Library
- A. Garrido and R. E. Johnson. Embracing the c preprocessor during refactoring. Journal of Software: Evolution and Process, 25(12), 2013.Google ScholarCross Ref
- Y. Hu, E. Merlo, M. Dagenais, and B. Laguë. C/C++ conditional compilation analysis using symbolic execution. In Proceeding of the International Conference on Software Maintenance, ICSM. IEEE, 2000. Google ScholarDigital Library
- C. Kästner, S. Apel, and M. Kuhlemann. A model of refactoring physically and virtually separated features. In Proceedings of the Conference on Generative Programming and Component Engineering. ACM, 2009. Google ScholarDigital Library
- C. Kästner, P. Giarrusso, T. Rendel, S. Erdweg, K. Ostermann, and T. Berger. Variability-aware parsing in the presence of lexical macros and conditional compilation. In Proceedings of the Object-Oriented Programming Systems Languages and Applications. ACM, 2011. Google ScholarDigital Library
- M. Krone and G. Snelting. On the inference of configuration structures from source code. In Proceedings of the International Conference on Software Engineering, ICSE. IEEE, 1994. Google ScholarDigital Library
- J. Liebig, C. Kästner, and S. Apel. Analyzing the discipline of preprocessor annotations in 30 million lines of C code. In Proceedings of the Aspect-Oriented Software Development. ACM, 2011. Google ScholarDigital Library
- D. Lohmann, F. Scheler, R. Tartler, O. Spinczyk, and W. Schröder-Preikschat. A quantitative analysis of aspects in the eCos kernel. In ACM European Conference on Computer Systems (EuroSys). ACM, 2006. Google ScholarDigital Library
- B. McCloskey and E. Brewer. Astec: A new approach to refactoring C. In Proceedings of the European Software Engineering Conference and International Symposium on Foundations of Software Engineering, ESEC/FSE. ACM, 2005. Google ScholarDigital Library
- F. Medeiros, C. Kästner, M. Ribeiro, R. Gheyi, and S. Apel. A comparison of 10 sampling algorithms for configurable systems. In Proceedings of Inter. Conf. on Software Engineering, ICSE, 2016. Google ScholarDigital Library
- F. Medeiros, C. Kästner, M. Ribeiro, S. Nadi, and R. Gheyi. The love/hate relationship with the C preprocessor: An interview study. In Proceedings of the European Conf. on Object-Oriented Prog. ACM, 2015.Google Scholar
- F. Medeiros, M. Ribeiro, and R. Gheyi. Investigating preprocessor-based syntax errors. In Proceedings of the Inter. Conf. on Generative Programming: Concepts & Experiences. ACM, 2013. Google ScholarDigital Library
- F. Medeiros, M. Ribeiro, R. Gheyi, and B. Fonseca. A catalogue of refactorings to remove incomplete annotations. Journal of Universal Computer Science, 2014.Google Scholar
- F. Medeiros, I. Rodrigues, M. Ribeiro, L. Teixeira, and R. Gheyi. An empirical study on configuration-related issues: Investigating undeclared and unused identifiers. In Proceedings of the Inter. Conf. on Generative Programming: Concepts & Experiences. ACM, 2015. Google ScholarDigital Library
- T. T. Pearse and P. W. Oman. Experiences developing and maintaining software in a multi-platform env. In Proceedings of the International Conference on Software Maintenance, ICSM. IEEE, 1997. Google ScholarDigital Library
- S. Schulze, J. Liebig, J. Siegmund, and S. Apel. Does the discipline of preprocessor annotations matter?: a controlled experiment. In Proceedings of the International Conference on Generative Programming: Concepts & Experiences, 2013. Google ScholarDigital Library
- N. Singh, C. Gibbs, and Y. Coady. C-CLR: A tool for navigating highly configurable system software. In Proceedings of the AOSD Workshop on Aspects, Components, and Patterns for Infrastructure Software, ACP4IS. ACM, 2007. Google ScholarDigital Library
- H. Spencer and G. Collyer. Ifdef considered harmful, or portability experience with C news. In USENIX Annual Technical Conference, 1992.Google Scholar
- R. Tartler, C. Dietrich, J. Sincero, W. Schröder-Preikschat, and D. Lohmann. Static analysis of variability in system software: The 90,000 #ifdefs issue. In USENIX Annual Technical Conference, 2014. Google ScholarDigital Library
- S. Trujillo, D. Batory, and O. Diaz. Feature refactoring a multi-representation program into a product line. In International conference on Generative programming and component engineering. ACM, 2006. Google ScholarDigital Library
- M. Vittek. Refactoring browser with preprocessor. In European Conference on Software Maintenance and Reengineering (CSMR). IEEE, 2003. Google ScholarDigital Library
Recommendations
Safely evolving configurable systems
SPLASH Companion 2015: Companion Proceedings of the 2015 ACM SIGPLAN International Conference on Systems, Programming, Languages and Applications: Software for HumanityDevelopers use configuration options to tailor systems to different platforms. This configurability leads to exponential configuration spaces and traditional tools (e.g., gcc) check only one configuration at a time. As a result, developers introduce ...
An approach to safely evolve program families in C
SPLASH '14: Proceedings of the companion publication of the 2014 ACM SIGPLAN conference on Systems, Programming, and Applications: Software for HumanityThe C preprocessor is widely used to handle variability and solve portability issues in program families. In this context, developers normally use tools like GCC and Clang. However, these tools are not variability-aware, i.e., they preprocess the code ...
Detecting architecturally-relevant code smells in evolving software systems
ICSE '11: Proceedings of the 33rd International Conference on Software EngineeringRefactoring tends to avoid the early deviation of a program from its intended architecture design. However, there is little knowledge about whether the manifestation of code smells in evolving software is indicator of architectural deviations. A ...
Comments