mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
lint: multiple unary operator
This commit is contained in:
parent
7ea2dc4488
commit
f382fa8e8a
13 changed files with 20 additions and 20 deletions
|
@ -3228,7 +3228,7 @@ void builtin_init() {
|
|||
void builtin_destroy() {}
|
||||
|
||||
/// Is there a builtin command with the given name?
|
||||
bool builtin_exists(const wcstring &cmd) { return !!builtin_lookup(cmd); }
|
||||
bool builtin_exists(const wcstring &cmd) { return static_cast<bool>(builtin_lookup(cmd)); }
|
||||
|
||||
/// If builtin takes care of printing help itself
|
||||
static bool builtin_handles_help(const wchar_t *cmd) {
|
||||
|
|
|
@ -590,7 +590,7 @@ bool unary_operator::evaluate(wcstring_list_t &errors) {
|
|||
|
||||
bool combining_expression::evaluate(wcstring_list_t &errors) {
|
||||
if (token == test_combine_and || token == test_combine_or) {
|
||||
assert(!subjects.empty());
|
||||
assert(!subjects.empty()); //!OCLINT(multiple unary operator)
|
||||
assert(combiners.size() + 1 == subjects.size());
|
||||
|
||||
// One-element case.
|
||||
|
|
|
@ -1753,7 +1753,7 @@ void assert_is_locked(void *vmutex, const char *who, const char *caller) {
|
|||
}
|
||||
|
||||
void scoped_lock::lock(void) {
|
||||
assert(!locked);
|
||||
assert(!locked); //!OCLINT(multiple unary operator)
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_lock(lock_obj));
|
||||
locked = true;
|
||||
|
@ -1777,7 +1777,7 @@ scoped_lock::~scoped_lock() {
|
|||
}
|
||||
|
||||
void scoped_rwlock::lock(void) {
|
||||
assert(!(locked || locked_shared));
|
||||
assert(!(locked || locked_shared)); //!OCLINT(multiple unary operator)
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_rdlock(rwlock_obj));
|
||||
locked = true;
|
||||
|
@ -1791,7 +1791,7 @@ void scoped_rwlock::unlock(void) {
|
|||
}
|
||||
|
||||
void scoped_rwlock::lock_shared(void) {
|
||||
assert(!(locked || locked_shared));
|
||||
assert(!(locked || locked_shared)); //!OCLINT(multiple unary operator)
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_wrlock(rwlock_obj));
|
||||
locked_shared = true;
|
||||
|
|
|
@ -1534,7 +1534,7 @@ wcstring complete_print() {
|
|||
break;
|
||||
}
|
||||
case option_type_short: {
|
||||
assert(!o->option.empty());
|
||||
assert(!o->option.empty()); //!OCLINT(multiple unary operator)
|
||||
append_format(out, L" --short-option '%lc'", o->option.at(0));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ int env_remove(const wcstring &key, int var_mode) {
|
|||
}
|
||||
|
||||
const wchar_t *env_var_t::c_str(void) const {
|
||||
assert(!is_missing);
|
||||
assert(!is_missing); //!OCLINT(multiple unary operator)
|
||||
return wcstring::c_str();
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ void exec_job(parser_t &parser, job_t *j) {
|
|||
|
||||
if ((io->io_mode == IO_BUFFER)) {
|
||||
io_buffer_t *io_buffer = static_cast<io_buffer_t *>(io.get());
|
||||
assert(!io_buffer->is_input);
|
||||
assert(!io_buffer->is_input); //!OCLINT(multiple unary operator)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void function_add(const function_data_t &data, const parser_t &parser, int defin
|
|||
UNUSED(parser);
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
|
||||
CHECK(!data.name.empty(), );
|
||||
CHECK(!data.name.empty(), ); //!OCLINT(multiple unary operator)
|
||||
CHECK(data.definition, );
|
||||
scoped_lock locker(functions_lock);
|
||||
|
||||
|
|
|
@ -1184,7 +1184,7 @@ parse_execution_result_t parse_execution_context_t::populate_job_from_job_node(
|
|||
// Return what happened.
|
||||
if (result == parse_execution_success) {
|
||||
// Link up the processes.
|
||||
assert(!processes.empty());
|
||||
assert(!processes.empty()); //!OCLINT(multiple unary operator)
|
||||
j->first_process = processes.at(0);
|
||||
for (size_t i = 1; i < processes.size(); i++) {
|
||||
processes.at(i - 1)->next = processes.at(i);
|
||||
|
@ -1368,7 +1368,7 @@ parse_execution_result_t parse_execution_context_t::run_job_list(const parse_nod
|
|||
parse_execution_result_t parse_execution_context_t::eval_node_at_offset(
|
||||
node_offset_t offset, const block_t *associated_block, const io_chain_t &io) {
|
||||
// Don't ever expect to have an empty tree if this is called.
|
||||
assert(!tree.empty());
|
||||
assert(!tree.empty()); //!OCLINT(multiple unary operator)
|
||||
assert(offset < tree.size());
|
||||
|
||||
// Apply this block IO for the duration of this function.
|
||||
|
|
|
@ -475,7 +475,7 @@ class parse_ll_t {
|
|||
|
||||
/// Get the node corresponding to the top element of the stack.
|
||||
parse_node_t &node_for_top_symbol() {
|
||||
PARSE_ASSERT(!symbol_stack.empty());
|
||||
PARSE_ASSERT(!symbol_stack.empty()); //!OCLINT(multiple unary operator)
|
||||
const parse_stack_element_t &top_symbol = symbol_stack.back();
|
||||
PARSE_ASSERT(top_symbol.node_idx != NODE_OFFSET_INVALID);
|
||||
PARSE_ASSERT(top_symbol.node_idx < nodes.size());
|
||||
|
@ -912,7 +912,7 @@ bool parse_ll_t::report_error_for_unclosed_block() {
|
|||
}
|
||||
|
||||
bool parse_ll_t::top_node_handle_terminal_types(parse_token_t token) {
|
||||
PARSE_ASSERT(!symbol_stack.empty());
|
||||
PARSE_ASSERT(!symbol_stack.empty()); //!OCLINT(multiple unary operator)
|
||||
PARSE_ASSERT(token.type >= FIRST_PARSE_TOKEN_TYPE);
|
||||
bool handled = false;
|
||||
parse_stack_element_t &stack_top = symbol_stack.back();
|
||||
|
@ -1031,7 +1031,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2) {
|
|||
}
|
||||
|
||||
while (!consumed && !this->fatal_errored) {
|
||||
PARSE_ASSERT(!symbol_stack.empty());
|
||||
PARSE_ASSERT(!symbol_stack.empty()); //!OCLINT(multiple unary operator)
|
||||
|
||||
if (top_node_handle_terminal_types(token1)) {
|
||||
if (logit) {
|
||||
|
|
|
@ -344,7 +344,7 @@ void parser_t::expand_argument_list(const wcstring &arg_list_src, expand_flags_t
|
|||
}
|
||||
|
||||
// Get the root argument list.
|
||||
assert(!tree.empty());
|
||||
assert(!tree.empty()); //!OCLINT(multiple unary operator)
|
||||
const parse_node_t *arg_list = &tree.at(0);
|
||||
assert(arg_list->type == symbol_freestanding_argument_list);
|
||||
|
||||
|
@ -725,7 +725,7 @@ bool parser_t::detect_errors_in_argument_list(const wcstring &arg_list_src, wcst
|
|||
|
||||
if (!errored) {
|
||||
// Get the root argument list.
|
||||
assert(!tree.empty());
|
||||
assert(!tree.empty()); //!OCLINT(multiple unary operator)
|
||||
const parse_node_t *arg_list = &tree.at(0);
|
||||
assert(arg_list->type == symbol_freestanding_argument_list);
|
||||
|
||||
|
|
|
@ -3284,7 +3284,7 @@ int reader_search_mode() {
|
|||
if (!data) {
|
||||
return -1;
|
||||
}
|
||||
return !!data->search_mode;
|
||||
return data->search_mode == NO_SEARCH ? 0 : 1;
|
||||
}
|
||||
|
||||
int reader_has_pager_contents() {
|
||||
|
|
|
@ -403,4 +403,4 @@ void signal_unblock() {
|
|||
// debug( 0, L"signal block level decreased to %d", block_count );
|
||||
}
|
||||
|
||||
bool signal_is_blocked() { return !!block_count; }
|
||||
bool signal_is_blocked() { return static_cast<bool>(block_count); }
|
||||
|
|
|
@ -489,7 +489,7 @@ class wildcard_expander_t {
|
|||
|
||||
void add_expansion_result(const wcstring &result) {
|
||||
// This function is only for the non-completions case.
|
||||
assert(!static_cast<bool>(this->flags & EXPAND_FOR_COMPLETIONS));
|
||||
assert(!static_cast<bool>(this->flags & EXPAND_FOR_COMPLETIONS)); //!OCLINT(multiple unary operator)
|
||||
if (this->completion_set.insert(result).second) {
|
||||
append_completion(this->resolved_completions, result);
|
||||
this->did_add = true;
|
||||
|
@ -799,7 +799,7 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc,
|
|||
|
||||
if (wc_segment.empty()) {
|
||||
// Handle empty segment.
|
||||
assert(!segment_has_wildcards);
|
||||
assert(!segment_has_wildcards); //!OCLINT(multiple unary operator)
|
||||
if (is_last_segment) {
|
||||
this->expand_trailing_slash(base_dir, effective_prefix);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue