diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-05 20:12:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-05 20:12:28 -0700 |
commit | 49d82c3b34227ec0520eb1cf1bb22083453b49a7 (patch) | |
tree | 96e32c168fcd37be665cdbcb8bfb380d87ff08c2 /utf8.c | |
parent | 998a47a585ae540f0f3229dcd68b3d04ac657c36 (diff) | |
download | txr-49d82c3b34227ec0520eb1cf1bb22083453b49a7.tar.gz txr-49d82c3b34227ec0520eb1cf1bb22083453b49a7.tar.bz2 txr-49d82c3b34227ec0520eb1cf1bb22083453b49a7.zip |
warning cleanup: suspicious switch fallthrough cases.
This is the seventh round of an effort to enable GCC's -Wextra
option. Warnings about switch fallthrough situations are
addressed. GCC now has a diagnostic for this that is enabled
by -Wextra in such a way that if a fallthrough comment is
present, the diagnostic is suppressed. In much of the code,
we have such a comment. It's missing in a few places, or
misplaced. There are also some real bugs.
* hash.c (hash_buf): Add fallthrough comments to intentional
fallthrough cases.
(hash_hash_op): bugfix: add break statement. The 32 and 64
bit cases are independent (at compile time).
* lib.c (cdr, nullify, list_collect, empty): Add fallthrough
comment.
(int_str): Add missing break. This has not caused a
bug though because setting the octzero flag in the zerox
case is harmless to the logic which follows.
* linenoise.c (edit): Move misplaced fallthrough.
* sysif.c (fcntl_wrap): Bugfix: add missing break, without
which errno is tampered to hold EINVAL, in spite of a
successful F_SETLK, F_SETLKW or F_GETLK operation.
* unwind.h (jmp_restore): Declare noreturn, so that GCC
does not issue a false positive warning about a fallthrough
in uw_unwind_to_exit_point.
* utf8.c (utf8_from_buf, utf8_decode): Move a fallthrough
comment outside of preprocessing, so it is properly processed
by GCC's diagnostic.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -90,10 +90,10 @@ size_t utf8_from_buf(wchar_t *wdst, const unsigned char *src, size_t nbytes) wch_min = 0x10000; break; } - /* fallthrough */ #else conversion_error(); #endif + /* fallthrough */ default: if (wdst) *wdst++ = 0xDC00 | ch; @@ -321,10 +321,10 @@ wint_t utf8_decode(utf8_decoder_t *ud, int (*get)(mem_t *ctx), mem_t *ctx) ud->wch_min = 0x10000; break; } - /* fallthrough */ #else conversion_error(); #endif + /* fallthrough */ default: ud->back = ud->tail; return 0xDC00 | ch; |