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.
- D. Parnas, "On the design and development of program families," IEEE Transactions on Software Engineering, vol. 2, pp. 1--9, 1976. Google ScholarDigital Library
- H. Spencer, "Ifdef considered harmful, or portability experience with C news," in USENIX Annual Technical Conference, pp. 185--197, 1992.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 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 10th Aspect-Oriented Software Development, AOSD '11, pp. 191--202, ACM, 2011. 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 26th ACM SIGPLAN Object-Oriented Programming Systems Languages and Applications, OOPSLA '11, ACM, 2011. Google ScholarDigital Library
- IEEE, "Standard Glossary of Software Engineering Terminology," IEEE Std 610.12-1990, pp. 1--84, 1990.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- V. Basili, G. Caldiera, and D. H. Rombach, "The goal question metric approach," in Encyclopedia of Software Engineering, Wiley, 1994. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- I. Baxter, "Design maintenance systems," Communication of the ACM, vol. 35, no. 4, pp. 73--89, 1992. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
Index Terms
- Investigating preprocessor-based syntax errors
Recommendations
Investigating preprocessor-based syntax errors
GPCE '13The 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 ...
A statistical analysis of syntax errors
A study of errors made by Pascal programmers is described. The results of this study are discussed in relation to compiler syntax error recovery procedures. It is found that syntax errors made in practice are quite simple and occur relatively ...
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 ...
Comments