From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B47BC2BAE6 for ; Fri, 21 Sep 2018 12:41:40 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Yi25fHs2cDk for ; Fri, 21 Sep 2018 12:41:40 -0400 (EDT) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 24C4A2BACB for ; Fri, 21 Sep 2018 12:41:40 -0400 (EDT) From: Alexander Turenko Subject: [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part) Date: Fri, 21 Sep 2018 19:41:35 +0300 Message-Id: <0713b50dce1fc8a955bbc2e625a6269fbb21b6a1.1537547498.git.alexander.turenko@tarantool.org> In-Reply-To: <20180921123529.brpmozsogtdv53p2@tkn_work_nb> References: <20180921123529.brpmozsogtdv53p2@tkn_work_nb> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Kirill Yukhin Cc: Alexander Turenko , tarantool-patches@freelists.org Added MAKE_BUILD_TYPE=RelWithDebInfoWError option, which means enabling -DNDEBUG=1, -O2 and -Wall -Wextra -Werror. This ensures we have clean release build without warnings. Fixed found -Wunused-variable and -Wunused-parameter warnings. Part of #3238. --- branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3238-add-werror-for-ci-1.10 issue: https://github.com/tarantool/tarantool/issues/3238 Please, push it into 1.10 branch if the changes look good for you. Note: there is second part of the patchset (for 2.0 branch) with fixes for SQL code, I'll send it in reply to this message. .travis.mk | 4 ++-- cmake/compiler.cmake | 9 +++++---- src/box/xrow.c | 2 ++ src/trivia/util.h | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.mk b/.travis.mk index 23f804cde..88335474c 100644 --- a/.travis.mk +++ b/.travis.mk @@ -40,7 +40,7 @@ deps_ubuntu: lcov ruby test_ubuntu: deps_ubuntu - cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfoWError make -j8 cd test && /usr/bin/python test-run.py -j 1 @@ -49,7 +49,7 @@ deps_osx: brew install openssl readline curl icu4c --force test_osx: deps_osx - cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfoWError # Increase the maximum number of open file descriptors on macOS sudo sysctl -w kern.maxfiles=20480 || : sudo sysctl -w kern.maxfilesperproc=20480 || : diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index f4bacca30..4062d13ec 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -286,10 +286,11 @@ macro(enable_tnt_compile_flags) add_definitions("-D__STDC_LIMIT_MACROS=1") add_definitions("-D__STDC_CONSTANT_MACROS=1") - # Only add -Werror if it's a debug build, done by developers. - # Release builds should not cause extra trouble. - if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") - AND HAVE_STD_C11 AND HAVE_STD_CXX11) + # Only add -Werror if it's a Debug or RelWithDebInfoWError build, done by + # developers. Release builds should not cause extra trouble. + if (((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR + (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfoWError")) AND + HAVE_STD_C11 AND HAVE_STD_CXX11) add_compile_flags("C;CXX" "-Werror") endif() endmacro(enable_tnt_compile_flags) diff --git a/src/box/xrow.c b/src/box/xrow.c index 7a35d0db1..881ce53fc 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -335,6 +335,7 @@ iproto_reply_vclock(struct obuf *out, const struct vclock *vclock, size - IPROTO_HEADER_LEN); char *ptr = obuf_alloc(out, size); + (void) ptr; assert(ptr == buf); return 0; } @@ -373,6 +374,7 @@ iproto_reply_vote(struct obuf *out, const struct ballot *ballot, size - IPROTO_HEADER_LEN); char *ptr = obuf_alloc(out, size); + (void) ptr; assert(ptr == buf); return 0; } diff --git a/src/trivia/util.h b/src/trivia/util.h index fce73a27a..78281c1d1 100644 --- a/src/trivia/util.h +++ b/src/trivia/util.h @@ -49,7 +49,7 @@ extern "C" { #ifndef NDEBUG #define TRASH(ptr) memset(ptr, '#', sizeof(*ptr)) #else -#define TRASH(ptr) +#define TRASH(ptr) (void) (ptr) #endif #ifndef MAX -- 2.19.0