travis-ci: set right flags in release testing jobs
It is important to have testing jobs that build the project with both -Werror and -O2 to keep the code clean. -O2 is needed, because some compiler warnings are available only after extra analyzing passes that are disabled with lesser optimization levels. The first attempt to add -Werror for release testing jobs was made in da505ee7 ('Add -Werror for CI (1.10 part)'), but it mistakely doesn't enable -O2 for RelWithDebInfoWError build. It is possible to fix it in this way: | --- a/cmake/compiler.cmake | +++ b/cmake/compiler.cmake | @@ -113,10 +113,14 @@ set (CMAKE_C_FLAGS_DEBUG | "${CMAKE_C_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0") | set (CMAKE_C_FLAGS_RELWITHDEBINFO | "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2") | +set (CMAKE_C_FLAGS_RELWITHDEBINFOWERROR | + "${CMAKE_C_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2") | set (CMAKE_CXX_FLAGS_DEBUG | "${CMAKE_CXX_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0") | set (CMAKE_CXX_FLAGS_RELWITHDEBINFO | "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2") | +set (CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR | + "${CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2") | | unset(CC_DEBUG_OPT) However I think that a build type (and so `tarantool --version`) should not show whether -Werror was passed or not. So I have added ENABLE_WERROR CMake option for that. It can be set like so: | cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON Enabled the option in testing Travis-CI jobs with the RelWithDebInfo build type. Deploy jobs don't include it as before. Fixed all -Wmaybe-uninitialized and -Wunused-result warnings. A few notes about the fixes: * net.box does not validate received data in general, so I don't add a check for autoincrement IDs too. Set the ID to INT64_MIN, because this value is less probably will appear here in a normal case and so is the best one to signal a user that something probably going wrongly. * xrow_decode_*() functions could read uninitialized data from row->body[0].iov_base in xrow_on_decode_err() when printing a hex code for a row. It could be possible when the received msgpack was empty (row->bodycnt == 0), but there were expected keys (key_map != 0). * getcwd() is marked with __attribute__((__warn_unused_result__)) in glibc, but the buffer filled by this call is not used anywhere and so just removed. * Vinyl -Wmaybe-uninitialized warnings are false positive ones. Added comments and quotes into .travis.yml to ease reading. Removed "test" word from the CentOS 6 job name, because we don't run tests on this distro (disabled in the RPM spec). Fixes #4178.
Showing
- .travis.mk 2 additions, 2 deletions.travis.mk
- .travis.yml 24 additions, 21 deletions.travis.yml
- cmake/compiler.cmake 11 additions, 5 deletionscmake/compiler.cmake
- src/box/lua/net_box.c 1 addition, 1 deletionsrc/box/lua/net_box.c
- src/box/sql/func.c 8 additions, 8 deletionssrc/box/sql/func.c
- src/box/vy_cache.c 1 addition, 1 deletionsrc/box/vy_cache.c
- src/box/vy_mem.c 1 addition, 1 deletionsrc/box/vy_mem.c
- src/box/xrow.c 19 additions, 11 deletionssrc/box/xrow.c
- src/lua/init.c 0 additions, 2 deletionssrc/lua/init.c
Loading
Please register or sign in to comment