User Activity

  • Posted a comment on discussion General Discussion on cppcheck

    Currently as far as I know, you can ask cppcheck to display in the warning message the file/line trace that called it. I'd like to have also the function name, but more importantly - the template variable assignment (and auto types resolutions) that caused the errors, both for the templates of a function and struct/class. Alternatively, do you know how to deduce which template instantiation had caused a particular warning?

  • Posted a comment on discussion General Discussion on cppcheck

    thanks!

  • Posted a comment on discussion General Discussion on cppcheck

    The following code yields false positive in the upstream cppcheck: #include <iostream> struct ostream_holder { explicit ostream_holder(std::ostream& os) : m_os(os) {} ostream_holder(const ostream_holder&) = default; std::ostream& m_os; }; template <typename T> std::ostream& operator<<(ostream_holder os_holder, const T& value) { os_holder << value; return os_holder.m_os; } The returned error: example.cpp:14:21: error: Reference to local variable returned. [returnReference] return os_holder.m_os; Even...

  • Posted a comment on discussion General Discussion on cppcheck

    The file indexing in -plist-output output (used for formatting results in CodeChecker-friendly way) is sometimes set to 0, because the code reported the error didn't provide info about the indexing. For example, I get in the errors of ctunullpointer but inspecting the .plist file you see that the file index is set to 0, which results with CodeChecker not pointing to the right file on the stack call view of it. Here is a not-too-ugly patch I used locally (i.e. store in a static variable the input...

  • Posted a comment on discussion General Discussion on cppcheck

    thanks!

  • Posted a comment on discussion General Discussion on cppcheck

    cppcheck complains about dereferencing iterators in an array of iterators: #include <vector> std::vector<int>::const_iterator f() { const std::vector<int> v = {1, 2, 3, 4}; const std::vector<int>::const_iterator a[2] = { v.begin(), v.end() }; return *a[1]; } Yields the error: [test.cpp:7]: (error) The iterator 'a' is invalid before being assigned. Dereferencing or comparing it with another iterator is invalid operation.

  • Posted a comment on discussion General Discussion on cppcheck

    The way cppcheck treat the "#include" pragma in preprocessing is as follows: 1. If the header is found in the relative or the include paths with the "-I" flag, then cppcheck includes it 2. Otherwise, it ignores this line and continues. The design of cppcheck as a textual checker, is that intentionally it doesn't want the user to specify the "-I" flag for the std and boost libraries, but rather use the "packaged library" flags, that is enabled by default to std, but is needed to be explicitly given...

  • Posted a comment on discussion General Discussion on cppcheck

    Sadly this is the duplicated post, please visit the original post

View All

Personal Data

Username:
tal500
Joined:
2010-09-12 08:32:49

Projects

This is a list of open source software projects that Tal is associated with:

  • Project Logo MPRIS Applet   Last Updated:
  • MaxDream A cross-platform game framework based on OpenGL and GObject. Last Updated:

Personal Tools

MongoDB Logo MongoDB