-
Notifications
You must be signed in to change notification settings - Fork 224
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
Simplify #include statements #322
Conversation
Just to support my claim on: there are a lot of includes in subdirectories -- typically tests -- which in fact use the wrong number of "../". One of many examples is #include "../../../include/networkit/algebraic/GraphBLAS.hpp" This points to |
Thank you for the PR, Manuel. This was already on our TODO list since we moved the headers to The second option for local files should be preferred in public headers. In principle, the first option could be used for private headers but as far as I can see, we don't have private headers right now. |
I consider this PR complete. We should definitely add some automatic checks for CI. But this should be done in a separate PR. Please let me know, if you spot anything else. |
What do you mean by automated checks for CI? Checking that nobody introduces relative includes again? |
Exactly. I used a script for these conversions which could in theory be modified. However, I think it's for the best, if we first commit to some form of infrastructure for that; otherwise each checker will solve similar issues such as finding all relevant header/source files redundantly. |
This has been open for a week now; I don't see any issues with this patch set, so I will merge it. Future PRs should now always use <> includes. |
Commit 4736fde moved header files into
include/networkit
which resulted in error-prone#include
statements such asThey should be written as:
The first option is harder to read, less flexible and tedious to write (as I've seen while working on #320).
Also the second format is more consistent for external users linking against NetworKit.
This PR does the following:
CMakeList.txt
with higher priority than system search path (to prevent usage of installed headers)#include "omp.h"
to#include <omp.h>
If you think this change is worth-while, there's a decision to make:
How do we treat includes of siblings within the same directory (e.g.
A/bar.hpp
includesA/foo.hpp
). Do you prefer#include "foo.hpp"
(shorter) or#include <networkit/A/foo.hpp>
(more verbose).I feel the more consistent second options is better, as it leaves no exceptions which have to communicated in the style guide.