Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

travis: enforce -Werror #261

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: node_js
env:
CXXFLAGS="-Werror"
matrix:
include:
#################
Expand Down
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: %" PRId64 " "
"array_len: %" PRId64,
stack_len, arr.GetArrayLength(err));
output << rang::fg::yellow << ">" << rang::fg::reset;
return output.str();
Expand Down