Skip to content

Conversation

@VivekPanyam
Copy link
Collaborator

Summary:

Refactor code under source/neuropod/multiprocess to adhere to the stricter set of warnings introduced in #437

Test Plan:

CI

@VivekPanyam VivekPanyam force-pushed the multiprocess_cc_warnings branch from 81a1700 to 63939bd Compare September 22, 2020 05:18
@codecov
Copy link

codecov bot commented Sep 22, 2020

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.23%. Comparing base (73f3a31) to head (63939bd).
⚠️ Report is 76 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #443   +/-   ##
=======================================
  Coverage   88.23%   88.23%           
=======================================
  Files         101      102    +1     
  Lines        6356     6356           
=======================================
  Hits         5608     5608           
  Misses        748      748           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


// Null terminated char * array
char *env_arr[env.size() + 1];
std::vector<char *> env_arr(env.size() + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case of vector, all elements are initialized with 0 (nullptr) already because it calls (char*) init for every element, so next line is redundant (it was necessary for regular array though)


auto base_ptr = byte_block->get_raw_data_ptr();
auto max_len = dims[dims.size() - 1];
auto max_len = static_cast<size_t>(dims[dims.size() - 1]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this cast is not needed and as result you don't need to cast it then at line 229 again

// with `allocator` without making a copy, you could use this function
std::shared_ptr<NeuropodTensor> wrap_existing_tensor(NeuropodTensorAllocator & allocator,
std::shared_ptr<NeuropodTensor> tensor)
static std::shared_ptr<NeuropodTensor> wrap_existing_tensor(NeuropodTensorAllocator & allocator,
Copy link
Contributor

@vkuzmin-uber vkuzmin-uber Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting why static is necessary here, did compiler require it to be static?

Some thoughts:
In C++, anonymous namespace was recommended and "static" was even deprecated for vars and functions. It was undeprecated in C++11

Some discussion clarifies details https://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-static-functions

Anyway, please share details on it

Copy link
Contributor

@vkuzmin-uber vkuzmin-uber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please check I left comment and question.

@VivekPanyam VivekPanyam force-pushed the backends_cc_warnings branch from ad04349 to 39a9c4c Compare October 1, 2020 00:30
Base automatically changed from backends_cc_warnings to master October 1, 2020 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants