[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

1.10 task: error leaks

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Mon, 11 Dec 2017 17:17:45 +0000

The release branch creation checkpoints calls for checking for error
leaks, so here's the output of tools/dev/warn-unused-result.sh (after
removing the __attribute__ from svn_error__malfunction()):

[[[
subversion/libsvn_delta/branch.c:485:11: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
          svn_element__tree_set(branch->priv->element_tree, old_eid, NULL);
          ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subversion/libsvn_delta/branch.c:486:11: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
          svn_element__tree_set(branch->priv->element_tree, new_eid, element);
          ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subversion/libsvn_delta/branch.c:975:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_element__tree_set(branch->priv->element_tree, eid, element);
  ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
subversion/libsvn_delta/element.c:465:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_element__tree_set(new_subtree, new_subtree->root_eid,
  ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/libsvn_subr/cache_config.c:164:18: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
  __attribute__((warn_unused_result)) svn_error_t *err
                 ^
1 warning generated.
subversion/libsvn_subr/io.c:2426:18: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
  __attribute__((warn_unused_result)) svn_error_t *err
                 ^
1 warning generated.
subversion/libsvn_subr/stream.c:1471:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        svn_checksum_ctx_reset(btn->read_ctx);
        ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~
subversion/libsvn_subr/stream.c:1474:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        svn_checksum_ctx_reset(btn->write_ctx);
        ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
2 warnings generated.
subversion/libsvn_fs_fs/low_level.c:673:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    svn_stream_puts(stream, "\n");
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~
subversion/libsvn_fs_fs/low_level.c:890:18: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
  __attribute__((warn_unused_result)) svn_error_t *err
                 ^
2 warnings generated.
subversion/libsvn_fs_fs/transaction.c:3857:26: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
          __attribute__((warn_unused_result)) svn_error_t *err
                         ^
subversion/libsvn_fs_fs/transaction.c:3873:26: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
          __attribute__((warn_unused_result)) svn_error_t *err
                         ^
2 warnings generated.
subversion/libsvn_fs_fs/verify.c:856:26: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
          __attribute__((warn_unused_result)) svn_error_t *err2
                         ^
1 warning generated.
subversion/libsvn_fs_x/changes.c:187:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    append_change(changes, APR_ARRAY_IDX(list, i, svn_fs_x__change_t *));
    ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/libsvn_fs_x/low_level.c:365:18: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
  __attribute__((warn_unused_result)) svn_error_t *err
                 ^
subversion/libsvn_fs_x/low_level.c:1134:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    svn_stream_puts(stream, "\n");
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~
2 warnings generated.
subversion/libsvn_fs_x/transaction.c:1262:11: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
          svn_io_dir_make(txn_dir, APR_OS_DEFAULT, iterpool);
          ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/libsvn_fs_x/verify.c:787:26: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
          __attribute__((warn_unused_result)) svn_error_t *err2
                         ^
1 warning generated.
subversion/libsvn_client/merge.c:368:18: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
  __attribute__((warn_unused_result)) svn_error_t *err
                 ^
1 warning generated.
subversion/libsvn_client/patch.c:2148:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      svn_stream_printf(target->reject_stream,
      ^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/libsvn_wc/adm_ops.c:418:20: warning: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Wignored-attributes]
    __attribute__((warn_unused_result)) svn_error_t *err
                   ^
1 warning generated.
subversion/libsvn_wc/wc_db.c:16528:15: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
              lock_remove_txn(queue->wcroot, cqi->local_relpath, work_item,
              ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/svn/conflict-callbacks.c:1657:11: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
          svn_cmdline_fprintf(stderr, iterpool, "%s\n",
          ^~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/svn/notify.c:213:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_hash_keys(conflicted_paths, all_conflicts, result_pool);
  ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/svnfsfs/load-index-cmd.c:150:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      svn_stream_readline(input, &line, "\n", &eol, iterpool);
      ^~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/tests/libsvn_repos/authz-test.c:280:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    print_user_rights(NULL, NULL, 0, &authz->anon_rights, pool);
    ^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subversion/tests/libsvn_repos/authz-test.c:282:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    print_user_rights(NULL, NULL, 0, &authz->authn_rights, pool);
    ^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
subversion/tests/libsvn_client/conflicts-test.c:543:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      sbox_wc_move(b, move_src_path, new_dir_path);
      ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/tests/libsvn_repos/dump-load-test.c:84:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_stream_close(stream);
  ^~~~~~~~~~~~~~~~ ~~~~~~
subversion/tests/libsvn_repos/dump-load-test.c:134:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_stream_close(stream);
  ^~~~~~~~~~~~~~~~ ~~~~~~
2 warnings generated.
subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c:1634:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_hash_write2(props, svn_stream_from_stringbuf(hash_rep, pool), "END",
  ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/tests/libsvn_subr/mergeinfo-test.c:1765:6: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
     svn_rangelist_to_string(&tmp_string, rangelist, pool);
     ^~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
subversion/tests/libsvn_subr/priority-queue-test.c:128:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  verify_empty_queue(queue);
  ^~~~~~~~~~~~~~~~~~ ~~~~~
subversion/tests/libsvn_subr/priority-queue-test.c:157:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  verify_empty_queue(queue);
  ^~~~~~~~~~~~~~~~~~ ~~~~~
subversion/tests/libsvn_subr/priority-queue-test.c:217:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  verify_empty_queue(queue);
  ^~~~~~~~~~~~~~~~~~ ~~~~~
3 warnings generated.
tools/client-side/svnconflict/svnconflict.c:366:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    svn_cmdline_printf(pool, "text-conflict\n");
    ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
tools/client-side/svnconflict/svnconflict.c:371:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      svn_cmdline_printf(pool, "prop-conflict: %s\n", propname);
      ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/client-side/svnconflict/svnconflict.c:383:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      svn_cmdline_printf(pool, "tree-conflict: %s %s\n",
      ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/client-side/svnconflict/svnconflict.c:404:7: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
      svn_cmdline_printf(pool, "%d: %s\n", id, label);
      ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
tools/dev/svnmover/svnmover.c:2439:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    svn_stringbuf_from_stream(&text, src, 0, scratch_pool);
    ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/dev/svnmover/svnmover.c:2779:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  svn_element__tree_set(from_subtree->tree, from_subtree->tree->root_eid,
  ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
]]]

I think we should enable this warning by default in maintainer mode in
supporting compilers, but that's a separate discussion to just fixing
these error leaks in trunk (& 1.10.x).

Cheers,

Daniel
Received on 2017-12-11 18:22:30 CET

This is an archived mail posted to the Subversion Dev mailing list.