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

Compilation warnings #374

Open
wants to merge 8 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
10 changes: 10 additions & 0 deletions llnode.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
"cflags": [
"-std=c++11", "-fPIC",
],
"cflags_cc": [
"-Werror",
"-Wall",
"-Wextra",
"-Wendif-labels",
"-W",
"-Wno-unused-parameter",
],
"xcode_settings": {
"GCC_VERSION": "com.apple.compilers.llvm.clang.1_0",
"GCC_WARN_ABOUT_MISSING_NEWLINE": "YES", # -Wnewline-eof
Expand All @@ -51,7 +59,9 @@
"-g",
],
"WARNING_CFLAGS": [
"-Werror",
"-Wall",
"-Wextra",
"-Wendif-labels",
"-W",
"-Wno-unused-parameter",
Expand Down
5 changes: 3 additions & 2 deletions src/llscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ bool FindReferencesCmd::DoExecute(SBDebugger d, char** cmd,
* - Objects that refer to a particular string literal.
* (lldb) findreferences -s "Hello World!"
*/
case ScanOptions::ScanType::kBadOption: {
case ScanOptions::ScanType::kBadOption:
default: {
result.SetError("Invalid search type");
result.SetStatus(eReturnStatusFailed);
return false;
Expand Down Expand Up @@ -596,7 +597,7 @@ bool FindReferencesCmd::DoExecute(SBDebugger d, char** cmd,
void FindReferencesCmd::ScanForReferences(ObjectScanner* scanner) {
// Walk all the object instances and handle them according to their type.
TypeRecordMap mapstoinstances = llscan_->GetMapsToInstances();
for (auto const entry : mapstoinstances) {
for (auto const& entry : mapstoinstances) {
TypeRecord* typerecord = entry.second;

for (uint64_t addr : typerecord->GetInstances()) {
Expand Down
2 changes: 1 addition & 1 deletion src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ std::string Symbol::ToString(Error& err) {
return "Symbol()";
}
HeapObject name = Name(err);
RETURN_IF_INVALID(name, "Symbol(???)");
RETURN_IF_INVALID(name, "Symbol(\?\?\?)");
return "Symbol('" + String(name).ToString(err) + "')";
}

Expand Down
6 changes: 3 additions & 3 deletions src/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ std::string Printer::Stringify(v8::JSArrayBuffer js_array_buffer, Error& err) {
} else {
res += " [\n ";

int display_length = std::min<int>(*byte_length, options_.length);
size_t display_length = std::min<size_t>(*byte_length, options_.length);
res += llv8_->LoadBytes(*data, display_length, err);

if (display_length < *byte_length) {
Expand Down Expand Up @@ -430,7 +430,7 @@ std::string Printer::Stringify(v8::JSTypedArray js_typed_array, Error& err) {

res += " [\n ";

int display_length = std::min<int>(*byte_length, options_.length);
size_t display_length = std::min<size_t>(*byte_length, options_.length);
res += llv8_->LoadBytes(*data + *byte_offset, display_length, err);

if (display_length < *byte_length) {
Expand Down Expand Up @@ -511,7 +511,7 @@ std::string Printer::Stringify(v8::Map map, Error& err) {
return std::string(tmp) + ":" +
Stringify<v8::FixedArray>(descriptors, err) + ">";
} else {
std::string(tmp) + ">";
return std::string(tmp) + ">";
}
}

Expand Down
5 changes: 3 additions & 2 deletions test/plugin/inspect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,9 @@ function verifyInvalidExpr(t, sess) {
if (err) {
return teardown(t, sess, err);
}
t.ok(
/error: error: use of undeclared identifier 'invalid_expr'/.test(line),

t.ok(/^error: error: /.test(line)
&& / use of undeclared identifier 'invalid_expr'$/.test(line),
'invalid expression should return an error'
);
teardown(t, sess);
Expand Down
4 changes: 2 additions & 2 deletions test/plugin/scan-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function testFindrefsForInvalidExpr(t, sess, next) {
sess.send('v8 findrefs invalid_expr');
sess.waitError(/error:/, (err, line) => {
t.error(err);
t.ok(
/error: error: use of undeclared identifier 'invalid_expr'/.test(line),
t.ok(/^error: error: /.test(line)
&& / use of undeclared identifier 'invalid_expr'$/.test(line),
'invalid expression should return an error'
);
next();
Expand Down