Skip to content

Commit

Permalink
src: fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchini committed Jan 21, 2019
1 parent cdcd221 commit 58cfbd0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
7 changes: 5 additions & 2 deletions src/llscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ bool FindReferencesCmd::DoExecute(SBDebugger d, char** cmd,
* - Objects that refer to a particular string literal.
* (lldb) findreferences -s "Hello World!"
*/
case ScanType::kBadOption: {
case ScanType::kBadOption:
default: {
result.SetError("Invalid search type");
result.SetStatus(eReturnStatusFailed);
return false;
Expand Down Expand Up @@ -1540,7 +1541,6 @@ inline static ByteOrder GetHostByteOrder() {
}

void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
bool done = false;

const uint64_t addr_size = process_.GetAddressByteSize();
bool swap_bytes = process_.GetByteOrder() != GetHostByteOrder();
Expand All @@ -1550,6 +1550,7 @@ void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
unsigned char* block = new unsigned char[block_size];

#ifndef LLDB_SBMemoryRegionInfoList_h_
bool done = false;
MemoryRange* head = ranges_;

while (head != nullptr && !done) {
Expand Down Expand Up @@ -1614,7 +1615,9 @@ void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
}

if (increment == 0) {
#ifndef LLDB_SBMemoryRegionInfoList_h_
done = true;
#endif // LLDB_SBMemoryRegionInfoList_h_
break;
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ int64_t LLV8::LoadUnsigned(int64_t addr, uint32_t byte_size, Error& err) {

double LLV8::LoadDouble(int64_t addr, Error& err) {
SBError sberr;
int64_t value = process_.ReadUnsignedFromMemory(static_cast<addr_t>(addr),
sizeof(double), sberr);
if (sberr.Fail()) {
double value;
size_t result = process_.ReadMemory(static_cast<addr_t>(addr), &value, sizeof(double), sberr);
if (sberr.Fail() || result != sizeof(double)) {
err = Error::Failure(
"Failed to load double from v8 memory, "
"addr=0x%016" PRIx64,
Expand All @@ -110,7 +110,7 @@ double LLV8::LoadDouble(int64_t addr, Error& err) {
}

err = Error::Ok();
return *reinterpret_cast<double*>(&value);
return value;
}


Expand Down Expand Up @@ -1108,9 +1108,7 @@ Value JSObject::GetDescriptorProperty(std::string key_name, Map map,

if (descriptors.IsConstFieldDetails(details) ||
descriptors.IsDescriptorDetails(details)) {
Value value;

value = descriptors.GetValue(i, err);
descriptors.GetValue(i, err);
if (err.Fail()) return Value();

continue;
Expand All @@ -1127,11 +1125,10 @@ Value JSObject::GetDescriptorProperty(std::string key_name, Map map,
int64_t index = descriptors.FieldIndex(details) - in_object_count;

if (descriptors.IsDoubleField(details)) {
double value;
if (index < 0) {
value = GetInObjectValue<double>(instance_size, index, err);
GetInObjectValue<double>(instance_size, index, err);
} else {
value = extra_properties.Get<double>(index, err);
extra_properties.Get<double>(index, err);
}

if (err.Fail()) return Value();
Expand Down
4 changes: 2 additions & 2 deletions src/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ std::string Printer::Stringify(v8::JSError js_error, Error& err) {
if ((stack_len != 0) ||
((arr.GetArrayLength(err) - 1) % multiplier != 0)) {
Error::PrintInDebugMode(
"JSArray doesn't look like a Stack Frames array. stack_len: %lld "
"array_len: %lld",
"JSArray doesn't look like a Stack Frames array. stack_len: %ld "
"array_len: %ld",
stack_len, arr.GetArrayLength(err));
output << rang::fg::yellow << ">" << rang::fg::reset;
return output.str();
Expand Down

0 comments on commit 58cfbd0

Please sign in to comment.