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

Remove checkpatch, since it's tuned for C not C++ #1250

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions .checkpatch.conf

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/checkpatch.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*.gcno
*.gcda
*.gcov
.checkpatch-camelcase.*
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
20 changes: 4 additions & 16 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,10 @@ copyright and the reference to the MIT License.
new warning (but it may be possible to remove some warning checks if it makes
the code much easier).

5. Follow the Linux kernel coding style, which can be found in the file
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
Note that the coding style isn't written in stone, if there is a good reason
to deviate from it, it should be fine.
5. Format your changes according to ``clang-format``, which will reformat the
coding style according to our standards defined in ``.clang-format``.

6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
6. Create a pull request against the branch ``master``.

7. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
the coding style of all patches between the current one and the upstream
code. By default, the Makefile expects the script (and associate files) to be
located in ``../linux/scripts/``, but you can place them anywhere you like as
long as you specify it when executing the command:
``make checkpatch CHECKPATCH=../path/to/folder``.

8. Create a pull request against the branch ``master``.

9. Be prepared to get some comments about your code and to modify it. Tip: Use
7. Be prepared to get some comments about your code and to modify it. Tip: Use
``git rebase -i origin/master`` to modify chains of commits.
28 changes: 1 addition & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
.SUFFIXES:
.SUFFIXES: .cpp .y .o

.PHONY: all clean install checkcodebase checkpatch checkdiff \
develop debug coverage mingw32 mingw64 wine-shim dist
.PHONY: all clean install checkdiff develop debug coverage mingw32 mingw64 wine-shim dist

# User-defined variables

Expand All @@ -15,7 +14,6 @@ mandir := ${PREFIX}/share/man
STRIP := -s
BINMODE := 755
MANMODE := 644
CHECKPATCH := ../linux/scripts/checkpatch.pl

# Other variables

Expand Down Expand Up @@ -197,30 +195,6 @@ install: all
$Qinstall -m ${MANMODE} man/rgbds.5 man/rgbasm.5 man/rgblink.5 ${DESTDIR}${mandir}/man5/
$Qinstall -m ${MANMODE} man/rgbds.7 man/gbz80.7 ${DESTDIR}${mandir}/man7/

# Target used to check the coding style of the whole codebase.
# `extern/` is excluded, as it contains external code that should not be patched
# to meet our coding style, so applying upstream patches is easier.
# `.y` files aren't checked, unfortunately...

checkcodebase:
$Qfor file in `git ls-files | grep -E '(\.cpp|\.hpp)$$' | grep -Ev '(src|include)/extern/'`; do \
${CHECKPATCH} -f "$$file"; \
done

# Target used to check the coding style of the patches from the upstream branch
# to the HEAD. Runs checkpatch once for each commit between the current HEAD and
# the first common commit between the HEAD and origin/master.
# `.y` files aren't checked, unfortunately...

checkpatch:
$QCOMMON_COMMIT=`git merge-base HEAD ${BASE_REF}`; \
for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \
echo "[*] Analyzing commit '$$commit'"; \
git format-patch --stdout "$$commit~..$$commit" \
-- src include '!src/extern' '!include/extern' \
| ${CHECKPATCH} - || true; \
done

# Target used to check for suspiciously missing changed files.

checkdiff:
Expand Down
3 changes: 1 addition & 2 deletions src/link/patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ void patch_CheckAssertions(struct Assertion *assert)
fatal(assert->patch.src, assert->patch.lineNo, "%s",
assert->message[0] ? assert->message
: "assert failure");
// Not reached
break; // Here so checkpatch doesn't complain
unreachable_();
Rangi42 marked this conversation as resolved.
Show resolved Hide resolved
case ASSERT_ERROR:
error(assert->patch.src, assert->patch.lineNo, "%s",
assert->message[0] ? assert->message
Expand Down