Skip to content

Conversation

@Teemperor
Copy link
Contributor

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.

@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@phsft-bot
Copy link

Build failed on mac1012/native.
See console output.

Failing tests:

@phsft-bot
Copy link

Build failed on ubuntu14/native.
See console output.

Failing tests:

@Teemperor Teemperor force-pushed the AvoidInterpreterInTDataMember branch from 6f96cc3 to 930910b Compare July 26, 2017 04:11
@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@phsft-bot
Copy link

Build failed on slc6/gcc49.
See console output.

Failing tests:

@phsft-bot
Copy link

@phsft-bot
Copy link

Build failed on ubuntu14/native.
See console output.

Failing tests:

@amadio amadio requested a review from pcanal July 26, 2017 07:59
@Teemperor Teemperor force-pushed the AvoidInterpreterInTDataMember branch from 930910b to 5f29f38 Compare July 26, 2017 12:42
@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@Teemperor Teemperor force-pushed the AvoidInterpreterInTDataMember branch from 5f29f38 to 7f292b5 Compare July 28, 2017 12:22
@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@vgvassilev
Copy link
Member

@pcanal ping.

@Teemperor
Copy link
Contributor Author

Teemperor commented Aug 1, 2017

I have to update the PR, so: undo ping @ Philippe :)

@vgvassilev
Copy link
Member

@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 9 ;)

Copy link
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

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

//We'll try to find global enum existing in ROOT...
Long_t l=0;
Int_t *value;
TGlobal *enumval = gROOT->GetGlobal(ptr1,kTRUE);
Copy link
Member

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?

Copy link
Member

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?

if (enumval){

char *strtolResult;
l = std::strtol(ptr1, &strtolResult, 10);
Copy link
Member

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?

if (obj)
l = ((TEnumConstant*)obj)->GetValue();
else
else if (!isnumber)
Copy link
Member

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?

@pcanal
Copy link
Member

pcanal commented Aug 3, 2017

So let's just use atol instead here if
the argument is just a number, which should avoid the issue with
the generated code.

Yes, checking 'early' that the string is just a number is a good idea.

@Teemperor Teemperor force-pushed the AvoidInterpreterInTDataMember branch from 7f292b5 to 7de1718 Compare August 3, 2017 21:15
@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@Teemperor
Copy link
Contributor Author

@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.

@vgvassilev
Copy link
Member

@Teemperor I hate to say this but do you feel like adding a gtest ;) ?

@Axel-Naumann
Copy link
Member

Axel-Naumann commented Aug 15, 2017

@pcanal can this be merged?

@vgvassilev
Copy link
Member

@Teemperor could you fix the coding violations?

@pcanal
Copy link
Member

pcanal commented Aug 15, 2017

@Axel-Naumann Yes (pending clang-formating).

@Teemperor Teemperor force-pushed the AvoidInterpreterInTDataMember branch from 7de1718 to 55aefa9 Compare August 23, 2017 13:55
@phsft-bot
Copy link

Starting build on centos7/gcc49, mac1012/native, slc6/gcc49, slc6/gcc62, ubuntu14/native with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@Teemperor
Copy link
Contributor Author

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.
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.

5 participants