sanitise sign comparisons
This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc. This helps cleanup some of the warning
spew that occurs during builds.
llvm-svn: 205390
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp
index b6f34fd..774d1bb 100644
--- a/lldb/source/Interpreter/Args.cpp
+++ b/lldb/source/Interpreter/Args.cpp
@@ -1516,11 +1516,11 @@
// were passed. This will be useful when we come to restricting completions based on what other
// options we've seen on the line.
- if (OptionParser::GetOptionIndex() < dummy_vec.size() - 1
+ if (static_cast<size_t>(OptionParser::GetOptionIndex()) < dummy_vec.size() - 1
&& (strcmp (dummy_vec[OptionParser::GetOptionIndex()-1], "--") == 0))
{
dash_dash_pos = OptionParser::GetOptionIndex() - 1;
- if (OptionParser::GetOptionIndex() - 1 == cursor_index)
+ if (static_cast<size_t>(OptionParser::GetOptionIndex() - 1) == cursor_index)
{
option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, OptionParser::GetOptionIndex() - 1,
OptionArgElement::eBareDoubleDash));
@@ -1630,7 +1630,7 @@
// the option_element_vector, but only if it is not after the "--". But it turns out that OptionParser::Parse just ignores
// an isolated "-". So we have to look it up by hand here. We only care if it is AT the cursor position.
- if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos)
+ if ((static_cast<int32_t>(dash_dash_pos) == -1 || cursor_index < dash_dash_pos)
&& strcmp (GetArgumentAtIndex(cursor_index), "-") == 0)
{
option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDash, cursor_index,
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 18f108b..6dfb2ca 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1363,7 +1363,7 @@
int index = GetOptionArgumentPosition (value.c_str());
if (index == 0)
result_str.Printf ("%s", value.c_str());
- else if (index >= cmd_args.GetArgumentCount())
+ else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
{
result.AppendErrorWithFormat
@@ -2254,7 +2254,7 @@
}
}
- else if (index >= cmd_args.GetArgumentCount())
+ else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
{
result.AppendErrorWithFormat
("Not enough arguments provided; you need at least %d arguments to use this alias.\n",
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index c699536..0dba2a3 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -477,7 +477,7 @@
CommandObject::CommandArgumentEntry *
CommandObject::GetArgumentEntryAtIndex (int idx)
{
- if (idx < m_arguments.size())
+ if (static_cast<size_t>(idx) < m_arguments.size())
return &(m_arguments[idx]);
return NULL;
diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp
index 9a01558..ee70a0a 100644
--- a/lldb/source/Interpreter/OptionValueArray.cpp
+++ b/lldb/source/Interpreter/OptionValueArray.cpp
@@ -222,7 +222,8 @@
size_t i;
for (i=0; i<argc; ++i)
{
- const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
+ const size_t idx =
+ Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
if (idx >= size)
{
all_indexes_valid = false;
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index c6c66d8..ce98757 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -344,7 +344,7 @@
// Will it all fit on one line?
- if ((len + strm.GetIndentLevel()) < output_max_columns)
+ if (static_cast<uint32_t>(len + strm.GetIndentLevel()) < output_max_columns)
{
// Output it as a single line.
strm.Indent (text);