Abstract
The C Preprocessor (CPP) is the tool of choice for the implementation of variability in many large-scale configurable software projects. Linux, probably the most-configurable piece of software ever, employs more than 10,000 preprocessor variables for this purpose. However, this de-facto variability tends to be "hidden in the code"; which on the long term leads to variability defects, such as dead code or inconsistencies with respect to the intended (modeled) variability of the software. This calls for tool support for the efficient extraction of (and reasoning over) CPP-based variability.
We suggest a novel approach to extract CPP-based variability. Our tool transforms CPP-based variability in O(n) complexity into a propositional formula that "mimics" all valid effects of conditional compilation and can be analyzed with standard SAT or BDD packages.
Our evaluation results demonstrate the scalability and practicability of the approach. A dead-block-analysis on the complete Linux source tree takes less than 30 minutes; we thereby have revealed 60 dead blocks, 2 of which meanwhile have been confirmed as new (and long-lasting) bugs; the rest is still under investigation.
- }}Greg J Badros and David Notkin. A framework for preprocessor-aware c source code analyses. Software: Practice and Experience, 30(8):907--924, 2000. Google Scholar
Digital Library
- }}Ira D. Baxter. DMS: program transformations for practical scalable software evolution. In 5th Int. W'shop on Principles of Software Evolution (IWPSE’02), pages 48--51, New York, NY, USA, 2002. ACM. Google Scholar
Digital Library
- }}Ira D. Baxter and Michael Mehlich. Preprocessor conditional removal by simple partial evaluation. In 8th Conf. on Reverse Engineering (WCRE ’01), pages 281--, Washington, DC, USA, 2001. IEEE. Google Scholar
Digital Library
- }}D. Benavides, A. Ruiz-Cortés, and P. Trinidad. Automated reasoning on feature models. In 17th Int. Conf. on Advanced Information Systems Engineering (CAISE '05), volume 3520, pages 491--503, Heidelberg, Germany, 2005. Springer. Google Scholar
Digital Library
- }}BuDDy project. http://sourceforge.net/projects/buddy, 2009.Google Scholar
- }}Andreas Classen, Arnaud Hubaux, and Patrick Heymans. A formal semantics for multi-level staged configuration. In 3th Int. W'shop on Variability Modelling of Software-intensive Systems (VAMOS '09), pages 51--60, 2009.Google Scholar
- }}Krzysztof Czarnecki and Krzysztof Pietroszek. Verifying feature-based model templates against well-formedness OCL constraints. In 6th Int. Conf. on Generative Programming and Component Engineering (GPCE '06), pages 211--220, New York, NY, USA, 2006. ACM. Google Scholar
Digital Library
- }}Krzysztof Czarnecki and Andrzej Wasowski. Feature diagrams and logics: There and back again. In 11th Software Product Line Conf. (SPLC '07), pages 23--34. IEEE, Sept. 2007. Google Scholar
Digital Library
- }}Alejandra Garrido. Program refactoring in the presence of preprocessor directives. PhD thesis, University of Illinois at Urbana-Champaign, Champaign, IL, USA, 2005. Adviser-Johnson, Ralph. Google Scholar
Digital Library
- }}Ying Hu, Ettore Merlo, Michel Dagenais, and Bruno Lagüe. C/C++ conditional compilation analysis using symbolic execution. In 16th IEEE Int. Conf. on Software Maintainance (ICSM’00), page 196, Washington, DC, USA, 2000. IEEE. Google Scholar
Digital Library
- }}International Organization for Standardization. ISO/IEC 9899:TC2: Programming languages -- C. International Organization for Standardization, Geneva, Switzerland, 2005.Google Scholar
- }}Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial evaluation and automatic program generation. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1993. Google Scholar
Digital Library
- }}Christian Kastner, Sven Apel, and Martin Kuhlemann. Granularity in software product lines. In 30th Int. Conf. on Software Engineering (ICSE '08), pages 311--320, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- }}Christian Kastner, Sven Apel, Salvador Trujillo, Martin Kuhlemann, and Don Batory. Guaranteeing syntactic correctness for all product line variants: A language-independent approach. In Proceedings of the 47th International Conference Objects, Models, Components, Patterns (TOOLS EUROPE), volume 33 of Lecture Notes in Business Information Processing, pages 175--194. Springer Berlin Heidelberg, June 2009.Google Scholar
Cross Ref
- }}Mario Latendresse. Rewrite systems for symbolic evaluation of c-like preprocessing. In CSMR '04: Proceedings of the Eighth Euromicro Working Conference on Software Maintenance and Reengineering (CSMR'04), page 165, Washington, DC, USA, 2004. IEEE Computer Society. Google Scholar
Digital Library
- }}Jörg Liebig, Sven Apel, Christian Lengauer, Christian Kastner, and Michael Schulze. An analysis of the variability in forty preprocessor-based software product lines. In 32nd Int. Conf. on Software Engineering (ICSE '10), New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- }}The Limmat SAT solver. http://fmv.jku.at/limmat/, 2002.Google Scholar
- }}Linus Torvalds. Sparse - a semantic parser for C. http://www.kernel.org/pub/software/devel/sparse/, 2003.Google Scholar
- }}Roberto E. Lopez-Herrejon and Don Batory. A standard problem for evaluating product-line methodologies. In 3rd Int. Conf. on Generative and Component-Based Software Engineering (GCSE '01), volume 2186, pages 10--24, Heidelberg, Germany, 2001. Springer. Google Scholar
Digital Library
- }}Marc'ılio Mendonça, Andrzej Wasowski, Krzysztof Czarnecki, and Donald D. Cowan. Efficient compilation techniques for large scale feature models. In 5th Int. Conf. on Generative Programming and Component Engineering (GPCE '08), pages 13--22, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- }}Andreas Metzger, Patrick Heymans, Klaus Pohl, Pierre-Yves Schobbens, and Germain Saval. Disambiguating the documentation of variability in software product lines. In 15th IEEE Int. Conf. on Requirements Engineering (RE'07), pages 243--253, Washington, DC, USA, 2007. IEEE Computer Society.Google Scholar
Cross Ref
- }}Steven She, Rafael Lotufo, Thorsten Berger, Andrzej Wasowski, and Krzysztof Czarnecki. The variability model of the linux kernel. In 4th Int. W'shop on Variability Modelling of Software-intensive Systems (VAMOS '10), Linz, Austria, January 2010.Google Scholar
- }}Julio Sincero, Horst Schirmeier, Wolfgang Schröder-Preikschat, and Olaf Spinczyk. Is the linux kernel a software product line? In Frank van der Linden and Björn Lundell, editors, International Workshop on Open Source Software and Product Lines (SPLC-OSSPL 2007), Kyoto, Japan, 2007.Google Scholar
- }}Julio Sincero and Wolfgang Schröder-Preikschat. The linux kernel configurator as a feature modeling tool. In Steffen Thiel and Klaus Pohl, editors, 12th Software Product Line Conf. (SPLC '08), Second Volume, pages 257--260. Lero Int. Science Centre, University of Limerick, Ireland, 2008.Google Scholar
- }}Julio Sincero, Reinhard Tartler, and Daniel Lohmann. An algorithm for quantifying the program variability induced by conditional compilation. Technical Report CS-2010-02, University of Erlangen, Dept. of Computer Science, January 2010.Google Scholar
- }}Henry Spencer and Gehoff Collyer. #ifdef considered harmful, or portability experience with C News. In 1992 USENIX ATC, Berkeley, CA, USA, June 1992. USENIX.Google Scholar
- }}Reinhard Tartler, Julio Sincero, Wolfgang Schröder-Preikschat, and Daniel Lohmann. Dead or alive: Finding zombie features in the Linux kernel. In 1st W'shop on Feature-Oriented Software Development (FOSD '09), pages 81--86. ACM, 2009. Google Scholar
Digital Library
- }}Sahil Thaker, Don Batory, David Kitchin, and William Cook. Safe composition of product lines. In 7th Int. Conf. on Generative Programming and Component Engineering (GPCE '07), pages 95--104, New York, NY, USA, 2007. ACM. Google Scholar
Digital Library
- }}Thomas Thum, Don Batory, and Christian Kastner. Reasoning about edits to feature models. In 31st Int. Conf. on Software Engineering (ICSE '09), pages 254--264, Washington, DC, USA, 2009. IEEE. Google Scholar
Digital Library
Index Terms
Efficient extraction and analysis of preprocessor-based variability
Recommendations
Efficient extraction and analysis of preprocessor-based variability
GPCE '10: Proceedings of the ninth international conference on Generative programming and component engineeringThe C Preprocessor (CPP) is the tool of choice for the implementation of variability in many large-scale configurable software projects. Linux, probably the most-configurable piece of software ever, employs more than 10,000 preprocessor variables for ...
Variability-aware parsing in the presence of lexical macros and conditional compilation
OOPSLA '11In many projects, lexical preprocessors are used to manage different variants of the project (using conditional compilation) and to define compile-time code transformations (using macros). Unfortunately, while being a simple way to implement variability,...
Variability-aware parsing in the presence of lexical macros and conditional compilation
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsIn many projects, lexical preprocessors are used to manage different variants of the project (using conditional compilation) and to define compile-time code transformations (using macros). Unfortunately, while being a simple way to implement variability,...







Comments