Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part)
Date: Fri, 21 Sep 2018 19:41:35 +0300	[thread overview]
Message-ID: <0713b50dce1fc8a955bbc2e625a6269fbb21b6a1.1537547498.git.alexander.turenko@tarantool.org> (raw)
In-Reply-To: <20180921123529.brpmozsogtdv53p2@tkn_work_nb>

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

  reply	other threads:[~2018-09-21 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 17:08 [tarantool-patches] [PATCH v2] Fix warnings Gleb
2018-04-23 17:37 ` [tarantool-patches] " n.pettik
2018-04-26  6:38 ` Kirill Yukhin
2018-09-21 12:35   ` Alexander Turenko
2018-09-21 16:41     ` Alexander Turenko [this message]
2018-09-21 16:41       ` [tarantool-patches] [PATCH] Fix RelWithDebInfoWError warnings on 2.0 Alexander Turenko
2018-10-05  6:06         ` [tarantool-patches] " Alexander Turenko
2018-10-05  7:42         ` Kirill Yukhin
2018-10-05  7:20       ` [tarantool-patches] Re: [PATCH] Add -Werror for CI (1.10 part) Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0713b50dce1fc8a955bbc2e625a6269fbb21b6a1.1537547498.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part)' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox