jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.
MIT License
152 stars 29 forks source link

Flylint cuts usefull info from an issue found #174

Open randrewy opened 1 year ago

randrewy commented 1 year ago

Given the following example:

// main.cpp
#include <vector>
#include "header.h"

int main() {
    test<int>();
}

// header.h
template<typename T>
bool test() {
    T min = std::numeric_limits<T>::min();
    size_t x = 0;
    return x > min; // signed/unsigned comparison here, but real issue is cut from output
}

Compiling it with -Wsign-compare gives this warning that spans over two lines:

$ clang++ -std=c++20 -stdlib=libc++ -Wsign-compare src/main.cpp 
In file included from src/main.cpp:2:
src/header.h:9:14: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
    return x > min;
           ~ ^ ~~~
src/main.cpp:6:5: note: in instantiation of function template specialization 'test<int>' requested here
    test<int>();
    ^
1 warning generated.

However output is cut down to this, making it impossible to understand the issue

image