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

src: fix gcc/clang warnings #297

Closed
wants to merge 1 commit into from
Closed
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
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