Skip to content

Conversation

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented May 14, 2018

When analysing includes in the project it is often assumed that the preferred bracket include syntax (#include <foo.h>) mentioned in developer-docs.md is used consistently. @sipa:s excellent circular dependencies script circular-dependencies.py (#13228) is an example of a script making this reasonable assumption.

This PR enables automatic Travis checking of the include syntax making sure that the bracket syntax includes (#include <foo.h>) is used consistently.

@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from 0e57f8d to 9d8f70a Compare May 14, 2018 08:05
Copy link
Contributor

Choose a reason for hiding this comment

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

leading / missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed!

@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from 9d8f70a to 1bf1635 Compare May 14, 2018 08:37
@practicalswift practicalswift changed the title Allow for easy include analysis by enforcing the developer guide's include syntax preference Simplify include analysis by enforcing the developer guide's include syntax May 14, 2018
@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from 1bf1635 to 1187503 Compare May 15, 2018 15:11
Copy link
Member

Choose a reason for hiding this comment

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

Including a cpp file seems extremely wrong. (I know this is not your fault, just leaving a note)

Copy link
Contributor

Choose a reason for hiding this comment

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

@sipa
Copy link
Member

sipa commented May 19, 2018

The developer guidelines say to use the #include <...> form when possible. It's not clear to me when it wouldn't be possible.

If it's always possible, ACK on enforcing it.

@promag
Copy link
Contributor

promag commented May 20, 2018

☝️then update developer notes?

@practicalswift
Copy link
Contributor Author

@sipa @promag Good point! Updated the developer guidelines :-)

@maflcko
Copy link
Member

maflcko commented May 29, 2018

Needs rebase

@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from 5441186 to 04016bf Compare May 29, 2018 21:52
@practicalswift
Copy link
Contributor Author

Thanks @MarcoFalke. Rebased!

@Empact
Copy link
Contributor

Empact commented Jun 1, 2018

utACK 04016bf could squash

@maflcko
Copy link
Member

maflcko commented Jun 2, 2018

utACK 04016bf0b78aed2a6c39dfa284478b39192e2ec2

@practicalswift
Copy link
Contributor Author

Rebased! Please re-review :-)

Copy link
Contributor

@ken2812221 ken2812221 Jun 5, 2018

Choose a reason for hiding this comment

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

Why not use *.cpp and *.h? Isn't it compatible with other git versions?

Copy link
Contributor Author

@practicalswift practicalswift Jun 5, 2018

Choose a reason for hiding this comment

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

Yes, you're right that -- "*.cpp" "*.h" would be equivalent in this specific case (since we're only matching in src/), but my suggestions is that we keep this PR as is since it already has two utACK:s that would need re-reviewing in case of a change. Makes sense? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed when rebasing :-)

@maflcko
Copy link
Member

maflcko commented Jun 5, 2018

utACK 186b0101854824bb2bed55a7674aa5d6979d9f66

@ken2812221
Copy link
Contributor

utACK 186b010

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't compile locally here. Should be #include <bench/bench.h>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@maflcko
Copy link
Member

maflcko commented Jun 5, 2018

Needs rebase

@practicalswift
Copy link
Contributor Author

Rebased! Please re-review :-)

@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from a3ddab8 to 655d432 Compare June 6, 2018 05:57
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In what way? :-)

Copy link
Contributor

@ken2812221 ken2812221 Jun 6, 2018

Choose a reason for hiding this comment

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

It includes blockchain.h previously, but you include blockchain.cpp. Might because of #13288 merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ouch, now fixed! Thanks for catching this. I missed the .cpp extension!

@practicalswift practicalswift force-pushed the bracket-syntax-includes branch from 655d432 to 16e3cd3 Compare June 6, 2018 09:09
Copy link
Contributor

@ken2812221 ken2812221 left a comment

Choose a reason for hiding this comment

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

utACK 16e3cd3

@Empact
Copy link
Contributor

Empact commented Jun 7, 2018

re-utACK 16e3cd3

@promag
Copy link
Contributor

promag commented Jun 7, 2018

utACK 16e3cd3.

@maflcko
Copy link
Member

maflcko commented Jun 7, 2018

utACK 16e3cd3

@laanwj laanwj merged commit 16e3cd3 into bitcoin:master Jun 11, 2018
laanwj added a commit that referenced this pull request Jun 11, 2018
…ide's include syntax

16e3cd3 Clarify include recommendation (practicalswift)
6d10f43 Enforce the use of bracket syntax includes ("#include <foo.h>") (practicalswift)
906bee8 Use bracket syntax includes ("#include <foo.h>") (practicalswift)

Pull request description:

  When analysing includes in the project it is often assumed that the preferred bracket include syntax (`#include <foo.h>`) mentioned in `developer-docs.md` is used consistently. @sipa:s excellent circular dependencies script [`circular-dependencies.py`](https://github.com/sipa/bitcoin/blob/50c69b78011c1bc55885ebfd216db60ed490ebea/contrib/devtools/circular-dependencies.py) (#13228) is an example of a script making this reasonable assumption.

  This PR enables automatic Travis checking of the include syntax making sure that the bracket syntax includes (`#include <foo.h>`) is used consistently.

Tree-SHA512: a414921aabe8e487ebed42f3f1cbd02fecd1add385065c1f2244cd602c31889e61fea5a801507ec501ef9bd309b05d3c999f915cec1c2b44f085bb0d2835c182
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 2, 2020
…oper guide's include syntax

16e3cd3 Clarify include recommendation (practicalswift)
6d10f43 Enforce the use of bracket syntax includes ("#include <foo.h>") (practicalswift)
906bee8 Use bracket syntax includes ("#include <foo.h>") (practicalswift)

Pull request description:

  When analysing includes in the project it is often assumed that the preferred bracket include syntax (`#include <foo.h>`) mentioned in `developer-docs.md` is used consistently. @sipa:s excellent circular dependencies script [`circular-dependencies.py`](https://github.com/sipa/bitcoin/blob/50c69b78011c1bc55885ebfd216db60ed490ebea/contrib/devtools/circular-dependencies.py) (bitcoin#13228) is an example of a script making this reasonable assumption.

  This PR enables automatic Travis checking of the include syntax making sure that the bracket syntax includes (`#include <foo.h>`) is used consistently.

Tree-SHA512: a414921aabe8e487ebed42f3f1cbd02fecd1add385065c1f2244cd602c31889e61fea5a801507ec501ef9bd309b05d3c999f915cec1c2b44f085bb0d2835c182
Signed-off-by: pasta <[email protected]>
@practicalswift practicalswift deleted the bracket-syntax-includes branch April 10, 2021 19:34
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Feb 9, 2022
ad5717d Lint: Add lint-includes.sh (Fuzzbawls)
faba3f6 [tests] Use FastRandomContext in scheduler_tests.cpp (practicalswift)
2034bf6 Remove unused boost includes in reverselock_tests.cpp (Fuzzbawls)
3256d16 bench: Use non-throwing ParseDouble() (Fuzzbawls)
3c984d1 Remove duplicate includes (Fuzzbawls)
b54e396 Declare TorReply parsing functions in torcontrol_tests (Fuzzbawls)

Pull request description:

  This brings in the `lint-includes.sh` shell script from upstream (first introduced in bitcoin#11878) to automatically check for duplicate includes and expanded in bitcoin#13301 and bitcoin#13385 to check for the inclusion of `.cpp` files and the introduction of new boost includes, respectively.

  The check for enforcing bracket include syntax (bitcoin#13230) is also included, but currently disabled, as we have yet to systematically switch to that syntax preference.

  Three other upstream PRs are backported here as they are directly related to the removal of some boost dependencies and are very straight forward:
  - bitcoin#10547
  - bitcoin#13291
  - bitcoin#13383

  **NOTE: #2711 removes the dependency on `boost/tuple/tuple.hpp`, so it makes sense to merge that first. submitting this now so the general concept/functionality can be reviewed prior to that PR being merged**

ACKs for top commit:
  furszy:
    good ACK ad5717d
  random-zebra:
    utACK ad5717d and merging...

Tree-SHA512: d9d32d6d5122dac52c9601cda75612d87c4e027c6f196a2382206b227fcfd2bb61d4f72df7cbf5e572d94150ad8ca6db6301bd99b0da647b9627fe342b66873f
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 21, 2022
…oper guide's include syntax

16e3cd3 Clarify include recommendation (practicalswift)
6d10f43 Enforce the use of bracket syntax includes ("#include <foo.h>") (practicalswift)
906bee8 Use bracket syntax includes ("#include <foo.h>") (practicalswift)

Pull request description:

  When analysing includes in the project it is often assumed that the preferred bracket include syntax (`#include <foo.h>`) mentioned in `developer-docs.md` is used consistently. @sipa:s excellent circular dependencies script [`circular-dependencies.py`](https://github.com/sipa/bitcoin/blob/50c69b78011c1bc55885ebfd216db60ed490ebea/contrib/devtools/circular-dependencies.py) (bitcoin#13228) is an example of a script making this reasonable assumption.

  This PR enables automatic Travis checking of the include syntax making sure that the bracket syntax includes (`#include <foo.h>`) is used consistently.

Tree-SHA512: a414921aabe8e487ebed42f3f1cbd02fecd1add385065c1f2244cd602c31889e61fea5a801507ec501ef9bd309b05d3c999f915cec1c2b44f085bb0d2835c182
Signed-off-by: pasta <[email protected]>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants