This check looks for situations where the return value of non-void functions is ignored. Example:
int fun() { return 1; }
void main()
{
fun(); // [warn]: Function return value is discarded
}
In order to achieve that I decided to check CompoundStatement as this statement is encountered every time we have a set of instructions inside { }. Ex: for(...) {}, void f() {// CompoundStatement} and if we encounter directly a CallExp, it means that the return value is ignored.
I also checked instructions where we have only 1 statement, without { }, like:
This check looks for situations where the return value of non-void functions is ignored. Example:
In order to achieve that I decided to check
CompoundStatement
as this statement is encountered every time we have a set of instructions inside{ }
. Ex:for(...) {}
,void f() {// CompoundStatement}
and if we encounter directly aCallExp
, it means that the return value is ignored.I also checked instructions where we have only 1 statement, without
{ }
, like: