diff --git a/.checkpatch.conf b/.checkpatch.conf deleted file mode 100644 index ad1ca3ff9..000000000 --- a/.checkpatch.conf +++ /dev/null @@ -1,88 +0,0 @@ -# Configuration for checkpatch.pl -# =============================== - -# Enable more tests ---strict - -# Quiet ---quiet - -# No per-file summary ---no-summary - -# Don't expect the Linux kernel tree ---no-tree - -# Show file line, not input line ---showfile - -# Don't expect SPDX tag in the first line of a file ---ignore SPDX_LICENSE_TAG - -# Don't expect Signed-off-by lines in commit messages ---no-signoff - -# List of ignored rules -# --------------------- - -# There's no BIT macro ---ignore BIT_MACRO - -# Don't complain when bools are used in structs ---ignore BOOL_MEMBER - -# Allow CamelCase ---ignore CAMELCASE - -# Comparing to NULL explicitly isn't a bad thing ---ignore COMPARISON_TO_NULL - -# Causes false positives ---ignore COMPLEX_MACRO - -# Don't complain about structs not being const ---ignore CONST_STRUCT - -# Don't complain about printing "warning:" without the function name, as warning -# printing is relevant to the code being parsed, not RGBDS' code ---ignore EMBEDDED_FUNCTION_NAME - -# Do not check the format of commit messages ---ignore GIT_COMMIT_ID - -# Do not check for global initializers (this is specific to the kernel) ---ignore GLOBAL_INITIALISERS - -# Don't complain about initializing statics (this is specific to the kernel) ---ignore INITIALISED_STATIC - -# We don't have a MAINTAINERS file, don't complain about it. ---ignore FILE_PATH_CHANGES - -# Writing the continuation on the start of the line can make it clearer ---ignore LOGICAL_CONTINUATIONS - -# Don't complain if a line that contains a string is too long. It's better to -# have a really long line that can be found with grep. ---ignore LONG_LINE_STRING - -# Don't complain when files are modified in 'include/asm' ---ignore MODIFIED_INCLUDE_ASM - -# Allow new typedefs ---ignore NEW_TYPEDEFS - -# We allow lines ending with parentheses for the usage prints ---ignore OPEN_ENDED_LINE - -# Prefer stdint.h types over kernel types ---ignore PREFER_KERNEL_TYPES - -# Don't ask to replace sscanf by kstrto ---ignore SSCANF_TO_KSTRTO - -# Parentheses can make the code clearer ---ignore UNNECESSARY_PARENTHESES - -# We don't have `fallthrough;` */ ---ignore PREFER_FALLTHROUGH diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml deleted file mode 100644 index 7a6f9ce92..000000000 --- a/.github/workflows/checkpatch.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Code style checking" -on: pull_request - -jobs: - checkpatch: - runs-on: ubuntu-latest - steps: - - name: Set up repo - run: | - git clone -b "${{ github.event.pull_request.head.ref }}" "${{ github.event.pull_request.head.repo.clone_url }}" rgbds - cd rgbds - git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}" - git fetch upstream - - name: Set up checkpatch - working-directory: rgbds - run: | - wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl' - chmod +x checkpatch.pl - wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/const_structs.checkpatch' - wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt' - - name: Checkpatch - working-directory: rgbds - run: | - make checkpatch CHECKPATCH=./checkpatch.pl "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log - if grep -q ERROR: log; then exit 1; else exit 0; fi diff --git a/.gitignore b/.gitignore index 2d485013f..bcaf97e1a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ *.gcno *.gcda *.gcov -.checkpatch-camelcase.* CMakeCache.txt CMakeFiles/ cmake_install.cmake diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6b4992fce..43d1cc10c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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. diff --git a/Makefile b/Makefile index 8da2fb912..3159aeb81 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -15,7 +14,6 @@ mandir := ${PREFIX}/share/man STRIP := -s BINMODE := 755 MANMODE := 644 -CHECKPATCH := ../linux/scripts/checkpatch.pl # Other variables @@ -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: diff --git a/src/link/patch.cpp b/src/link/patch.cpp index a0525825b..7627210f2 100644 --- a/src/link/patch.cpp +++ b/src/link/patch.cpp @@ -472,8 +472,6 @@ 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 case ASSERT_ERROR: error(assert->patch.src, assert->patch.lineNo, "%s", assert->message[0] ? assert->message