Citation: Communication Papers of the 2017 Federated Conference on Computer Science and Information Systems, M. Ganzha, L. Maciaszek, M. Paprzycki (eds). ACSIS, Vol. 13, pages 149–156 (2017)
Abstract. The C++ Standard Template Library (STL) is the flagship example for libraries based on the generic programming paradigm. The usage of this library is intended to minimize classical C/C++ errors, but does not warrant bug-free programs. Furthermore, many new kinds of errors may arise from the inaccurate use of the generic programming paradigm, like dereferencing invalid iterators or misunderstanding remove-like algorithms. Unfortunately, the C++ Standard does not define which standard header includes another standard headers. It is easy to write code that works perfectly on an implementation but fails to compile with another implementation of STL. These unportable codes should be result in compilation error with every STL implementation. However, in this case the compiler does not warn us that this code is erroneous. In this paper we present our tool that is based on the Clang. This tool is able to detect the missing include directives that are patched by the STL implementation's internal structure. It also reports the unnecessary include directives to avoid extra compilation time. The background of our tool is discovered and we briefly present the underlying data structures and algorithms. We analyse how these problems occur in open source libraries and programs. Which environment proves oneself to be lazy or strict? How the developers take advantage of this portability issue?
- C. Lattner, “LLVM and Clang: Next generation compiler technology,” 2008, lecture at BSD Conference 2008.
- M. H. Austern, Generic Programming and the STL: Using and Extending the C++ Standard Template Library. Addison-Wesley, 1999.
- B. Stroustrup, The C++ Programming Language (special edition). Addison-Wesley, 2000.
- N. Pataki, “C++ Standard Template Library by safe functors,” in Proc. of 8th Joint Conference on Mathematics and Computer Science, MaCS 2010, Selected Paper, H. F. Pop and A. Bege, Eds. Komárno: Novadat Ltd., 2011, pp. 363–374.
- G. Horváth and N. Pataki, “Clang matchers for verified usage of the C++ Standard Template Library,” Annales Mathematicae et Informaticae, vol. 44, pp. 99–109, 2015. [Online]. Available: http://ami.ektf.hu/uploads/papers/finalpdf/AMI 44 from99to109.pdf
- S. Meyers, Effective STL. Addison-Wesley, 2001.
- N. Nagappan and T. Ball, “Static analysis tools as early indicators of pre-release defect density,” in Proceedings of the 27th International Conference on Software Engineering, ser. ICSE ’05. New York, NY, USA: ACM, 2005, pp. 580–586. [Online]. Available: http://doi.acm.org/10.1145/1062455.1062558
- B. Johnson, Y. Song, E. Murphy-Hill, and R. Bowdidge, “Why don’t software developers use static analysis tools to find bugs?” in Proceedings of the 2013 International Conference on Software Engineering, ser. ICSE ’13. Piscataway, NJ, USA: IEEE Press, 2013, pp. 672–681. [Online]. Available: http://dx.doi.org/10.1109/ICSE.2013.6606613
- C. King., “Symbolic execution and program testing,” Communications of the ACM, vol. 19, pp. 385–394, 1976. [Online]. Available: http://dl.acm.org/citation.cfm?id=360252
- C. Szabó, M. Kotul, and R. Petruš, “A closer look at software refactoring using symbolic execution,” in The 9th International Conference on Applied Informatics - Volume 2, 2014, pp. 309–316. [Online]. Available: http://dx.doi.org/10.14794/ICAI.9.2014.2.309
- Z. Xu, T. Kremenek, and J. Zhang, “A memory model for static analysis of C programs,” in ISoLA’10 Proceedings of the 4th international conference on Leveraging applications of formal methods, verification, and validation - Volume Part I. Heidelberg: Springer-Verlag Berlin, 2010, pp. 535–548.
- T. Brunner, N. Pataki, and Z. Porkoláb, “Backward compatibility violations and their detection in C++ legacy code using static analysis,” Acta Electrotechnica et Informatica, vol. 16, no. 2, pp. 12–19, 2016. [Online]. Available: http://dx.doi.org/10.15546/aeei-2016-0009
- G. Horváth and N. Pataki, “Source language representation of function summaries in static analysis,” in Proceedings of the 11th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, ser. ICOOOLPS ’16. New York, NY, USA: ACM, 2016, pp. 6:1–6:9. [Online]. Available: http://doi.acm.org/10.1145/3012408.3012414
- A. Baráth and Z. Porkoláb, “Automatic checking of the usage of the C++11 move semantics,” Acta Cybernetica, vol. 22, no. 1, pp. 5–20, 2015. [Online]. Available: http://dx.doi.org/10.14232/actacyb.22.1.2015.2
- E. Stepanov and K. Serebryany, “Memorysanitizer: Fast detector of uninitialized memory use in C++,” in Proceedings of the 13th Annual IEEE/ACM International Symposium on Code Generation and Optimization, ser. CGO ’15. Washington, DC, USA: IEEE Computer Society, 2015, pp. 46–55. [Online]. Available: http://dx.doi.org/10.1109/CGO.2015.7054186
- N. Pataki, T. Cséri, and Z. Szűgyi, “Task-specific style verification,” AIP Conference Proceedings, vol. 1479, no. 1, pp. 490–493, 2012. [Online]. Available: http://dx.doi.org/10.1063/1.4756173
- V. Májer and N. Pataki, “Concurrent object construction in modern object-oriented programming languages,” in The 9th International Conference on Applied Informatics - Volume 2, 2014, pp. 293–300. [Online]. Available: http://dx.doi.org/10.14794/ICAI.9.2014.2.293
- B. Babati, N. Pataki, and Z. Porkoláb, “C/C++ preprocessing with modern data storage devices,” in 2015 IEEE 13th International Scientific Conference on Informatics, Nov 2015, pp. 36–40. [Online]. Available: http://dx.doi.org/10.1109/Informatics.2015.7377804
- J. Mihalicza, “Compile C++ systems in quarter time,” in Proceedings10th International Scientific Conference on Informatics, 2009, pp. 136–141. [Online]. Available: http://dx.doi.org/10.14794/ICAI.9.2014.2.309
- Y. Yu, H. Dayani-Fard, and J. Mylopoulos, “Removing false code dependencies to speedup software build processes,” in Proceedings of the 2003 Conference of the Centre for Advanced Studies on Collaborative Research, ser. CASCON ’03. IBM Press, 2003, pp. 343–352. [Online]. Available: http://dl.acm.org/citation.cfm?id=961322.961375
- J. Mihalicza, “How #includes affect build time in large systems,”Proceedings of the 8th international conference on applied informatics (ICAI 2010), 2010, pp. 343–350.
- C. Silverstein, “Implementing Include-what-you-use using clang,” 2010, 2010 LLVM Developers’ Meeting Talk.