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

optimise includes in math #123

Closed
wants to merge 1 commit into from

Conversation

pseyfert
Copy link
Contributor

cleaning up a few includes in math/mathmore and math/physics.
NB:

  1. root builds for me with these changes but i didn't check for platform independence (when it comes to system headers)
  2. removing includes from headers may break 3rd party code including those headers i manipulated.

@sbogacz
Copy link

sbogacz commented May 13, 2016

This is my first foray into this project, but there are a few instances of commenting out the includes instead of fully removing them. If they can in fact be safely removed regardless of the target platform, then the lines should be removed to avoid cluttering up the code base.

@peremato peremato assigned lmoneta and unassigned lmoneta Mar 1, 2017
@vgvassilev
Copy link
Member

@pseyfert, good work! Could you rebase and remove the redundant lines instead of commenting them out?

@phsft-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@vgvassilev vgvassilev self-assigned this Mar 8, 2017
@pseyfert
Copy link
Contributor Author

pseyfert commented Mar 9, 2017

  • Rebased and deleted includes instead of commenting out.
  • I didn't rerun IWYU so I'm curious if the build still succeeds.
  • Also the rebase failed on math/physics/inc/TVector3.h where I used the master for simplicity.

@vgvassilev
Copy link
Member

@phsft-bot: build.

@vgvassilev
Copy link
Member

@phsft-bot: build!

1 similar comment
@vgvassilev
Copy link
Member

@phsft-bot: build!

@vgvassilev
Copy link
Member

@phsft-bot build!

@vgvassilev
Copy link
Member

@pseyfert, do you think you can optimise the rest of the includes in ROOT in a similar manner in a new PR?

@pseyfert
Copy link
Contributor Author

need to check. i didn't get iwyu running with cmake and haven't used ./configure since quite a while.
i had tried it back then for roofit and realised it caused problems in my own "third party" code if a class A has a method to return a pointer to an instance of class B, but A.h doesn't include B.h.

@vgvassilev
Copy link
Member

vgvassilev commented Mar 10, 2017 via email

@vgvassilev
Copy link
Member

Merged, thanks! I'd be happy to review a PR, running IWYU on the rest of the ROOT codebase!

@vgvassilev vgvassilev closed this Mar 11, 2017
@pseyfert
Copy link
Contributor Author

cool, will notify you once i came around running it.

@pseyfert
Copy link
Contributor Author

@vgvassilev I put the output of a first run /afs/cern.ch/work/p/pseyfert/public/iwyu.log It's quite big (and i didn't even build all components) and also involves parts I don't dare to touch (llvm). I'll clean up my changes to the cmake files and factorise the suggestions a bit.

@vgvassilev
Copy link
Member

vgvassilev commented May 19, 2017

Good progress. I do not understand why it says we should remove the .o files. Do you have an in-source build somehow?

We should ignore the fixes in llvm at first. Then we should ask the iwyu to order the suggested includes by generality (i.e. stl, libc go last).

@pseyfert
Copy link
Contributor Author

changes to cmake now available here: https://github.com/pseyfert/root/tree/IWYU .
It's not an in-source build, but I iterated a few times with

cd ../build
rm -rf *
cmake ../root -G Ninja .......
cmake --build .

and once i saw the first iwyu output (realising i put the parts together correctly), I didn't do an rm -rf (don't touch a running system) and ran:

cmake --build . --clean-first -- -v

@vgvassilev
Copy link
Member

Ok, looks very good. Can we implement this as a travis check. I don't expect people to run it locally.

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