When I execute cmake `-DMSGPACK_CXX11=OFF`, gcc 7.1 reports the warning.
I've already added the warning suppression pragma, but it doesn't work
in this case. So I added explicit initializing code even if it is redundant.
The appveyor pre-installed software is only compiled with the default
compiler and couldn't be used with other compiler versions.
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
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.
Add support for CMake find_package command to msgpack. The package
exports the two targets msgpackc-static and msgpackc if shared is
enabled. The CMake find_package command works after installation
of msgpack and during build of another project which adds msgpack
as sub project via add_subdirectory command.
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>