From e6e3cc474dc64d64ff12dce81e28278486704fe9 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Jun 2018 19:41:46 -0400 Subject: [PATCH 1/7] Fix UTF-8 characters with an even number of bytes. --- src/asm/charmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/asm/charmap.c b/src/asm/charmap.c index 4d7214a9..95a592a9 100644 --- a/src/asm/charmap.c +++ b/src/asm/charmap.c @@ -32,12 +32,10 @@ int32_t readUTF8Char(char *dest, char *src) dest[i] = src[i]; - i++; if (state == 0) { - dest[i] = '\0'; + dest[++i] = '\0'; return i; } - dest[i] = src[i]; } } From 57bf220e406796d329fb1ed4bcd6e66098c674e5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Jun 2018 20:07:23 -0400 Subject: [PATCH 2/7] Fix formatting of utf8d table. --- src/extern/utf8decoder.c | 53 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/extern/utf8decoder.c b/src/extern/utf8decoder.c index 86277109..56c44cf2 100644 --- a/src/extern/utf8decoder.c +++ b/src/extern/utf8decoder.c @@ -11,34 +11,31 @@ #include static const uint8_t utf8d[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00..0f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10..1f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20..2f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30..3f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40..4f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50..5f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60..6f */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8, 8, 8, 8, 8, 8, 8, 8, /* f0..ff */ + 0, 1, 2, 3, 5, 8, 7, 1, 1, 1, 4, 6, 1, 1, 1, 1, /* s0 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* s1 */ + 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, /* s1 */ + 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, /* s3 */ + 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, /* s4 */ + 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, /* s5 */ + 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, /* s6 */ + 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, /* s7 */ + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* s8 */ }; uint32_t decode(uint32_t *state, uint32_t *codep, uint32_t byte) From a567365d7c1766773867710d1142abc3d5794d68 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Jun 2018 21:57:34 -0400 Subject: [PATCH 3/7] =?UTF-8?q?unit=20test=20for=20`db=20"=C3=A9"`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/asm/utf-8.asm | 2 ++ test/asm/utf-8.out | 0 2 files changed, 2 insertions(+) create mode 100644 test/asm/utf-8.asm create mode 100644 test/asm/utf-8.out diff --git a/test/asm/utf-8.asm b/test/asm/utf-8.asm new file mode 100644 index 00000000..7758bb8f --- /dev/null +++ b/test/asm/utf-8.asm @@ -0,0 +1,2 @@ +SECTION "sec", ROM0 + db "é" diff --git a/test/asm/utf-8.out b/test/asm/utf-8.out new file mode 100644 index 00000000..e69de29b From 64158cf513b878f2d916ba265c75bc85d5a13186 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Jun 2018 21:58:05 -0400 Subject: [PATCH 4/7] Run checkpatch in a separate build. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 293e030c..4607e17b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,9 @@ compiler: - clang - gcc script: - - ./.travis-checkpatch.sh - - cd test - - ./run-tests.sh + - cd test && ./run-tests.sh +matrix: + include: + - env: _="checkpatch" + script: + - ./.travis-checkpatch.sh From 587159448aa226ecc7039f4a91fe652b38c42281 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Jun 2018 23:26:48 -0400 Subject: [PATCH 5/7] Test binary output for rgbasm tests --- test/asm/test.sh | 18 +++++++++++++++--- test/asm/utf-8.out.bin | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 test/asm/utf-8.out.bin diff --git a/test/asm/test.sh b/test/asm/test.sh index 5d85142f..0cbc38ea 100755 --- a/test/asm/test.sh +++ b/test/asm/test.sh @@ -1,11 +1,23 @@ #!/bin/sh -fname=$(mktemp) +o=$(mktemp) +gb=$(mktemp) +before=$(mktemp) +after=$(mktemp) rc=0 for i in *.asm; do - ../../rgbasm $i >$fname 2>&1 - diff -u $fname ${i%.asm}.out + ../../rgbasm -o $o $i > $after 2>&1 + diff -u ${i%.asm}.out $after rc=$(($? || $rc)) + bin=${i%.asm}.out.bin + if [ -f $bin ]; then + ../../rgblink -o $gb $o > $after 2>&1 + head -c $(wc -c < $bin) $gb > $after 2>&1 + hexdump -C $after > $before && mv $before $after + hexdump -C $bin > $before + diff -u $before $after + rc=$(($? || $rc)) + fi done exit $rc diff --git a/test/asm/utf-8.out.bin b/test/asm/utf-8.out.bin new file mode 100644 index 00000000..4b04fff5 --- /dev/null +++ b/test/asm/utf-8.out.bin @@ -0,0 +1 @@ +é \ No newline at end of file From 5e9c433a24882eed2532a735eb5502623a6d820c Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 1 Jul 2018 00:05:11 -0400 Subject: [PATCH 6/7] checkpatch: Don't expect Signed-off-by lines in commit messages --- .checkpatch.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.checkpatch.conf b/.checkpatch.conf index e9a2c35f..1ffa80de 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -19,6 +19,9 @@ # 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 # --------------------- From 361015497c1284f00dcdacb3d962c620cbfc0cab Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 2 Jul 2018 16:04:53 -0400 Subject: [PATCH 7/7] Remove signoff step from contributing guide. --- CONTRIBUTING.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 64ee0661..f9c3d168 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -75,24 +75,22 @@ 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. Sign off your commits: ``git commit -s`` - -6. Follow the Linux kernel coding style, which can be found in the file +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 writen on stone, if there is a good reason to deviate from it, it should be fine. -7. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and +6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and ``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository. -8. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check +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: ``CHECKPATCH=../path/to/folder make checkpatch``. -9. Create a pull request against the branch ``develop``. +8. Create a pull request against the branch ``develop``. -10. Be prepared to get some comments about your code and to modify it. Tip: Use +9. Be prepared to get some comments about your code and to modify it. Tip: Use ``git rebase -i origin/develop`` to modify chains of commits.