Skip to content

Commit 127756a

Browse files
committed
src: fix compiler warnings
1 parent 933b9d8 commit 127756a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/llscan.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ bool FindReferencesCmd::DoExecute(SBDebugger d, char** cmd,
553553
* - Objects that refer to a particular string literal.
554554
* (lldb) findreferences -s "Hello World!"
555555
*/
556-
case ScanType::kBadOption: {
556+
case ScanType::kBadOption:
557+
default: {
557558
result.SetError("Invalid search type");
558559
result.SetStatus(eReturnStatusFailed);
559560
return false;
@@ -1540,7 +1541,6 @@ inline static ByteOrder GetHostByteOrder() {
15401541
}
15411542

15421543
void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
1543-
bool done = false;
15441544

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

15521552
#ifndef LLDB_SBMemoryRegionInfoList_h_
1553+
bool done = false;
15531554
MemoryRange* head = ranges_;
15541555

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

16161617
if (increment == 0) {
1618+
#ifndef LLDB_SBMemoryRegionInfoList_h_
16171619
done = true;
1620+
#endif // LLDB_SBMemoryRegionInfoList_h_
16181621
break;
16191622
}
16201623
}

src/llv8.cc

+7-10
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ int64_t LLV8::LoadUnsigned(int64_t addr, uint32_t byte_size, Error& err) {
9999

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

112112
err = Error::Ok();
113-
return *reinterpret_cast<double*>(&value);
113+
return value;
114114
}
115115

116116

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

11091109
if (descriptors.IsConstFieldDetails(details) ||
11101110
descriptors.IsDescriptorDetails(details)) {
1111-
Value value;
1112-
1113-
value = descriptors.GetValue(i, err);
1111+
descriptors.GetValue(i, err);
11141112
if (err.Fail()) return Value();
11151113

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

11291127
if (descriptors.IsDoubleField(details)) {
1130-
double value;
11311128
if (index < 0) {
1132-
value = GetInObjectValue<double>(instance_size, index, err);
1129+
GetInObjectValue<double>(instance_size, index, err);
11331130
} else {
1134-
value = extra_properties.Get<double>(index, err);
1131+
extra_properties.Get<double>(index, err);
11351132
}
11361133

11371134
if (err.Fail()) return Value();

src/printer.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ std::string Printer::Stringify(v8::JSError js_error, Error& err) {
615615
if ((stack_len != 0) ||
616616
((arr.GetArrayLength(err) - 1) % multiplier != 0)) {
617617
Error::PrintInDebugMode(
618-
"JSArray doesn't look like a Stack Frames array. stack_len: %lld "
619-
"array_len: %lld",
618+
"JSArray doesn't look like a Stack Frames array. stack_len: %ld "
619+
"array_len: %ld",
620620
stack_len, arr.GetArrayLength(err));
621621
output << rang::fg::yellow << ">" << rang::fg::reset;
622622
return output.str();

0 commit comments

Comments
 (0)