GCC analyzer fixed to build with older GCC versions.
GCC analyzer now builds with GCC 5 by resolving C++ template specialization and rvalue overload issues.
The GCC static analyzer has been updated to build successfully with GCC 5. This involved addressing two key C++ compatibility issues: explicitly defining template specializations within their enclosing class template’s namespace, as required by standards post-GCC 7, and using emplace instead of insert for map operations involving rvalues, to work around missing overloads in older libstdc++ versions.
In Details
This commit updates the GCC analyzer codebase to be compatible with GCC 5. It resolves two C++ standard evolution issues: First, it moves explicit specializations of member functions of class templates into the class template's namespace, adhering to the C++ standard's rules for specialization placement (DR 374). Second, it replaces std::map::insert calls with std::map::emplace for map-of-unique-ptr insertions, as GCC 5's libstdc++ lacks the necessary rvalue overloads for insert (related to LWG 2354). The changes are applied across several analyzer source files dealing with symbolic and…
- GCC analyzer
- A static analysis tool integrated into GCC that detects certain classes of bugs, like null pointer dereferences or buffer overflows, by examining code without executing it.
- template specialization
- A C++ feature allowing a specific implementation of a template to be provided for certain types, distinct from the general template definition.
- rvalue
- A temporary object or literal value that typically cannot be modified. In C++, rvalues are often associated with move semantics.
- libstdc++
- The standard C++ library implementation used by GCC.
- DR 374
- Defect Report 374 of the C++ standard, which clarified rules regarding specialization of member functions of class templates.
- LWG 2354
- Library Working Group issue 2354 for the C++ standard library, concerning overloads for
std::map::insertwith rvalues.