Analysis of Include Dependencies in C++ Source Code
Bence Babati, Norbert Pataki · Annals of Computer Science and Information Systems · 2017
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?
Cited by 10 works. doi:10.15439/2017f358 Open-access PDF
Authors
References
- Symbolic execution and program testing
- The C Programming Language
- Why don't software developers use static analysis tools to find bugs?
- Static analysis tools as early indicators of pre-release defect density
- Generic Programming and the STL: Using and Extending the C++ Standard Template Library
- The C++ Programming Language: Special Edition
- A Memory Model for Static Analysis of C Programs
- MemorySanitizer: Fast detector of uninitialized memory use in C++
- Clang matchers for verified usage of the C++ Standard Template Library
- Source language representation of function summaries in static analysis