-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Avoid using the interpreter from TDataMember if possible. #807
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
Avoid using the interpreter from TDataMember if possible. #807
Conversation
|
Starting build on |
|
Build failed on mac1012/native. Failing tests: |
|
Build failed on ubuntu14/native. Failing tests: |
6f96cc3 to
930910b
Compare
|
Starting build on |
|
Build failed on slc6/gcc49. Failing tests: |
|
Build failed on mac1012/native. Failing tests: |
|
Build failed on ubuntu14/native. Failing tests: |
930910b to
5f29f38
Compare
|
Starting build on |
5f29f38 to
7f292b5
Compare
|
Starting build on |
|
@pcanal ping. |
|
I have to update the PR, so: undo ping @ Philippe :) |
|
@Teemperor, did you mean updating it by reducing the scope of the fix as we discussed before? I still would like @pcanal to comment on the general direction, esp that we know we have a single use case of this code in Eve, which is the constant |
Axel-Naumann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny comments - plus you trigger the assert in roottest, see https://epsft-jenkins.cern.ch/job/root-pullrequests-build/3438/testReport/projectroot.roottest.root/html/roottest_root_html_runMakeIndex/
core/meta/src/TDataMember.cxx
Outdated
| //We'll try to find global enum existing in ROOT... | ||
| Long_t l=0; | ||
| Int_t *value; | ||
| TGlobal *enumval = gROOT->GetGlobal(ptr1,kTRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you call TROOT::GetGlobal() if the string is just a number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. Should the strtol be even before this call?
core/meta/src/TDataMember.cxx
Outdated
| if (enumval){ | ||
|
|
||
| char *strtolResult; | ||
| l = std::strtol(ptr1, &strtolResult, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move the decl of l here?
core/meta/src/TDataMember.cxx
Outdated
| if (obj) | ||
| l = ((TEnumConstant*)obj)->GetValue(); | ||
| else | ||
| else if (!isnumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnumber must be false here, right?
Yes, checking 'early' that the string is just a number is a good idea. |
7f292b5 to
7de1718
Compare
|
Starting build on |
|
@Axel-Naumann the assert failure was for a previous version of this PR, the one you reviewed already had the fix :) I think I addressed all comments in the newest revision, let's see if we get a green Jenkins with the current state of the master. |
|
@Teemperor I hate to say this but do you feel like adding a gtest ;) ? |
|
@pcanal can this be merged? |
|
@Teemperor could you fix the coding violations? |
|
@Axel-Naumann Yes (pending clang-formating). |
7de1718 to
55aefa9
Compare
|
Starting build on |
|
Back from vacation, formatted the code. |
We can't use the interpreter when generating a PCM as this would generate AST nodes which then would end up in the module, which is causing a long chain of modules (such as redefinitons as we suddenly have the same cling warpper function multiple times). In this code path we seem to always have a number that we want to convert to a string. So let's just use strtol instead here if the argument is just a number, which should avoid the issue with the generated code. As we also now check if the input is a number, I added an assert that verifies we fail when we can't handle the given user input.
We can't use the interpreter when generating a PCM as this would
generate AST nodes which then would end up in the module, which
is causing a long chain of modules (such as redefinitons as we
suddenly have the same cling warpper function multiple times).
In this code path we seem to always have a number that we want
to convert to a string. So let's just use atol instead here if
the argument is just a number, which should avoid the issue with
the generated code.
As we also now check if the input is a number, I added an assert
that verifies we only call atol when the string is actually a
number.