Examples of errors detected by the V591 diagnostic.


V591. Non-void function should return a value.


Quake-III-Arena

V591 Non-void function should return a value. botlib q_shared.h 155


static ID_INLINE int BigLong(int l)
{ LongSwap(l); }

Need: { return LongSwap(l); }

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. botlib q_shared.h 157

Haiku Operation System

V591 Non-void function should return a value. pc.c 1031


ULONG
set_var(char *name, ULONG val)
{
  variable *v;

  v = lookup_var(name);
  if (v != NULL)
    v->value = val;
  else
    add_var(name, val);
}

SETI@home

V591 Non-void function should return a value. x86_float4.h 237


struct float4
{
  ....
  inline float4 rsqrt() const {
  }
  inline float4 sqrt() const {
  }
  inline float4 recip() const {
  }
  ....
};

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. x86_float4.h 239
  • V591 Non-void function should return a value. x86_float4.h 241

Unreal Engine 4

V591 Non-void function should return a value. slistview.h 53


class FColumnHeaderSlot
{
public:
  FColumnHeaderSlot& operator[](
    const TSharedRef< SHeaderRow >& InColumnHeaders )
  {
    HeaderRow = InColumnHeaders;
  }
  ....
}

Missing return *this.


Open X-Ray Engine

V591 Non-void function should return a value. _matrix33.h 435


template <class T>
struct _matrix33
{
public:
  typedef _matrix33<T>Self;
  typedef Self& SelfRef;
  ....
  IC SelfRef sMTxV(Tvector& R, float s1, const Tvector& V1) const
  {
    R.x = s1*(m[0][0] * V1.x + m[1][0] * V1.y + m[2][0] * V1.z);
    R.y = s1*(m[0][1] * V1.x + m[1][1] * V1.y + m[2][1] * V1.z);
    R.z = s1*(m[0][2] * V1.x + m[1][2] * V1.y + m[2][2] * V1.z);
  }
  ....
}

Chromium

V591 Non-void function should return a value. memory_allocator.h 39


CheckReturnValue& operator=(const CheckReturnValue& other) {
  if (this != &other) {
    DCHECK(checked_);
    value_ = other.value_;
    checked_ = other.checked_;
    other.checked_ = true;
  }
}

Missing return *this.


Clang

V591 Non-void function should return a value. RPCUtils.h 719


SequenceNumberManager &operator=(SequenceNumberManager &&Other) {
  NextSequenceNumber = std::move(Other.NextSequenceNumber);
  FreeSequenceNumbers = std::move(Other.FreeSequenceNumbers);
}

Aspell

V591 Non-void function should return a value. lsort.hpp 159


template <class N>
static inline N * fix_links(N * cur)
{
  N * prev = 0;
  while (cur) {
    cur->prev = prev;
    prev = cur;
    cur = cur->next;
  }
}

EFL Core Libraries

V591 Non-void function should return a value. ecore_evas_extn.c 1526

V591 Non-void function should return a value. ecore_evas_extn.c 1617


static Eina_Bool
_ipc_server_data(void *data, int type EINA_UNUSED, void *event)
{
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (indicator_buffer_skip)
    return;
  //END
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (_ecore_evas_indicator_size_check(ee, &(extn->b[n].w)))
    {
       indicator_buffer_skip = EINA_TRUE;
       return;                                  // <=
    }
  else
    indicator_buffer_skip = EINA_FALSE;
  //END
  ....
}

EFL Core Libraries

V591 Non-void function should return a value. eina_accessor.hh 330


_self_type& operator=(_self_type const& other)
{
  _base_type::operator=(other);
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;
On our website we use a cookie to collect information of a technical nature.
If you do not agree, please leave the site. Learn More →
Do not show again