skip to main content
10.1145/2517208.2517221acmconferencesArticle/Chapter ViewAbstractPublication PagesgpceConference Proceedingsconference-collections
research-article

Investigating preprocessor-based syntax errors

Authors Info & Claims
Published:27 October 2013Publication History

ABSTRACT

The C preprocessor is commonly used to implement variability in program families. Despite the widespread usage, some studies indicate that the C preprocessor makes variability implementation difficult and error-prone. However, we still lack studies to investigate preprocessor-based syntax errors and quantify to what extent they occur in practice. In this paper, we define a technique based on a variability-aware parser to find syntax errors in releases and commits of program families. To investigate these errors, we perform an empirical study where we use our technique in 41 program family releases, and more than 51 thousand commits of 8 program families. We find 7 and 20 syntax errors in releases and commits of program families, respectively. They are related not only to incomplete annotations, but also to complete ones. We submit 8 patches to fix errors that developers have not fixed yet, and they accept 75% of them. Our results reveal that the time developers need to fix the errors varies from days to years in family repositories. We detect errors even in releases of well-known and widely used program families, such as Bash, CVS and Vim. We also classify the syntax errors into 6 different categories. This classification may guide developers to avoid them during development.

References

  1. D. Parnas, "On the design and development of program families," IEEE Transactions on Software Engineering, vol. 2, pp. 1--9, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. H. Spencer, "Ifdef considered harmful, or portability experience with C news," in USENIX Annual Technical Conference, pp. 185--197, 1992.Google ScholarGoogle Scholar
  3. I. Baxter and M. Mehlich, "Preprocessor conditional removal by simple partial evaluation," in Proceedings of the Working Conference on Reverse Engineering, WCRE '01, pp. 281--290, IEEE Computer Society, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Ernst, G. Badros, and D. Notkin, "An empirical analysis of C preprocessor use," IEEE Transactions on Software Engineering, vol. 28, pp. 1146--1170, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. C. Kästner and S. Apel, "Virtual separation of concerns - a second chance for preprocessors," Journal of Object Technology (JOT), vol. 8, no. 6, 2009.Google ScholarGoogle Scholar
  6. A. Garrido and R. Johnson, "Analyzing multiple configurations of a C program," in Proceedings of the 21st IEEE International Conference on Software Maintenance, ICSM '05, pp. 379--388, IEEE Computer Society, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 10th Aspect-Oriented Software Development, AOSD '11, pp. 191--202, ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 26th ACM SIGPLAN Object-Oriented Programming Systems Languages and Applications, OOPSLA '11, ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. IEEE, "Standard Glossary of Software Engineering Terminology," IEEE Std 610.12-1990, pp. 1--84, 1990.Google ScholarGoogle Scholar
  10. J. Liebig, S. Apel, C. Lengauer, C. Kästner, and M. Schulze, "An analysis of the variability in forty preprocessor-based software product lines," in Proceedings of the 32nd International Conference on Software Engineering, ICSE '10, pp. 105--114, ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. Ribeiro, F. Queiroz, P. Borba, T. Tolêdo, C. Brabrand, and S. Soares, "On the impact of feature dependencies when maintaining preprocessor-based software product lines," in Proceedings of the 10th Generative Programming and Component Engineering, GPCE '11, pp. 23--32, ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Gazzillo and R. Grimm, "SuperC: parsing all of C by taming the preprocessor," in Proceedings of the 33rd Programming Language Design and Implementation, PLDI '12, pp. 323--334, ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. V. Basili, G. Caldiera, and D. H. Rombach, "The goal question metric approach," in Encyclopedia of Software Engineering, Wiley, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Garrido and R. Johnson, "Challenges of refactoring C programs," in Proceedings of the International Workshop on Principles of Software Evolution, IWPSE '02, pp. 6--14, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. A. Garrido and R. Johnson, "Refactoring C with conditional compilation," in Proceedings of the 18th Automated Software Engineering, ASE '03, pp. 323--326, IEEE Computer Society, 2003.Google ScholarGoogle Scholar
  16. I. Baxter, "Design maintenance systems," Communication of the ACM, vol. 35, no. 4, pp. 73--89, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. S. Somé and T. Lethbridge, "Parsing minimization when extracting information from code in the presence of conditional," in Proceedings of the International Workshop on Program Comprehension, IWPC '98, pp. 118--125, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Y. Padioleau, "Parsing C/C++ code without pre-processing," in Compiler Construction, vol. 5501 of Lecture Notes in Computer Science, pp. 109--125, Springer Berlin Heidelberg, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Kenner, C. Kästner, S. Haase, and T. Leich, "Typechef: toward type checking #ifdef variability in C," in Proceedings of the 2nd Feature-Oriented Software Development, FOSD '10, pp. 25--32, ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. C. Kästner, S. Apel, T. Thüm, and G. Saake, "Type checking annotation-based product lines," ACM Transactions on Software Engineering and Methodology, vol. 21, pp. 14:1--14:39, July 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Sincero, R. Tartler, D. Lohmann, and W. Schröder-Preikschat, "Efficient extraction and analysis of preprocessor-based variability," in Proceedings of the 9th Generative Programming and Component Engineering, GPCE '10, pp. 23--32, ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Andersen, K. Czarnecki, S. She, and A. Wasowski, "Efficient synthesis of feature models," in Proceedings of the 16th Software Product-Line Conference, SPLC '12, pp. 106--115, ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. C. Dietrich, R. Tartler, W. Schröder-Preikschat, and D. Lohmann, "A robust approach for variability extraction from the linux build system," in Proceedings of the 16th Software Product-Line Conference, SPLC '12, pp. 21--30, ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. R. Lotufo, S. She, T. Berger, K. Czarnecki, and A. Wasowski, "Evolution of the linux kernel variability model," in Proceedings of the 14th Software Product-Line Conference, SPLC '10, pp. 136--150, Springer-Verlag, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. She, R. Lotufo, T. Berger, A. Wasowski, and K. Czarnecki, "Reverse engineering feature models," in Proceedings of the 33rd International Conference on Software Engineering, ICSE '11, pp. 461--470, ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. Tartler, J. Sincero, W. Schröder-Preikschat, and D. Lohmann, "Dead or alive: finding zombie features in the linux kernel," in Proceedings of the 1st Feature-Oriented Software Development, FOSD '09, pp. 81--86, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. R. Tartler, D. Lohmann, J. Sincero, and W. Schröder-Preikschat, "Feature consistency in compile-time-configurable system software: facing the linux 10,000 feature problem," in Proceedings of the 6th Computer Systems, pp. 47--60, ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Tartler, J. Sincero, C. Dietrich, W. Schröder-Preikschat, and D. Lohmann, "Revealing and repairing configuration inconsistencies in large-scale system software," International Journal on Software Tools for Technology Transfer, vol. 14, no. 5, pp. 531--551, 2012.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Investigating preprocessor-based syntax errors

      Recommendations

      Reviews

      William M. Waite

      The C preprocessor is often used to configure a program for different environments. A combination of flags denotes a particular environment, controlling conditionals and macros to generate an appropriate version of the program. Generally, only a few of the many possible versions are actually used in practice, and those are the ones that developers generate and test. Untested combinations of flags may result in syntactically incorrect programs. The authors of this paper use a parser that checks all possible versions of the source code to evaluate the extent of preprocessor-based syntax errors in real systems. The experiment was extensive, using 41 systems ranging in size from 2,000 to 1.5 million lines of code as experimental subjects. These subject programs had been placed under version control by their authors, so the experimenters were able to look at the commit in which a preprocessor-based syntax error was introduced and the commit in which it was corrected. The paper poses and answers seven interesting questions, such as, "How do developers introduce preprocessor-based syntax errors__?__" and "What types of preprocessor-based syntax errors do we find in practice__?__" I found both the methodology and the results interesting. The authors' use of version control history to explore the genesis and persistence of these errors is compelling, and the low number of actual errors found indicates that we do a pretty good job of avoiding them. The paper is easy to read, and there are appropriate references to the tools used and to the topic in general. Online Computing Reviews Service

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Login options

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

      Sign in
      • Published in

        cover image ACM Conferences
        GPCE '13: Proceedings of the 12th international conference on Generative programming: concepts & experiences
        October 2013
        198 pages
        ISBN:9781450323734
        DOI:10.1145/2517208

        Copyright © 2013 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 27 October 2013

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        GPCE '13 Paper Acceptance Rate20of59submissions,34%Overall Acceptance Rate56of180submissions,31%

        Upcoming Conference

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader