My editor shows warnings like:
value.c:2784: warning: The value returned by this function should be used
value.c:2784: note: cast the expression to void to silence this warning [bugprone-unused-return-value]
These warnings come from clangd, so ultimately from one of the clang
static analyzers (probably clang-tidy).
Silence these warnings by casting to void. Add a comment to explain
why this unusual thing is done.
Change-Id: I58323959c0baf9f1b20a8d596e4c58dc77c6809a
Approved-By: Tom Tromey <tom@tromey.com>
{
struct cmd_list_element *cmd
= do_add_internal_function (name.get (), doc.get (), handler, cookie);
- doc.release ();
+
+ /* Manually transfer the ownership of the doc and name strings to CMD by
+ setting the appropriate flags. */
+ (void) doc.release ();
cmd->doc_allocated = 1;
- name.release ();
+ (void) name.release ();
cmd->name_allocated = 1;
}