[core] Add missing standard library includes - #23227
Conversation
Several files use std::cout/std::cerr or std::ostream without including <iostream> or <ostream> themselves, and only compile because Math/ParamFunctor.h transitively pulls in <iostream>. Add the includes where they are used, so that ParamFunctor.h can drop its own <iostream> include without breaking these translation units. Where a file already listed standard library headers before its ROOT includes, reorder them to follow the convention of ROOT headers first, then other libraries, then the standard library.
|
Maybe a word of caution about `include-what-you-use. Once it was tried for ROOT, and the results obtained on macOS were not compiling on Linux and viceversa. It was a while ago, and another look could demonstrate that the tool drastically improved in that respect... |
|
Thanks for the comments! I don't want to go into cleaning includes in general though. This is just a small PR that well out of a refactor: |
maybe it's also about gcc vs clang ?
I think the tool supports multi-platform input, meaning if platform A requires header X and platform B does not require it, it won't suggest you to remove it. But you still have to find a way to pass it that information since the tool cannot know how other platforms look like. GoogleAI suggests this GH action iwyu.yml.txt which could me modified to use instead our own CI platforms and it could run once a week or whatever. |
Several files use std::cout/std::cerr or std::ostream without including or themselves, and only compile because Math/ParamFunctor.h transitively pulls in .
Add the includes where they are used, so that ParamFunctor.h can drop its own include without breaking these translation units.
Where a file already listed standard library headers before its ROOT includes, reorder them to follow the convention of ROOT headers first, then other libraries, then the standard library.
FYI, @hageboeck