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

Prep-work for clang-format excluding \rst-related issues. #3087

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 9, 2021

Prep-work to establish a clean base for clang-format or clang-format-diff (see experimental/demo PR #3074).

NO bulk changes in this PR, just minimal changes such that a global clang-format is stable after a single pass.

The demo PR #3074 has two automatic changes applied on top of this PR:

  • Automatic insertion of // clang-format off, on pairs around \rst, \endrst comment blocks.
  • Bulk global clang-format via pre-commit.
    This is to prove that this prep work is the clean base we need.

This prep work was several hours of tedious work running clang-format & clang-tidy until both are stable. Breaking out as a separate PR so that these manual changes do not have to be maintained separately while we decide how to integrate clang-format or clang-format-diff into our GitHub Actions.

Notable steps:

  • Removing stray semicolons (discovered by running clang-format v12 followed by tools/check-style.sh).

  • Manually moving clang-tidy // NOLINT comments so that clang-format does not move them to the wrong places.

  • Manually reformatting comments related to static_asserts so that clang-format does not need two passes.

  • git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i

Suggested changelog entry:

Prep-work to establish a clean base for clang-format or clang-format-diff.

tests/test_stl.cpp Outdated Show resolved Hide resolved
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jul 12, 2021
@rwgk rwgk mentioned this pull request Jul 12, 2021
rwgk pushed a commit that referenced this pull request Jul 12, 2021
* Copying from prework_no_rst branch (PR #3087): test_numpy_array.cpp, test_stl.cpp

* Manual changes reducing NOLINTs.

* clang-format-diff.py

* Minor adjustment to avoid MSVC warning C4702: unreachable code
@rwgk rwgk marked this pull request as draft July 12, 2021 21:16
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 12, 2021

This PR has a lot of merge conflicts now. I need to take care of some other things first but will come back here asap.

…ollowed by tools/check-style.sh).

* Manually moving `// NOLINT` comments so that clang-format does not move them to the wrong places.

* Manually reformatting comments related to `static_assert`s so that clang-format does not need two passes.

* Empty lines between #includes, to prevent clang-format from shuffling the order and thereby confusing MSVC 2015.

* git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
@rwgk rwgk force-pushed the prework_no_rst branch from e90a959 to 5fc06b3 Compare July 13, 2021 20:14
@rwgk rwgk marked this pull request as ready for review July 13, 2021 23:06
@rwgk rwgk requested a review from henryiii July 13, 2021 23:06
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 13, 2021

For future reference, here are a couple interesting links I found when searching for information about clang-format & \rst:

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 14, 2021

Thanks Aaron and Henry!

@rwgk rwgk merged commit aca6c3b into pybind:master Jul 14, 2021
@rwgk rwgk deleted the prework_no_rst branch July 14, 2021 01:15
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 14, 2021
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jul 15, 2021
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Aug 30, 2021
…he comment and empty line that was added in PR pybind#3087; those were made obsolete by the pragma cleanup that concluded with PR pybind#3186.
@rwgk rwgk mentioned this pull request Aug 31, 2021
rwgk pushed a commit that referenced this pull request Aug 31, 2021
* Minor tweaks.

* Restoring tests/pybind11_tests.h version from master, removing just the comment and empty line that was added in PR #3087; those were made obsolete by the pragma cleanup that concluded with PR #3186.

* [ci skip] Restoring tests/test_enum.py from master.
rwgk pushed a commit that referenced this pull request Aug 31, 2021
…nt when underlying type is bool or of char type) (#3232)

* Minor tweaks.

* Restoring tests/pybind11_tests.h version from master, removing just the comment and empty line that was added in PR #3087; those were made obsolete by the pragma cleanup that concluded with PR #3186.

* More-to-the-point test for Python 3.
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.

3 participants