Skip to content

Commit

Permalink
src: fix gcc/clang warnings
Browse files Browse the repository at this point in the history
PR-URL: #297
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
  • Loading branch information
fanatid authored and mmarchini committed Sep 25, 2019
1 parent afaec48 commit 84eefb4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/llnode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ bool PluginInitialize(SBDebugger d) {

setPropertyCmd.AddCommand("color", new llnode::SetPropertyColorCmd(),
"Set color property value");
setPropertyCmd.AddCommand("tree-padding",
new llnode::SetTreePaddingCmd(&llv8),
setPropertyCmd.AddCommand("tree-padding", new llnode::SetTreePaddingCmd(),
"Set tree-padding value");

interpreter.AddCommand("findjsobjects", new llnode::FindObjectsCmd(&llscan),
Expand Down
4 changes: 0 additions & 4 deletions src/llnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ class SetPropertyColorCmd : public CommandBase {

class SetTreePaddingCmd : public CommandBase {
public:
SetTreePaddingCmd(v8::LLV8* llv8) : llv8_(llv8) {}
~SetTreePaddingCmd() override {}

bool DoExecute(lldb::SBDebugger d, char** cmd,
lldb::SBCommandReturnObject& result) override;

private:
v8::LLV8* llv8_;
};

class PrintCmd : public CommandBase {
Expand Down
2 changes: 1 addition & 1 deletion src/llscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ void FindReferencesCmd::PrintRecursiveReferences(
std::stringstream seen_str;
seen_str << rang::fg::red << " [seen above]" << rang::fg::reset
<< std::endl;
result.Printf(seen_str.str().c_str());
result.Printf("%s", seen_str.str().c_str());
} else {
visited_references->push_back(address);
v8::Value value(llscan_->v8(), address);
Expand Down
10 changes: 7 additions & 3 deletions src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ double LLV8::LoadDouble(int64_t addr, Error& err) {
}

err = Error::Ok();
return *reinterpret_cast<double*>(&value);
// dereferencing type-punned pointer will break strict-aliasing rules
// return *reinterpret_cast<double*>(&value);
double dvalue;
std::memcpy(&dvalue, &value, sizeof(double));
return dvalue;
}


Expand Down Expand Up @@ -1288,8 +1292,8 @@ StackTrace::StackTrace(JSArray frame_array, Error& err)
if ((len_ != 0) ||
((frame_array_.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: %d "
"array_len: %ld",
len_, frame_array_.GetArrayLength(err));
len_ = -1;
multiplier_ = -1;
Expand Down

0 comments on commit 84eefb4

Please sign in to comment.