skip to main content
research-article

Efficient extraction and analysis of preprocessor-based variability

Authors Info & Claims
Published:10 October 2010Publication History
Skip Abstract Section

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.

References

  1. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}BuDDy project. http://sourceforge.net/projects/buddy, 2009.Google ScholarGoogle Scholar
  6. }}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 ScholarGoogle Scholar
  7. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}International Organization for Standardization. ISO/IEC 9899:TC2: Programming languages -- C. International Organization for Standardization, Geneva, Switzerland, 2005.Google ScholarGoogle Scholar
  12. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}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 ScholarGoogle ScholarCross RefCross Ref
  15. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}The Limmat SAT solver. http://fmv.jku.at/limmat/, 2002.Google ScholarGoogle Scholar
  18. }}Linus Torvalds. Sparse - a semantic parser for C. http://www.kernel.org/pub/software/devel/sparse/, 2003.Google ScholarGoogle Scholar
  19. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}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 ScholarGoogle ScholarCross RefCross Ref
  22. }}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 ScholarGoogle Scholar
  23. }}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 ScholarGoogle Scholar
  24. }}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 ScholarGoogle Scholar
  25. }}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 ScholarGoogle Scholar
  26. }}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 ScholarGoogle Scholar
  27. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. }}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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Efficient extraction and analysis of preprocessor-based variability

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 2
      GPCE '10
      Febuary 2011
      185 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1942788
      Issue’s Table of Contents
      • cover image ACM Conferences
        GPCE '10: Proceedings of the ninth international conference on Generative programming and component engineering
        October 2010
        198 pages
        ISBN:9781450301541
        DOI:10.1145/1868294
        • General Chair:
        • Eelco Visser,
        • Program Chair:
        • Jaakko Järvi

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 10 October 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!