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);
  ....
}

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

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


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);
  ....
}


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