Extend the check to all functions with return types like
std::error_code, std::expected, boost::system::error_code, abseil::Status... Resolves issue https://github.com/llvm/llvm-project/issues/62884
Code example:
#include <algorithm> #include <iostream> #include <system_error> #include <vector> std::error_code foo() { return std::error_code(errno, std::generic_category()); }; int main() { std::vector<int> v = {1, 2, 3, 4}; std::remove_if(std::begin(v), std::end(v), [](int &x) { if (x == 1) { return true; } return false; }); foo(); }
output:
/home/nvellanki/scratch/llvm_test_ground/test.cpp:12:3: error: the value returned by this function should be used [bugprone-unused-return-value,-warnings-as-errors] std::remove_if(std::begin(v), std::end(v), [](int &x) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/nvellanki/scratch/llvm_test_ground/test.cpp:12:3: note: cast the expression to void to silence this warning /home/nvellanki/scratch/llvm_test_ground/test.cpp:19:3: error: the value returned by this function should be used [bugprone-unused-return-value,-warnings-as-errors] foo(); ^~~~~ /home/nvellanki/scratch/llvm_test_ground/test.cpp:19:3: note: cast the expression to void to silence this warning 2 warnings treated as errors
good but put those all as fully qualified names (starting with ::) like in Checkedfunctions, and align documentation