Примеры ошибок, обнаруженных с помощью диагностики V729


V729. Function body contains the 'X' label that is not used by any 'goto' statements.


FreeBSD Kernel

V729 Function body contains the 'done' label that is not used by any 'goto' statements. zfs_acl.c 2023


int
zfs_setacl(znode_t *zp, vsecattr_t *vsecp, ....)
{
  ....
top:
  mutex_enter(&zp->z_acl_lock);
  mutex_enter(&zp->z_lock);
  ....
  if (error == ERESTART) {
    dmu_tx_wait(tx);
    dmu_tx_abort(tx);
    goto top;
  }
  ....
done:                            // <=
  mutex_exit(&zp->z_lock);
  mutex_exit(&zp->z_acl_lock);

  return (error);
}

CodeLite

V729 Function body contains the 'find_rule' label that is not used by any 'goto' statements. include_finder.cpp 716


....
#define YY_DECL int yylex YY_PROTO(( void ))
....
YY_DECL
  {
    ....
    yy_find_action:
      yy_current_state = *--yy_state_ptr;
      yy_lp = yy_accept[yy_current_state];

      /* we branch to this label when backing up */
    find_rule:                                             // <=

    for ( ; ; ) /* until we find what rule we matched */
    ....
  }

Similar errors can be found in some other places:

  • V729 Function body contains the 'find_rule' label that is not used by any 'goto' statements. comment_parser.cpp 672
  • V729 Function body contains the 'find_rule' label that is not used by any 'goto' statements. cpp_expr_lexer.cpp 1090
  • V729 Function body contains the 'find_rule' label that is not used by any 'goto' statements. cpp_lexer.cpp 1138


Найденные ошибки

Проверено проектов
367
Собрано ошибок
13 552

А ты совершаешь ошибки в коде?

Проверь с помощью
PVS-Studio

Статический анализ
кода для C, C++, C#
и Java

goto PVS-Studio;