Defeat some miscellaneous warnings in the g++ build

This commit is contained in:
ridiculousfish 2017-01-26 17:28:46 -08:00
parent e78cefd759
commit a40f491c93
7 changed files with 14 additions and 13 deletions

View File

@ -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'~') {

View File

@ -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());

View File

@ -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);

View File

@ -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<node_offset_t>(addr - base);
assert(offset < this->tree.size());
assert(&tree.at(offset) == &node);

View File

@ -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<parse_statement_decoration_t>(tag);
if (decorated_statement) {
decoration = static_cast<parse_statement_decoration_t>(decorated_statement->tag);
}
return decoration;
}
bool parse_node_tree_t::command_for_plain_statement(const parse_node_t &node, const wcstring &src,

View File

@ -20,7 +20,7 @@ typedef uint32_t node_offset_t;
typedef uint32_t source_offset_t;
#define SOURCE_OFFSET_INVALID (static_cast<source_offset_t>(-1))
constexpr source_offset_t SOURCE_OFFSET_INVALID = static_cast<source_offset_t>(-1);
/// A struct representing the token type that we use internally.
struct parse_token_t {

View File

@ -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;