diff --git a/src/complete.cpp b/src/complete.cpp index c81de5f1e..bb17b0310 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -671,8 +671,11 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool if (use_implicit_cd) { // We don't really care if this succeeds or fails. If it succeeds this->completions will be // updated with choices for the user. - (void)expand_string(str_cmd, &this->completions, - EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL); + expand_error_t ignore = + expand_string(str_cmd, &this->completions, + EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), + NULL); + USE(ignore); } if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') { diff --git a/src/input.cpp b/src/input.cpp index cfd409cdc..9e9989b84 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -493,7 +493,7 @@ static void input_mapping_execute(const input_mapping_t &m, bool allow_commands) /// Try reading the specified function mapping. static bool input_mapping_is_match(const input_mapping_t &m) { - wint_t c = 0; + wchar_t c = 0; int j; debug(2, L"trying to match mapping %ls", escape(m.seq.c_str(), ESCAPE_ALL).c_str()); diff --git a/src/pager.cpp b/src/pager.cpp index c4b9c7e2a..70373b0af 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -183,7 +183,6 @@ void pager_t::completion_print(size_t cols, const size_t *width_by_column, size_ size_t row_stop, const wcstring &prefix, const comp_info_list_t &lst, page_rendering_t *rendering) const { // Teach the rendering about the rows it printed. - assert(row_start >= 0); assert(row_stop >= row_start); rendering->row_start = row_start; rendering->row_end = row_stop; @@ -456,7 +455,7 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co size_t last_starting_row = row_count - term_height; start_row = mini(suggested_start_row, last_starting_row); stop_row = start_row + term_height; - assert(start_row >= 0 && start_row <= last_starting_row); + assert(start_row <= last_starting_row); } assert(stop_row >= start_row); diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index ea7ab6e40..5f6c9a6ba 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -103,7 +103,6 @@ node_offset_t parse_execution_context_t::get_offset(const parse_node_t &node) co const parse_node_t *addr = &node; const parse_node_t *base = &this->tree.at(0); assert(addr >= base); - assert(addr - base < SOURCE_OFFSET_INVALID); node_offset_t offset = static_cast(addr - base); assert(offset < this->tree.size()); assert(&tree.at(offset) == &node); diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 121ffc513..f3bbdbf43 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -1326,10 +1326,12 @@ bool parse_node_tree_t::argument_list_is_root(const parse_node_t &node) const { enum parse_statement_decoration_t parse_node_tree_t::decoration_for_plain_statement( const parse_node_t &node) const { assert(node.type == symbol_plain_statement); + parse_statement_decoration_t decoration = parse_statement_decoration_none; const parse_node_t *decorated_statement = this->get_parent(node, symbol_decorated_statement); - parse_node_tag_t tag = - decorated_statement ? decorated_statement->tag : parse_statement_decoration_none; - return static_cast(tag); + if (decorated_statement) { + decoration = static_cast(decorated_statement->tag); + } + return decoration; } bool parse_node_tree_t::command_for_plain_statement(const parse_node_t &node, const wcstring &src, diff --git a/src/parse_tree.h b/src/parse_tree.h index 7b994fbd6..dc932a782 100644 --- a/src/parse_tree.h +++ b/src/parse_tree.h @@ -20,7 +20,7 @@ typedef uint32_t node_offset_t; typedef uint32_t source_offset_t; -#define SOURCE_OFFSET_INVALID (static_cast(-1)) +constexpr source_offset_t SOURCE_OFFSET_INVALID = static_cast(-1); /// A struct representing the token type that we use internally. struct parse_token_t { diff --git a/src/parse_util.cpp b/src/parse_util.cpp index 361214fcd..f0a6177c8 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -347,8 +347,6 @@ void parse_util_token_extent(const wchar_t *buff, size_t cursor_pos, const wchar CHECK(buff, ); - assert(cursor_pos >= 0); - const wchar_t *cmdsubst_begin, *cmdsubst_end; parse_util_cmdsubst_extent(buff, cursor_pos, &cmdsubst_begin, &cmdsubst_end); @@ -840,7 +838,7 @@ void parse_util_expand_variable_error(const wcstring &token, size_t global_token // report a bracket error. Otherwise just complain about the ${. bool looks_like_variable = false; size_t closing_bracket = - token.find(char_after_dollar == L'{' ? L'}' : BRACKET_END, dollar_pos + 2); + token.find(char_after_dollar == L'{' ? L'}' : wchar_t(BRACKET_END), dollar_pos + 2); wcstring var_name; if (closing_bracket != wcstring::npos) { size_t var_start = dollar_pos + 2, var_end = closing_bracket;