Some of the existing syntax-check rules have apparently not been exercised in a long time. This patch fixes one of them.
2025-05-07 Bruno Haible <br...@clisp.org> Fix "make sc_prohibit_leading_TABs" failures. * Makefile (exclude_file_name_regexp--sc_prohibit_leading_TABs): New variable. (sc_prohibit_leading_TABs): Use it. * lib/crc-x86_64-pclmul.c: Untabify. * tests/test-crc.c: Untabify. * tests/test-parse-duration.sh: Remove leading tabs from here documents. diff --git a/Makefile b/Makefile index e0b7621df9..5fcc02510a 100644 --- a/Makefile +++ b/Makefile @@ -41,11 +41,13 @@ sc_prefer_ac_check_funcs_once: sc_prohibit_leading_TABs: @if test -d .git; then \ git grep -l '^ * ' lib m4 tests \ - | grep -Ev '^lib/reg|Makefile|test-update-copyright' \ + | grep -Ev '$(exclude_file_name_regexp--sc_prohibit_leading_TABs)' \ | grep . \ && { printf '*** %s\n' 'indent with spaces, not TABs;' \ 1>&2; exit 1; } || : \ else :; fi +exclude_file_name_regexp--sc_prohibit_leading_TABs = \ + ^(lib/(cdefs\.h|getopt|ieee754|malloc/|mini-|mktime\.c|qsort\.c|reg|strverscmp\.c)|m4/(largefile|std-gnu)|m4/libgcrypt|tests/from-glibc/|tests/test-update-copyright|Makefile|.*/Makefile) sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT: @if test -d .git; then \ diff --git a/lib/crc-x86_64-pclmul.c b/lib/crc-x86_64-pclmul.c index 1650843394..69d00a61c6 100644 --- a/lib/crc-x86_64-pclmul.c +++ b/lib/crc-x86_64-pclmul.c @@ -74,35 +74,35 @@ crc32_update_no_xor_pclmul (uint32_t crc, const void *buf, size_t len) in1 = _mm_xor_si128 (in1, xor_crc); while (bytes_remaining >= 128) - { - /* Load up second set of 512 bits */ - in5 = _mm_loadu_si128 (data + 4); - in6 = _mm_loadu_si128 (data + 5); - in7 = _mm_loadu_si128 (data + 6); - in8 = _mm_loadu_si128 (data + 7); - - /* We shift the high QWORD forward 544 bits and the - low QWORD 480 bits */ - fold_high = _mm_clmulepi64_si128 (in1, shift544_shift480, 0x11); - fold_low = _mm_clmulepi64_si128 (in1, shift544_shift480, 0x00); - in1 = _mm_xor_si128 (in5, fold_high); - in1 = _mm_xor_si128 (in1, fold_low); - fold_high = _mm_clmulepi64_si128 (in2, shift544_shift480, 0x11); - fold_low = _mm_clmulepi64_si128 (in2, shift544_shift480, 0x00); - in2 = _mm_xor_si128 (in6, fold_high); - in2 = _mm_xor_si128 (in2, fold_low); - fold_high = _mm_clmulepi64_si128 (in3, shift544_shift480, 0x11); - fold_low = _mm_clmulepi64_si128 (in3, shift544_shift480, 0x00); - in3 = _mm_xor_si128 (in7, fold_high); - in3 = _mm_xor_si128 (in3, fold_low); - fold_high = _mm_clmulepi64_si128 (in4, shift544_shift480, 0x11); - fold_low = _mm_clmulepi64_si128 (in4, shift544_shift480, 0x00); - in4 = _mm_xor_si128 (in8, fold_high); - in4 = _mm_xor_si128 (in4, fold_low); - - bytes_remaining -= 64; - data += 4; - } + { + /* Load up second set of 512 bits */ + in5 = _mm_loadu_si128 (data + 4); + in6 = _mm_loadu_si128 (data + 5); + in7 = _mm_loadu_si128 (data + 6); + in8 = _mm_loadu_si128 (data + 7); + + /* We shift the high QWORD forward 544 bits and the + low QWORD 480 bits */ + fold_high = _mm_clmulepi64_si128 (in1, shift544_shift480, 0x11); + fold_low = _mm_clmulepi64_si128 (in1, shift544_shift480, 0x00); + in1 = _mm_xor_si128 (in5, fold_high); + in1 = _mm_xor_si128 (in1, fold_low); + fold_high = _mm_clmulepi64_si128 (in2, shift544_shift480, 0x11); + fold_low = _mm_clmulepi64_si128 (in2, shift544_shift480, 0x00); + in2 = _mm_xor_si128 (in6, fold_high); + in2 = _mm_xor_si128 (in2, fold_low); + fold_high = _mm_clmulepi64_si128 (in3, shift544_shift480, 0x11); + fold_low = _mm_clmulepi64_si128 (in3, shift544_shift480, 0x00); + in3 = _mm_xor_si128 (in7, fold_high); + in3 = _mm_xor_si128 (in3, fold_low); + fold_high = _mm_clmulepi64_si128 (in4, shift544_shift480, 0x11); + fold_low = _mm_clmulepi64_si128 (in4, shift544_shift480, 0x00); + in4 = _mm_xor_si128 (in8, fold_high); + in4 = _mm_xor_si128 (in4, fold_low); + + bytes_remaining -= 64; + data += 4; + } _mm_storeu_si128 (final_buf, in1); _mm_storeu_si128 (final_buf + 1, in2); @@ -158,7 +158,7 @@ crc32_update_no_xor_pclmul (uint32_t crc, const void *buf, size_t len) /* Read in at an offset so we get the shift for free */ memcpy (((char *) in256) + (32 - bytes_remaining), datarw, - bytes_remaining); + bytes_remaining); in1 = _mm_loadu_si128 (in256); in2 = _mm_loadu_si128 (in256 + 1); diff --git a/tests/test-crc.c b/tests/test-crc.c index 3ae5da25c2..4a3f8f2721 100644 --- a/tests/test-crc.c +++ b/tests/test-crc.c @@ -105,11 +105,11 @@ main (void) { p = crc32_update_no_xor (0, randomb, MAX_ALIGNMENT + i); if (p != trailing_unaligned_byte_hashes[i]) - { - printf ("aligned c at %lu length %lu got %lx\n", (size_t) 0, - MAX_ALIGNMENT + i, (unsigned long) p); - return 1; - } + { + printf ("aligned c at %lu length %lu got %lx\n", (size_t) 0, + MAX_ALIGNMENT + i, (unsigned long) p); + return 1; + } } /* Test for leading unaligned bytes */ @@ -118,11 +118,11 @@ main (void) { p = crc32_update_no_xor (0, randomb + i, (MAX_ALIGNMENT * 2) - i); if (p != leading_unaligned_byte_hashes[i]) - { - printf ("aligned c at %lu length %lu got %lx\n", i, - (MAX_ALIGNMENT * 2) - i, (unsigned long) p); - return 1; - } + { + printf ("aligned c at %lu length %lu got %lx\n", i, + (MAX_ALIGNMENT * 2) - i, (unsigned long) p); + return 1; + } } /* Combined test of multiple lengths at multiple alignments */ @@ -130,14 +130,14 @@ main (void) for (i = 0; i < MAX_ALIGNMENT; i++) for (j = 0; j < MAX_ALIGNMENT; j++) { - memcpy (data + i, randomb, MAX_ALIGNMENT * 2); - p = crc32_update_no_xor (0, data + i, j); - if (p != variable_alignment_variable_length_hashes[j]) - { - printf ("aligned c at %lu length %lu got %lx\n", i, j, - (unsigned long) p); - return 1; - } + memcpy (data + i, randomb, MAX_ALIGNMENT * 2); + p = crc32_update_no_xor (0, data + i, j); + if (p != variable_alignment_variable_length_hashes[j]) + { + printf ("aligned c at %lu length %lu got %lx\n", i, j, + (unsigned long) p); + return 1; + } } diff --git a/tests/test-parse-duration.sh b/tests/test-parse-duration.sh index 5b4e01bb21..6188f771ac 100755 --- a/tests/test-parse-duration.sh +++ b/tests/test-parse-duration.sh @@ -48,15 +48,15 @@ trap 'rm -rf "${tmp}"' EXIT tmpf="${tmp}/tests.txt" # Tests where we expect success. -cat > "${tmpf}" <<- _EOF_ - 1 Y 2 M 3 W 4 d 5 h 6 m 7 s - P 00010225 T 05:06:07 - P 1Y2M3W4D T 5H6M7S - 1 Y 2 M 25 D 5:6:7 - 1 Y 2 M 25 d 5h 6:7 - 1 Y 2 M 25 d 5h 6m 7 - P 1-2-25 T 5:6:7 - _EOF_ +cat > "${tmpf}" <<_EOF_ +1 Y 2 M 3 W 4 d 5 h 6 m 7 s +P 00010225 T 05:06:07 +P 1Y2M3W4D T 5H6M7S +1 Y 2 M 25 D 5:6:7 +1 Y 2 M 25 d 5h 6:7 +1 Y 2 M 25 d 5h 6m 7 +P 1-2-25 T 5:6:7 +_EOF_ exec 3< "${tmpf}" while read line <&3 @@ -68,14 +68,14 @@ done exec 3>&- # Tests where we expect failure. -cat > "${tmpf}" <<- _EOF_ - T-00302 - T-0:3:2 - T-0 H 3 M 2 S - P+04 Y 03 M 02 D - P04 Y +03 M 02 D - P04 Y 03 M +02 D - _EOF_ +cat > "${tmpf}" <<_EOF_ +T-00302 +T-0:3:2 +T-0 H 3 M 2 S +P+04 Y 03 M 02 D +P04 Y +03 M 02 D +P04 Y 03 M +02 D +_EOF_ fail=0 exec 3< "${tmpf}"