Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: C++ semantics - 06.11

>
>
>
Examples of errors detected by the V696…

Examples of errors detected by the V696 diagnostic

V696. The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false.


Cocos2d-x

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 125, 153. cccomaudio.cpp 125


bool ComAudio::serialize(void* r)
{
  bool ret = false;
  do
  {
    ....
    if (file != nullptr)
    {
      if (strcmp(file, "") == 0)
      {
         continue;
      }
      ....
    }
  }while(0);
  return ret;
}

Similar errors can be found in some other places:

  • V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 188, 341. cccomrender.cpp 188
  • V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 276, 341. cccomrender.cpp 276
  • V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 281, 341. cccomrender.cpp 281
  • And 1 additional diagnostic messages.

Linux Kernel

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 273, 312. pvrusb2-encoder.c 273


static int pvr2_encoder_cmd(....)
{
  ....

  LOCK_TAKE(hdw->ctl_lock); do {

    if (!hdw->state_encoder_ok) {
      ret = -EIO;
      break;
    }

    retry_flag = 0;
    try_count++;
    ret = 0;
    wrData[0] = 0;
    wrData[1] = cmd;
    wrData[2] = 0;
    wrData[3] = 0x00060000;
    for (idx = 0; idx < arg_cnt_send; idx++) {
      wrData[idx+4] = argp[idx];
    }
    for (; idx < ARRAY_SIZE(wrData) - 4; idx++) {
      wrData[idx+4] = 0;
    }

    ret = pvr2_encoder_write_words(hdw,MBOX_BASE,wrData,idx);
    if (ret) break;
    wrData[0] = IVTV_MBOX_DRIVER_DONE|IVTV_MBOX_DRIVER_BUSY;
    ret = pvr2_encoder_write_words(hdw,MBOX_BASE,wrData,1);
    if (ret) break;
    poll_count = 0;
    while (1) {
      poll_count++;
      ret = pvr2_encoder_read_words(hdw,MBOX_BASE,rdData,
                  arg_cnt_recv+4);
      if (ret) {
        break;
      }
      if (rdData[0] & IVTV_MBOX_FIRMWARE_DONE) {
        break;
      }
      if (rdData[0] && (poll_count < 1000)) continue;
      if (!rdData[0]) {
        retry_flag = !0;
        pvr2_trace(
          PVR2_TRACE_ERROR_LEGS,
          "Encoder timed out waiting for us"
          "; arranging to retry");
      } else {
        pvr2_trace(
          PVR2_TRACE_ERROR_LEGS,
          "***WARNING*** device's encoder"
          " appears to be stuck"
          " (status=0x%08x)",rdData[0]);
      }
      pvr2_trace(
        PVR2_TRACE_ERROR_LEGS,
        "Encoder command: 0x%02x",cmd);
      for (idx = 4; idx < arg_cnt_send; idx++) {
        pvr2_trace(
          PVR2_TRACE_ERROR_LEGS,
          "Encoder arg%d: 0x%08x",
          idx-3,wrData[idx]);
      }
      ret = -EBUSY;
      break;
    }
    if (retry_flag) {
      if (try_count < 20) continue;
      pvr2_trace(
        PVR2_TRACE_ERROR_LEGS,
        "Too many retries...");
      ret = -EBUSY;
    }
    if (ret) {
      del_timer_sync(&hdw->encoder_run_timer);
      hdw->state_encoder_ok = 0;
      pvr2_trace(PVR2_TRACE_STBITS,
           "State bit %s <-- %s",
           "state_encoder_ok",
           (hdw->state_encoder_ok ? "true" : "false"));
      if (hdw->state_encoder_runok) {
        hdw->state_encoder_runok = 0;
        pvr2_trace(PVR2_TRACE_STBITS,
           "State bit %s <-- %s",
             "state_encoder_runok",
             (hdw->state_encoder_runok ?
              "true" : "false"));
      }
      pvr2_trace(
        PVR2_TRACE_ERROR_LEGS,
        "Giving up on command."
        "  This is normally recovered via a firmware"
        " reload and re-initialization; concern"
        " is only warranted if this happens repeatedly"
        " and rapidly.");
      break;
    }
    wrData[0] = 0x7;
    for (idx = 0; idx < arg_cnt_recv; idx++) {
      argp[idx] = rdData[idx+4];
    }

    wrData[0] = 0x0;
    ret = pvr2_encoder_write_words(hdw,MBOX_BASE,wrData,1);
    if (ret) break;

  } while(0); LOCK_GIVE(hdw->ctl_lock);
  ....
}

Haiku Operation System

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 1939, 1945. Roster.cpp 1939


status_t
BRoster::_LaunchApp(....) const
{
  ....
  do {
    // find the app
    ....
    if (appType.InitCheck() == B_OK
      && appType.GetAppHint(&hintRef) == B_OK
      && appRef == hintRef) {
      appType.SetAppHint(NULL);
      // try again
      continue;
    }
    ....
  } while (false);
  ....
}

LLVM/Clang

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 1642, 1649. ParseTentative.cpp 1642


Parser::TPResult Parser::TryParseProtocolQualifiers() {
  assert(Tok.is(tok::less) && "Expected '<' for qualifier list");
  ConsumeToken();
  do {
    if (Tok.isNot(tok::identifier))
      return TPResult::Error;
    ConsumeToken();

    if (Tok.is(tok::comma)) {
      ConsumeToken();
      continue;                                  // <=
    }

    if (Tok.is(tok::greater)) {
      ConsumeToken();
      return TPResult::Ambiguous;
    }
  } while (false);                               // <=

  return TPResult::Error;
}

Tizen

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 73, 75. nss_securitymanager.cpp 73


enum nss_status _nss_securitymanager_initgroups_dyn(....)
{
  ....
  do {
    ret = TEMP_FAILURE_RETRY(getpwnam_r(....));
    if (ret == ERANGE && buffer.size() < MEMORY_LIMIT) {
      buffer.resize(buffer.size() << 1);
      continue;                                            // <=
    }
  } while (0);
  ....
  do {
    ret = TEMP_FAILURE_RETRY(getgrnam_r((....));));
    if (ret == ERANGE && buffer.size() < MEMORY_LIMIT) {
      buffer.resize(buffer.size() << 1);
      continue;                                            // <=
    }
  } while(0);
  ....
}

Similar errors can be found in some other places:

  • V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 120, 122. nss_securitymanager.cpp 120

Ardour

V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 394, 397. session_transport.cc 394


void
Session::butler_transport_work ()
{
  ....
  do {
    more_disk_io_to_do = _butler->flush_tracks_to_disk_after_....

    if (errors) {
      break;
    }

    if (more_disk_io_to_do) {
      continue;
    }

  } while (false);
  ....
}

Android

V696 CWE-670 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false. Check lines: 105, 121. Vfat.cpp 105


status_t Check(const std::string& source) {
  ....
  int pass = 1;
  ....
  do {
    ....
    switch(rc) {
    case 0:
      SLOGI("Filesystem check completed OK");
      return 0;

    case 2:
      SLOGE("Filesystem check failed (not a FAT filesystem)");
      errno = ENODATA;
      return -1;

    case 4:
      if (pass++ <= 3) {
          SLOGW("Filesystem modified - rechecking (pass %d)",
                  pass);
          continue;                                         // <=
      }
      SLOGE("Failing check after too many rechecks");
      errno = EIO;
      return -1;

    case 8:
      SLOGE("Filesystem check failed (no filesystem)");
      errno = ENODATA;
      return -1;

    default:
      SLOGE("Filesystem check failed (unknown exit code %d)", rc);
      errno = EIO;
      return -1;
    }
  } while (0);                                              // <=

  return 0;
}