Examples of errors detected by the V1001 diagnostic.


V1001. The variable is assigned but is not used until the end of the function.


EFL Core Libraries

V1001 The 'address_shadow' variable is assigned but is not used until the end of the function. elocation.c 1122


static Elocation_Address *address = NULL;

EAPI Eina_Bool
elocation_address_get(Elocation_Address *address_shadow)
{
   if (!address) return EINA_FALSE;
   if (address == address_shadow) return EINA_TRUE;

   address_shadow = address;
   return EINA_TRUE;
}

Most likely this is what should be written here: *address_shadow = *address;

Similar errors can be found in some other places:

  • V1001 The 'screen' variable is assigned but is not used until the end of the function. ecore_x_xinerama.c 92
  • V1001 The 'ret' variable is assigned but is not used until the end of the function. edje_edit.c 12774
  • V1001 The 'ret' variable is assigned but is not used until the end of the function. edje_edit.c 15884
  • And 2 additional diagnostic messages.

MuseScore

V1001 The 'ontime' variable is assigned but is not used until the end of the function. rendermidi.cpp 1176


bool renderNoteArticulation(....)
{
  int ontime    = 0;
  ....
  // render the suffix
  for (int j = 0; j < s; j++)
    ontime = makeEvent(suffix[j], ontime, tieForward(j,suffix));
  // render graceNotesAfter
  ontime = graceExtend(note->pitch(), ...., ontime);
  return true;
}

Skia Graphics Engine

V1001 CWE-563 The 'allDone' variable is assigned but is not used until the end of the function. skopcontour.cpp 40


SkOpSpan* SkOpContour::undoneSpan() {
  SkOpSegment* testSegment = &fHead;
  bool allDone = true;
  do {
    if (testSegment->done()) {
      continue;
    }
    allDone = false;
    return testSegment->undoneSpan();
  } while ((testSegment = testSegment->next()));
  if (allDone) {
    fDone = true;
  }
  return nullptr;
}

Very suspicious code, but it is difficult for me to understand what is the actual error here.



Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show