Examples of errors detected by the V729 diagnostic

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 */
    ....
  }

Identical 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


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;