Skip to content

Commit 304ff96

Browse files
committed
Comment the intentional fallthrough to default from _fixed_trail_again
GCC 7 added a new diagnostic, -Wimplicit-fallthrough, which is enabled with -Wextra that warns about implicitly falling through a case statement. [ 4%] Building C object CMakeFiles/msgpackc-static.dir/src/unpack.c.o /usr/lib/gcc-snapshot/bin/gcc -I/home/jamessan/src/msgpack-c/. -I/home/jamessan/src/msgpack-c/include -I/home/jamessan/src/msgpack-c/build/include -g -O2 -fdebug-prefix-map=/home/jamessan/src/msgpack-c=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror -g -O3 -o CMakeFiles/msgpackc-static.dir/src/unpack.c.o -c /home/jamessan/src/msgpack-c/src/unpack.c In file included from /home/jamessan/src/msgpack-c/src/unpack.c:283:0: /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h: In function 'template_execute': /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:238:17: error: this statement may fall through [-Werror=implicit-fallthrough=] ++p; ^~~ /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:240:13: note: here default: ^~~~~~~ cc1: all warnings being treated as errors Adding the comment makes it explicit that the fallthrough is intentional, so gcc doesn't complain.
1 parent 10c1917 commit 304ff96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/msgpack/unpack_template.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
236236

237237
_fixed_trail_again:
238238
++p;
239+
// fallthrough
239240

240241
default:
241242
if((size_t)(pe - p) < trail) { goto _out; }

0 commit comments

Comments
 (0)