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

[root6] Address issues in TTable when interpreted by Cling #449

Merged
merged 4 commits into from
Dec 10, 2022

Conversation

plexoos
Copy link
Member

@plexoos plexoos commented Nov 23, 2022

Our ROOT6 tests indicated a problem with the ROOT's TTable class when it is interpreted by the bfc.C macro. A few fixes seem to take care of that but now we need to build and use the local code from StRoot/Table instead of the external libTable provided by ROOT. This is achieved by building StRoot/Table conditionally only when external dependency on ROOT >= 6 is detected.

It appears Cling chokes on some code in `StRoot/Table/TTable.h` while trying to
interpret it:

```
In file included from St_tpcPadConfig_TableCint dictionary payload:10:
In file included from ./.sl79_gcc485/include/tables/St_tpcPadConfig_Table.h:5:
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:197:33: error: cannot increment value of type 'TTable::iterator::vec_iterator' (aka '__normal_iterator<long *, std::vector<long, std::allocator<long> > >')
         void operator++()    { ++fCurrentRow;   }
                                ^ ~~~~~~~~~~~
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:198:46: error: cannot increment value of type 'TTable::iterator::vec_iterator' (aka '__normal_iterator<long *, std::vector<long, std::allocator<long> > >')
         void operator++(int) {   fCurrentRow++; }
                                  ~~~~~~~~~~~^
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:199:33: error: cannot decrement value of type 'TTable::iterator::vec_iterator' (aka '__normal_iterator<long *, std::vector<long, std::allocator<long> > >')
         void operator--()    { --fCurrentRow;   }
                                ^ ~~~~~~~~~~~
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:200:46: error: cannot decrement value of type 'TTable::iterator::vec_iterator' (aka '__normal_iterator<long *, std::vector<long, std::allocator<long> > >')
         void operator--(int) {   fCurrentRow--; }
                                  ~~~~~~~~~~~^
```

While the same code compiles fine by gcc 4.8.5 we can "hide" it from Cling by
moving it to the implementation file.
While interpreting the code in `Table/TTable.h` Cling complains about
unintialized member of type `std::vector<long>::iterator`:

```
LoadTable: .L /star-sw/StarDb/Geometry/tpc/tpcPadConfig.y2019.C
In file included from ./.sl79_gcc485/include/tables/St_tpcPadConfig_Table.h:5:
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:188:10: error: constructor for 'TTable::iterator' must explicitly initialize the member 'fCurrentRow' which does not have a default constructor
         iterator(): fRowSize(0), fThisTable(0) {;}
         ^
/opt/software/linux-scientific7-x86_64/gcc-4.8.5/root-6.16.00-osnvudkiguzfhdpqgy2krbqybjbqvith/include/TTable.h:186:24: note: member is declared here
         vec_iterator  fCurrentRow;
```

C++ allows to leave class members uninitilized but it is also true that it does
not make much sense to have a default constructor for an iterator. It appears to
me that `TTable::iterator()` is not used anywhere in the code therefore, it
should be safe to get rid of it.
We need to build the internal libTable in order to use the modified code
Copy link
Contributor

@klendathu2k klendathu2k 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 to me.

@plexoos plexoos added the ROOT6 Issues and changes related to transition from ROOT5 to ROOT6 label Nov 23, 2022
StRoot/Table/TTable.cxx Show resolved Hide resolved
mgr/Conscript-standard Show resolved Hide resolved
plexoos added a commit to plexoos/star-sw that referenced this pull request Nov 28, 2022
@plexoos plexoos merged commit 6ffad9e into star-bnl:main Dec 10, 2022
@plexoos plexoos deleted the pr/root6_ttable branch December 10, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ROOT6 Issues and changes related to transition from ROOT5 to ROOT6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants