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

Sort includes by category using clang-format #2023

Merged
merged 1 commit into from
May 24, 2019

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented May 23, 2019

Header file includes should be placed from most dependent at the top to least dependent. This ensures that the header files themselves are including the correct dependent header files needed to compile correctly without relying on fluky source file include order including dependents for them. We do not generally use "" for files in the same project, so this does not fully adhere as all nano headers are grouped together in this PR but it is an improvement at least, the includes are now sorted as follows:

  1. "" - Not currently used in our source code
  2. <nano/*>
  3. <crypto|gtest/*>
  4. <boost/*>
  5. <system>

There were some header files which needed to included to fix some build failures as a result of moving them around.

@wezrule wezrule requested a review from cryptocode May 23, 2019 13:59
@wezrule wezrule self-assigned this May 23, 2019
@wezrule wezrule requested a review from argakiig May 23, 2019 13:59
Copy link
Contributor

@cryptocode cryptocode left a comment

Choose a reason for hiding this comment

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

Compiles on macos and clang-format 8.0.0 agrees with the output.

I would personally prefer stripping whitespaces between header groups, but not a big deal.

Copy link
Contributor

@argakiig argakiig left a comment

Choose a reason for hiding this comment

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

windows and clang-format version 6.0.1 (tags/RELEASE_601/final) agree 👍

@wezrule wezrule added this to the V19.0 milestone May 24, 2019
@wezrule wezrule merged commit 6c8420b into nanocurrency:master May 24, 2019
@wezrule wezrule deleted the clang_format_sort_includes branch May 24, 2019 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants