Skip to content

Fix clang-tidy issues in net classes#7593

Merged
linev merged 4 commits intoroot-project:masterfrom
linev:tidy_net
Mar 19, 2021
Merged

Fix clang-tidy issues in net classes#7593
linev merged 4 commits intoroot-project:masterfrom
linev:tidy_net

Conversation

@linev
Copy link
Copy Markdown
Member

@linev linev commented Mar 18, 2021

Fixes #7528
Civetweb not touched, need to be updated soon anyway

@linev linev requested a review from pcanal March 18, 2021 16:12
@linev linev self-assigned this Mar 18, 2021
@linev linev requested a review from gganis as a code owner March 18, 2021 16:12
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
Bool_t read = (fOption == "READ") ? kTRUE : kFALSE;
if (!create && !recreate && !update && !read) {
read = kTRUE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is one code pattern where I see "some" value in updating the variable even if it is, currently, not used.

If this routine is update at a later date, the developer might assume that the variable 'read' is true is all cases of 'reading mode' even the default one.

On the other hand, not having it at all might be event clearer. i.e. except for the slight extra run-time cost, I think the fillowing code has the same net effect:

Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
if (!create && !recreate && !update) {
     fOption = "READ";
}

with a spurrious re-assignment in case fOption == "READ" ...
So actually maybe even:

Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
if (!create && !recreate && !update && (fOption != "READ")) {
     fOption = "READ";
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am not sure.
fOption can be accessed via TFile::GetOption() method - user can always check that was original option he/she provide.
None of other TFile-based classes, including TFile itself, change fOption in such case.
Either we do it consistently in all places, or do not change it here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

None of other TFile-based classes, including TFile itself, change fOption in such case.

Sorry, I am wrong. I will update PR

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-fedora30/cxx14.
Running on root-fedora30-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@linev linev requested a review from pcanal March 19, 2021 07:22
"READ" is default mode and assigned if none of other modes are
recognized. No need for extra `read` flag.
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-03-19T16:03:01.936Z] C:\build\workspace\root-pullrequests-build\root\roofit\RDataFrameHelpers\test\testActionHelpers.cxx(22,73): error C3493: 'nEvent' cannot be implicitly captured because no default capture mode has been specified [C:\build\workspace\root-pullrequests-build\build\roofit\RDataFrameHelpers\test\testActionHelpers.vcxproj]
  • [2021-03-19T16:03:02.227Z] C:\build\workspace\root-pullrequests-build\root\roofit\RDataFrameHelpers\test\testActionHelpers.cxx(23,73): error C3493: 'nEvent' cannot be implicitly captured because no default capture mode has been specified [C:\build\workspace\root-pullrequests-build\build\roofit\RDataFrameHelpers\test\testActionHelpers.vcxproj]

@linev linev merged commit 6e38eac into root-project:master Mar 19, 2021
@linev linev deleted the tidy_net branch March 19, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[net] Clang-Tidy Clazy Warnings

3 participants