Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v2] Fix warnings
@ 2018-04-23 17:08 Gleb
  2018-04-23 17:37 ` [tarantool-patches] " n.pettik
  2018-04-26  6:38 ` Kirill Yukhin
  0 siblings, 2 replies; 12+ messages in thread
From: Gleb @ 2018-04-23 17:08 UTC (permalink / raw)
  To: tarantool-patches

Ensure -Werror -Wall set for the whole src/.
Fix warnings which have been found with -Werror and -Wall.
Add new build target RelWithDebInfoWError.
Change build target on RelWithDebInfoWError in CI.

Fixes #3238
---
 .travis.mk                 |  4 ++--
 cmake/compiler.cmake       |  8 +++++++-
 src/box/space_def.c        |  2 ++
 src/box/sql/CMakeLists.txt |  3 ---
 src/box/sql/alter.c        |  1 +
 src/box/sql/insert.c       |  5 +++--
 src/box/sql/pragma.c       |  4 ++--
 src/box/vy_read_iterator.c |  2 +-
 src/box/xrow.c             | 13 ++++++++++---
 src/httpc.c                |  2 +-
 src/lua/init.c             |  4 +++-
 src/say.c                  |  7 +++++--
 12 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index 393d78f..2328e0d 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -40,7 +40,7 @@ deps_ubuntu:
 		lcov ruby tcl
 
 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 05d33ab..12fc335 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -251,12 +251,18 @@ 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.
+    # 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")
         AND HAVE_STD_C11 AND HAVE_STD_CXX11)
         add_compile_flags("C;CXX" "-Werror")
     endif()
+
+    if ((${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)
 
 if (HAVE_OPENMP)
diff --git a/src/box/space_def.c b/src/box/space_def.c
index 22bd3ca..3f11088 100644
--- a/src/box/space_def.c
+++ b/src/box/space_def.c
@@ -130,6 +130,7 @@ space_def_dup(const struct space_def *src)
 				 * allocation refactoring.
 				 */
 				assert(expr_pos_old == expr_pos);
+				(void) expr_pos_old;
 				expr_pos += sql_expr_sizeof(e, 0);
 				ret->fields[i].default_value_expr = e;
 			}
@@ -216,6 +217,7 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
 				 * allocation refactoring.
 				 */
 				assert(expr_pos_old == expr_pos);
+				(void) expr_pos_old;
 				expr_pos += sql_expr_sizeof(e, 0);
 				def->fields[i].default_value_expr = e;
 			}
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 678eb4c..526d9fe 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -4,9 +4,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
   add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
   add_definitions(-DSQLITE_ENABLE_WHERETRACE)
-
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
 endif()
 
 set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index b30a973..6c4952a 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -156,6 +156,7 @@ sqlite3AlterFinishAddColumn(Parse * pParse, Token * pColDef)
 	if (pParse->nErr || db->mallocFailed)
 		return;
 	assert(v != 0);
+	(void) v;
 	pNew = pParse->pNewTable;
 	assert(pNew);
 
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index f04496a..b96adb1 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -48,15 +48,16 @@ sqlite3OpenTable(Parse * pParse,	/* Generate code into this VDBE */
 		 Table * pTab,	/* The table to be opened */
 		 int opcode)	/* OP_OpenRead or OP_OpenWrite */
 {
-	Vdbe *v;
-	v = sqlite3GetVdbe(pParse);
+	Vdbe *v = sqlite3GetVdbe(pParse);
 	assert(opcode == OP_OpenWrite || opcode == OP_OpenRead);
+	(void) opcode;
 	Index *pPk = sqlite3PrimaryKeyIndex(pTab);
 	assert(pPk != 0);
 	assert(pPk->tnum == pTab->tnum);
 	emit_open_cursor(pParse, iCur, pPk->tnum);
 	sqlite3VdbeSetP4KeyInfo(pParse, pPk);
 	VdbeComment((v, "%s", pTab->zName));
+	(void) v;
 }
 
 /*
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index a2a6391..491cc67 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -256,7 +256,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
 	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
 	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
-	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
 	sqlite3 *db = pParse->db;	/* The database connection */
 	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
 	const PragmaName *pPragma;	/* The pragma */
@@ -523,8 +522,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_tuple_t *tuple;
 		box_iterator_t* iter;
 		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
-		rc = box_iterator_next(iter, &tuple);
+		int rc = box_iterator_next(iter, &tuple);
 		assert(rc==0);
+		(void) rc;
 		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
 			/* 1 is name field number */
 			const char *str = tuple_field_cstr(tuple, 1);
diff --git a/src/box/vy_read_iterator.c b/src/box/vy_read_iterator.c
index 2cad233..fea2c46 100644
--- a/src/box/vy_read_iterator.c
+++ b/src/box/vy_read_iterator.c
@@ -552,7 +552,7 @@ vy_read_iterator_next_lsn(struct vy_read_iterator *itr, struct tuple **ret)
 {
 	uint32_t i;
 	bool unused;
-	struct vy_read_src *src;
+	struct vy_read_src *src = NULL;
 
 	assert(itr->curr_stmt != NULL);
 	assert(itr->curr_src < itr->skipped_src);
diff --git a/src/box/xrow.c b/src/box/xrow.c
index 64dc625..a9920c3 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -306,6 +306,7 @@ iproto_reply_request_vote(struct obuf *out, uint64_t sync,
 
 	char *ptr = obuf_alloc(out, size);
 	assert(ptr == buf);
+	(void) ptr;
 	return 0;
 }
 
@@ -343,9 +344,15 @@ iproto_write_error(int fd, const struct error *e, uint32_t schema_version,
 			     schema_version, sizeof(body) + msg_len);
 
 	body.v_data_len = mp_bswap_u32(msg_len);
-	(void) write(fd, header, sizeof(header));
-	(void) write(fd, &body, sizeof(body));
-	(void) write(fd, e->errmsg, msg_len);
+	ssize_t unused = write(fd, header, sizeof(header));
+	/* Silence gcc warning. */
+	(void) unused;
+	unused = write(fd, &body, sizeof(body));
+	/* Silence gcc warning. */
+	(void) unused;
+	unused = write(fd, e->errmsg, msg_len);
+	/* Silence gcc warning. */
+	(void) unused;
 }
 
 int
diff --git a/src/httpc.c b/src/httpc.c
index 633e688..a720cf3 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -249,7 +249,7 @@ httpc_set_low_speed_limit(struct httpc_request *req, long low_speed_limit)
 void
 httpc_set_verbose(struct httpc_request *req, bool curl_verbose)
 {
-	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
+	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, (long) curl_verbose);
 }
 
 void
diff --git a/src/lua/init.c b/src/lua/init.c
index 76e978c..7345490 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -279,7 +279,9 @@ tarantool_lua_setpaths(struct lua_State *L)
 {
 	const char *home = getenv("HOME");
 	char cwd[PATH_MAX] = {'\0'};
-	getcwd(cwd, sizeof(cwd));
+	char *unused = getcwd(cwd, sizeof(cwd));
+	/* Silence gcc warning. */
+	(void) unused;
 	lua_getglobal(L, "package");
 	int top = lua_gettop(L);
 
diff --git a/src/say.c b/src/say.c
index 4312408..fadb9ac 100644
--- a/src/say.c
+++ b/src/say.c
@@ -1130,8 +1130,11 @@ log_vsay(struct log *log, int level, const char *filename, int line,
 		break;
 	case SAY_LOGGER_SYSLOG:
 		write_to_syslog(log, total);
-		if (level == S_FATAL && log->fd != STDERR_FILENO)
-			(void) safe_write(STDERR_FILENO, buf, total);
+		if (level == S_FATAL && log->fd != STDERR_FILENO) {
+			ssize_t unused = safe_write(STDERR_FILENO, buf, total);
+			/* Silence gcc warning. */
+			(void) unused;
+		}
 		break;
 	case SAY_LOGGER_BOOT:
 	{
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH v2] Fix warnings
  2018-04-23 17:08 [tarantool-patches] [PATCH v2] Fix warnings Gleb
@ 2018-04-23 17:37 ` n.pettik
  2018-04-26  6:38 ` Kirill Yukhin
  1 sibling, 0 replies; 12+ messages in thread
From: n.pettik @ 2018-04-23 17:37 UTC (permalink / raw)
  To: tarantool-patches
  Cc: Alexander Turenko,
	Кирилл
	Юхин

Looks good to me.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH v2] Fix warnings
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Kirill Yukhin @ 2018-04-26  6:38 UTC (permalink / raw)
  To: tarantool-patches

Hello Gleb,
On 23 апр 20:08, Gleb wrote:
> Ensure -Werror -Wall set for the whole src/.
> Fix warnings which have been found with -Werror and -Wall.
> Add new build target RelWithDebInfoWError.
> Change build target on RelWithDebInfoWError in CI.
> 
> Fixes #3238
> ---
> diff --git a/src/box/space_def.c b/src/box/space_def.c
> index 22bd3ca..3f11088 100644
> --- a/src/box/space_def.c
> +++ b/src/box/space_def.c
> @@ -130,6 +130,7 @@ space_def_dup(const struct space_def *src)
>  				 * allocation refactoring.
>  				 */
>  				assert(expr_pos_old == expr_pos);
> +				(void) expr_pos_old;
Could you pls use MAYBE_UNUSED, defined in util/trivia.h, instead?
(everywhere in your patch)

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH v2] Fix warnings
  2018-04-26  6:38 ` Kirill Yukhin
@ 2018-09-21 12:35   ` Alexander Turenko
  2018-09-21 16:41     ` [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part) Alexander Turenko
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Turenko @ 2018-09-21 12:35 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

I think we should use MAYBE_UNUSED for a function parameter and (void)
for a function variable. At least it seems we now use them it that way.

WBR, Alexander Turenko.

On Thu, Apr 26, 2018 at 09:38:49AM +0300, Kirill Yukhin wrote:
> Hello Gleb,
> On 23 апр 20:08, Gleb wrote:
> > Ensure -Werror -Wall set for the whole src/.
> > Fix warnings which have been found with -Werror and -Wall.
> > Add new build target RelWithDebInfoWError.
> > Change build target on RelWithDebInfoWError in CI.
> > 
> > Fixes #3238
> > ---
> > diff --git a/src/box/space_def.c b/src/box/space_def.c
> > index 22bd3ca..3f11088 100644
> > --- a/src/box/space_def.c
> > +++ b/src/box/space_def.c
> > @@ -130,6 +130,7 @@ space_def_dup(const struct space_def *src)
> >  				 * allocation refactoring.
> >  				 */
> >  				assert(expr_pos_old == expr_pos);
> > +				(void) expr_pos_old;
> Could you pls use MAYBE_UNUSED, defined in util/trivia.h, instead?
> (everywhere in your patch)
> 
> --
> Regards, Kirill Yukhin
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part)
  2018-09-21 12:35   ` Alexander Turenko
@ 2018-09-21 16:41     ` Alexander Turenko
  2018-09-21 16:41       ` [tarantool-patches] [PATCH] Fix RelWithDebInfoWError warnings on 2.0 Alexander Turenko
  2018-10-05  7:20       ` [tarantool-patches] Re: [PATCH] Add -Werror for CI (1.10 part) Kirill Yukhin
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Turenko @ 2018-09-21 16:41 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Alexander Turenko, tarantool-patches

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] [PATCH] Fix RelWithDebInfoWError warnings on 2.0
  2018-09-21 16:41     ` [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part) Alexander Turenko
@ 2018-09-21 16:41       ` 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
  1 sibling, 2 replies; 12+ messages in thread
From: Alexander Turenko @ 2018-09-21 16:41 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Alexander Turenko, tarantool-patches

Fixed warnings from -Wunused-parameter, -Wunused-variable,
-Wunused-but-set-variable.

Fixed -Wsometimes-uninitialized on clang in where.c.

Removed -Wall -Wextra -Werror from SQL CMakeLists.txt, because it is set
by tarantool itself and is redundant.

Fixes #3238.
---

branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3238-add-werror-for-ci-2.0
issue: https://github.com/tarantool/tarantool/issues/3238

Please, push it to 2.0 if the changes look good for you.

Note: this part of the patchset can be pushed to 2.0 before or just
after of 1.10 part.

 src/box/space_def.c        | 2 ++
 src/box/sql/CMakeLists.txt | 3 ---
 src/box/sql/build.c        | 2 +-
 src/box/sql/insert.c       | 5 +++--
 src/box/sql/pragma.c       | 6 +++---
 src/box/sql/vdbeaux.c      | 2 +-
 src/box/sql/vdbemem.c      | 1 +
 src/box/sql/where.c        | 2 +-
 8 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/box/space_def.c b/src/box/space_def.c
index 542289ead..69b92c5c1 100644
--- a/src/box/space_def.c
+++ b/src/box/space_def.c
@@ -153,6 +153,7 @@ space_def_dup(const struct space_def *src)
 			struct Expr *e = src->fields[i].default_value_expr;
 			if (e != NULL) {
 				char *expr_pos_old = expr_pos;
+				(void) expr_pos_old;
 				e = sql_expr_dup(sql_get(), e, 0, &expr_pos);
 				assert(e != NULL);
 				/* Note: due to SQL legacy
@@ -233,6 +234,7 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
 			struct Expr *e = def->fields[i].default_value_expr;
 			if (e != NULL) {
 				char *expr_pos_old = expr_pos;
+				(void) expr_pos_old;
 				e = sql_expr_dup(sql_get(), e, 0, &expr_pos);
 				assert(e != NULL);
 				/* Note: due to SQL legacy
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 1f852424a..73726bd9a 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -2,9 +2,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
   add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
   add_definitions(-DSQLITE_ENABLE_WHERETRACE)
-
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
 endif()
 
 set(EXT_SRC_DIR ${CMAKE_SOURCE_DIR}/extra)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 60b49df12..4ff3f6b87 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -2379,7 +2379,7 @@ constraint_is_named(const char *name)
 void
 sql_create_index(struct Parse *parse, struct Token *token,
 		 struct SrcList *tbl_name, struct ExprList *col_list,
-		 struct Token *start, enum sort_order sort_order,
+		 MAYBE_UNUSED struct Token *start, enum sort_order sort_order,
 		 bool if_not_exist, enum sql_index_type idx_type) {
 	/* The index to be created. */
 	struct index *index = NULL;
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 03f4e1b14..e1a4481fa 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -45,11 +45,12 @@
  */
 void
 sqlite3OpenTable(Parse * pParse,	/* Generate code into this VDBE */
-		 int iCur,	/* The cursor number of the table */
+		 int iCur,		/* The cursor number of the table */
 		 struct space *space,	/* The table to be opened */
-		 int opcode)	/* OP_OpenRead or OP_OpenWrite */
+		 MAYBE_UNUSED int opcode)	/* OP_OpenRead or OP_OpenWrite */
 {
 	Vdbe *v;
+	(void) v;
 	v = sqlite3GetVdbe(pParse);
 	assert(opcode == OP_OpenWrite || opcode == OP_OpenRead);
 	assert(space->index_count > 0);
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 4f64ab6f2..b3fdd06c6 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -430,7 +430,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
 	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
 	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
-	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
 	sqlite3 *db = pParse->db;	/* The database connection */
 	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
 	const PragmaName *pPragma;	/* The pragma */
@@ -526,8 +525,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_tuple_t *tuple;
 		box_iterator_t* iter;
 		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
-		rc = box_iterator_next(iter, &tuple);
-		assert(rc==0);
+		int rc = box_iterator_next(iter, &tuple);
+		(void) rc;
+		assert(rc == 0);
 		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
 			/* 1 is name field number */
 			const char *str = tuple_field_cstr(tuple, 1);
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index c843bc786..c270059c5 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -2271,7 +2271,7 @@ sql_txn_begin(Vdbe *p)
 }
 
 Savepoint *
-sql_savepoint(Vdbe *p, const char *zName)
+sql_savepoint(MAYBE_UNUSED Vdbe *p, const char *zName)
 {
 	assert(p);
 	size_t nName = zName ? strlen(zName) + 1 : 0;
diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index ef70442b3..8edbd83a5 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -1597,6 +1597,7 @@ sql_stat4_column(struct sqlite3 *db, const char *record, uint32_t col_num,
 	const char *a = record;
 	assert(mp_typeof(a[0]) == MP_ARRAY);
 	uint32_t col_cnt = mp_decode_array(&a);
+	(void) col_cnt;
 	assert(col_cnt > col_num);
 	for (uint32_t i = 0; i < col_num; i++)
 		mp_next(&a);
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index a9cbcda0d..ed9d93394 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -4609,10 +4609,10 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 				iIndexCur = pLevel->iTabCur;
 				op = 0;
 			} else if (pWInfo->eOnePass != ONEPASS_OFF) {
+				iIndexCur = iAuxArg;
 				if (pTabItem->pTab->space->index_count != 0) {
 					uint32_t iid = 0;
 					struct index *pJ = pTabItem->pTab->space->index[iid];
-					iIndexCur = iAuxArg;
 					assert(wctrlFlags &
 					       WHERE_ONEPASS_DESIRED);
 					while (pJ->def->iid != idx_def->iid) {
-- 
2.19.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH] Fix RelWithDebInfoWError warnings on 2.0
  2018-09-21 16:41       ` [tarantool-patches] [PATCH] Fix RelWithDebInfoWError warnings on 2.0 Alexander Turenko
@ 2018-10-05  6:06         ` Alexander Turenko
  2018-10-05  7:42         ` Kirill Yukhin
  1 sibling, 0 replies; 12+ messages in thread
From: Alexander Turenko @ 2018-10-05  6:06 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

Rebased on top of fresh 2.0, fixed one conflict around sqlite3OpenTable.

WBR, Alexander Turenko.

On Fri, Sep 21, 2018 at 07:41:51PM +0300, Alexander Turenko wrote:
> Fixed warnings from -Wunused-parameter, -Wunused-variable,
> -Wunused-but-set-variable.
> 
> Fixed -Wsometimes-uninitialized on clang in where.c.
> 
> Removed -Wall -Wextra -Werror from SQL CMakeLists.txt, because it is set
> by tarantool itself and is redundant.
> 
> Fixes #3238.
> ---
> 
> branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3238-add-werror-for-ci-2.0
> issue: https://github.com/tarantool/tarantool/issues/3238
> 
> Please, push it to 2.0 if the changes look good for you.
> 
> Note: this part of the patchset can be pushed to 2.0 before or just
> after of 1.10 part.
> 
>  src/box/space_def.c        | 2 ++
>  src/box/sql/CMakeLists.txt | 3 ---
>  src/box/sql/build.c        | 2 +-
>  src/box/sql/insert.c       | 5 +++--
>  src/box/sql/pragma.c       | 6 +++---
>  src/box/sql/vdbeaux.c      | 2 +-
>  src/box/sql/vdbemem.c      | 1 +
>  src/box/sql/where.c        | 2 +-
>  8 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/src/box/space_def.c b/src/box/space_def.c
> index 542289ead..69b92c5c1 100644
> --- a/src/box/space_def.c
> +++ b/src/box/space_def.c
> @@ -153,6 +153,7 @@ space_def_dup(const struct space_def *src)
>  			struct Expr *e = src->fields[i].default_value_expr;
>  			if (e != NULL) {
>  				char *expr_pos_old = expr_pos;
> +				(void) expr_pos_old;
>  				e = sql_expr_dup(sql_get(), e, 0, &expr_pos);
>  				assert(e != NULL);
>  				/* Note: due to SQL legacy
> @@ -233,6 +234,7 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
>  			struct Expr *e = def->fields[i].default_value_expr;
>  			if (e != NULL) {
>  				char *expr_pos_old = expr_pos;
> +				(void) expr_pos_old;
>  				e = sql_expr_dup(sql_get(), e, 0, &expr_pos);
>  				assert(e != NULL);
>  				/* Note: due to SQL legacy
> diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
> index 1f852424a..73726bd9a 100644
> --- a/src/box/sql/CMakeLists.txt
> +++ b/src/box/sql/CMakeLists.txt
> @@ -2,9 +2,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
>    add_definitions(-DSQLITE_DEBUG=1)
>    add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
>    add_definitions(-DSQLITE_ENABLE_WHERETRACE)
> -
> -  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
> -  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
>  endif()
>  
>  set(EXT_SRC_DIR ${CMAKE_SOURCE_DIR}/extra)
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index 60b49df12..4ff3f6b87 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -2379,7 +2379,7 @@ constraint_is_named(const char *name)
>  void
>  sql_create_index(struct Parse *parse, struct Token *token,
>  		 struct SrcList *tbl_name, struct ExprList *col_list,
> -		 struct Token *start, enum sort_order sort_order,
> +		 MAYBE_UNUSED struct Token *start, enum sort_order sort_order,
>  		 bool if_not_exist, enum sql_index_type idx_type) {
>  	/* The index to be created. */
>  	struct index *index = NULL;
> diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
> index 03f4e1b14..e1a4481fa 100644
> --- a/src/box/sql/insert.c
> +++ b/src/box/sql/insert.c
> @@ -45,11 +45,12 @@
>   */
>  void
>  sqlite3OpenTable(Parse * pParse,	/* Generate code into this VDBE */
> -		 int iCur,	/* The cursor number of the table */
> +		 int iCur,		/* The cursor number of the table */
>  		 struct space *space,	/* The table to be opened */
> -		 int opcode)	/* OP_OpenRead or OP_OpenWrite */
> +		 MAYBE_UNUSED int opcode)	/* OP_OpenRead or OP_OpenWrite */
>  {
>  	Vdbe *v;
> +	(void) v;
>  	v = sqlite3GetVdbe(pParse);
>  	assert(opcode == OP_OpenWrite || opcode == OP_OpenRead);
>  	assert(space->index_count > 0);
> diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
> index 4f64ab6f2..b3fdd06c6 100644
> --- a/src/box/sql/pragma.c
> +++ b/src/box/sql/pragma.c
> @@ -430,7 +430,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
>  	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
>  	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
>  	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
> -	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
>  	sqlite3 *db = pParse->db;	/* The database connection */
>  	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
>  	const PragmaName *pPragma;	/* The pragma */
> @@ -526,8 +525,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
>  		box_tuple_t *tuple;
>  		box_iterator_t* iter;
>  		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
> -		rc = box_iterator_next(iter, &tuple);
> -		assert(rc==0);
> +		int rc = box_iterator_next(iter, &tuple);
> +		(void) rc;
> +		assert(rc == 0);
>  		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
>  			/* 1 is name field number */
>  			const char *str = tuple_field_cstr(tuple, 1);
> diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
> index c843bc786..c270059c5 100644
> --- a/src/box/sql/vdbeaux.c
> +++ b/src/box/sql/vdbeaux.c
> @@ -2271,7 +2271,7 @@ sql_txn_begin(Vdbe *p)
>  }
>  
>  Savepoint *
> -sql_savepoint(Vdbe *p, const char *zName)
> +sql_savepoint(MAYBE_UNUSED Vdbe *p, const char *zName)
>  {
>  	assert(p);
>  	size_t nName = zName ? strlen(zName) + 1 : 0;
> diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
> index ef70442b3..8edbd83a5 100644
> --- a/src/box/sql/vdbemem.c
> +++ b/src/box/sql/vdbemem.c
> @@ -1597,6 +1597,7 @@ sql_stat4_column(struct sqlite3 *db, const char *record, uint32_t col_num,
>  	const char *a = record;
>  	assert(mp_typeof(a[0]) == MP_ARRAY);
>  	uint32_t col_cnt = mp_decode_array(&a);
> +	(void) col_cnt;
>  	assert(col_cnt > col_num);
>  	for (uint32_t i = 0; i < col_num; i++)
>  		mp_next(&a);
> diff --git a/src/box/sql/where.c b/src/box/sql/where.c
> index a9cbcda0d..ed9d93394 100644
> --- a/src/box/sql/where.c
> +++ b/src/box/sql/where.c
> @@ -4609,10 +4609,10 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
>  				iIndexCur = pLevel->iTabCur;
>  				op = 0;
>  			} else if (pWInfo->eOnePass != ONEPASS_OFF) {
> +				iIndexCur = iAuxArg;
>  				if (pTabItem->pTab->space->index_count != 0) {
>  					uint32_t iid = 0;
>  					struct index *pJ = pTabItem->pTab->space->index[iid];
> -					iIndexCur = iAuxArg;
>  					assert(wctrlFlags &
>  					       WHERE_ONEPASS_DESIRED);
>  					while (pJ->def->iid != idx_def->iid) {
> -- 
> 2.19.0
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH] Add -Werror for CI (1.10 part)
  2018-09-21 16:41     ` [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part) Alexander Turenko
  2018-09-21 16:41       ` [tarantool-patches] [PATCH] Fix RelWithDebInfoWError warnings on 2.0 Alexander Turenko
@ 2018-10-05  7:20       ` Kirill Yukhin
  1 sibling, 0 replies; 12+ messages in thread
From: Kirill Yukhin @ 2018-10-05  7:20 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Hello,
On 21 Sep 19:41, Alexander Turenko wrote:
> 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
Patch pushed to 1.10 branch.

--
Regards, Kirill Yukhin
XS

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] Re: [PATCH] Fix RelWithDebInfoWError warnings on 2.0
  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
  1 sibling, 0 replies; 12+ messages in thread
From: Kirill Yukhin @ 2018-10-05  7:42 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Hello,
On 21 Sep 19:41, Alexander Turenko wrote:
> Fixed warnings from -Wunused-parameter, -Wunused-variable,
> -Wunused-but-set-variable.
> 
> Fixed -Wsometimes-uninitialized on clang in where.c.
> 
> Removed -Wall -Wextra -Werror from SQL CMakeLists.txt, because it is set
> by tarantool itself and is redundant.
> 
> Fixes #3238.
> ---
> 
> branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3238-add-werror-for-ci-2.0
> issue: https://github.com/tarantool/tarantool/issues/3238
Patch is OK. I've pushed it into 2.0 branch.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] [PATCH v2] Fix warnings
@ 2018-04-12 13:50 Gleb
  0 siblings, 0 replies; 12+ messages in thread
From: Gleb @ 2018-04-12 13:50 UTC (permalink / raw)
  To: tarantool-patches

Ensure -Werror -Wall set for the whole src/.
Fix warnings which have been find with -Werror and -Wall.
Add new building target RelWithDebInfoWError.
Change building target on RelWithDebInfoWError in CI.

Fixes #3238
---
Issue from https://github.com/tarantool/tarantool/issues/3238.
Source from https://github.com/tarantool/tarantool/tree/gh-3238-check-warnings.
 .travis.mk                 |  4 ++--
 cmake/compiler.cmake       |  8 +++++++-
 src/box/space_def.c        |  2 ++
 src/box/sql/CMakeLists.txt |  3 ---
 src/box/sql/alter.c        |  1 +
 src/box/sql/insert.c       |  4 +++-
 src/box/sql/pragma.c       |  4 ++--
 src/box/vy_read_iterator.c |  2 +-
 src/box/xrow.c             | 10 +++++++---
 src/httpc.c                |  2 +-
 src/lua/init.c             |  3 ++-
 src/say.c                  |  7 +++++--
 12 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index 393d78f..2328e0d 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -40,7 +40,7 @@ deps_ubuntu:
 		lcov ruby tcl
 
 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 05d33ab..12fc335 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -251,12 +251,18 @@ 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.
+    # 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")
         AND HAVE_STD_C11 AND HAVE_STD_CXX11)
         add_compile_flags("C;CXX" "-Werror")
     endif()
+
+    if ((${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)
 
 if (HAVE_OPENMP)
diff --git a/src/box/space_def.c b/src/box/space_def.c
index 22bd3ca..3f11088 100644
--- a/src/box/space_def.c
+++ b/src/box/space_def.c
@@ -130,6 +130,7 @@ space_def_dup(const struct space_def *src)
 				 * allocation refactoring.
 				 */
 				assert(expr_pos_old == expr_pos);
+				(void) expr_pos_old;
 				expr_pos += sql_expr_sizeof(e, 0);
 				ret->fields[i].default_value_expr = e;
 			}
@@ -216,6 +217,7 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
 				 * allocation refactoring.
 				 */
 				assert(expr_pos_old == expr_pos);
+				(void) expr_pos_old;
 				expr_pos += sql_expr_sizeof(e, 0);
 				def->fields[i].default_value_expr = e;
 			}
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 678eb4c..526d9fe 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -4,9 +4,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
   add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
   add_definitions(-DSQLITE_ENABLE_WHERETRACE)
-
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
 endif()
 
 set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index 129ef82..5f553c8 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -156,6 +156,7 @@ sqlite3AlterFinishAddColumn(Parse * pParse, Token * pColDef)
 	if (pParse->nErr || db->mallocFailed)
 		return;
 	assert(v != 0);
+	(void) v;
 	pNew = pParse->pNewTable;
 	assert(pNew);
 
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index b24d55b..7ae4973 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -47,7 +47,7 @@ sqlite3OpenTable(Parse * pParse,	/* Generate code into this VDBE */
 		 Table * pTab,	/* The table to be opened */
 		 int opcode)	/* OP_OpenRead or OP_OpenWrite */
 {
-	Vdbe *v;
+	Vdbe *v = NULL;
 	v = sqlite3GetVdbe(pParse);
 	assert(opcode == OP_OpenWrite || opcode == OP_OpenRead);
 	Index *pPk = sqlite3PrimaryKeyIndex(pTab);
@@ -56,6 +56,8 @@ sqlite3OpenTable(Parse * pParse,	/* Generate code into this VDBE */
 	emit_open_cursor(pParse, iCur, pPk->tnum);
 	sqlite3VdbeSetP4KeyInfo(pParse, pPk);
 	VdbeComment((v, "%s", pTab->zName));
+	(void) v;
+	(void) opcode;
 }
 
 /*
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index b724c98..be973b7 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -256,7 +256,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
 	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
 	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
-	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
 	sqlite3 *db = pParse->db;	/* The database connection */
 	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
 	const PragmaName *pPragma;	/* The pragma */
@@ -516,8 +515,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_tuple_t *tuple;
 		box_iterator_t* iter;
 		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
-		rc = box_iterator_next(iter, &tuple);
+		int rc = box_iterator_next(iter, &tuple);
 		assert(rc==0);
+		(void) rc;
 		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
 			/* 1 is name field number */
 			const char *str = tuple_field_cstr(tuple, 1);
diff --git a/src/box/vy_read_iterator.c b/src/box/vy_read_iterator.c
index 2cad233..fea2c46 100644
--- a/src/box/vy_read_iterator.c
+++ b/src/box/vy_read_iterator.c
@@ -552,7 +552,7 @@ vy_read_iterator_next_lsn(struct vy_read_iterator *itr, struct tuple **ret)
 {
 	uint32_t i;
 	bool unused;
-	struct vy_read_src *src;
+	struct vy_read_src *src = NULL;
 
 	assert(itr->curr_stmt != NULL);
 	assert(itr->curr_src < itr->skipped_src);
diff --git a/src/box/xrow.c b/src/box/xrow.c
index 3ef3d82..d2a0e02 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -301,6 +301,7 @@ iproto_reply_vclock(struct obuf *out, uint64_t sync, uint32_t schema_version,
 			     size - IPROTO_HEADER_LEN);
 
 	char *ptr = obuf_alloc(out, size);
+	(void) ptr;
 	assert(ptr == buf);
 	return 0;
 }
@@ -339,9 +340,12 @@ iproto_write_error(int fd, const struct error *e, uint32_t schema_version,
 			     schema_version, sizeof(body) + msg_len);
 
 	body.v_data_len = mp_bswap_u32(msg_len);
-	(void) write(fd, header, sizeof(header));
-	(void) write(fd, &body, sizeof(body));
-	(void) write(fd, e->errmsg, msg_len);
+	ssize_t r1 = write(fd, header, sizeof(header));
+	ssize_t r2 = write(fd, &body, sizeof(body));
+	ssize_t r3 = write(fd, e->errmsg, msg_len);
+	(void) r1;
+	(void) r2;
+	(void) r3;
 }
 
 int
diff --git a/src/httpc.c b/src/httpc.c
index 633e688..a720cf3 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -249,7 +249,7 @@ httpc_set_low_speed_limit(struct httpc_request *req, long low_speed_limit)
 void
 httpc_set_verbose(struct httpc_request *req, bool curl_verbose)
 {
-	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
+	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, (long) curl_verbose);
 }
 
 void
diff --git a/src/lua/init.c b/src/lua/init.c
index 76e978c..89765e5 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -279,7 +279,8 @@ tarantool_lua_setpaths(struct lua_State *L)
 {
 	const char *home = getenv("HOME");
 	char cwd[PATH_MAX] = {'\0'};
-	getcwd(cwd, sizeof(cwd));
+	char *buf = getcwd(cwd, sizeof(cwd));
+	(void) buf;
 	lua_getglobal(L, "package");
 	int top = lua_gettop(L);
 
diff --git a/src/say.c b/src/say.c
index 4312408..79b383c 100644
--- a/src/say.c
+++ b/src/say.c
@@ -1130,13 +1130,16 @@ log_vsay(struct log *log, int level, const char *filename, int line,
 		break;
 	case SAY_LOGGER_SYSLOG:
 		write_to_syslog(log, total);
-		if (level == S_FATAL && log->fd != STDERR_FILENO)
-			(void) safe_write(STDERR_FILENO, buf, total);
+		if (level == S_FATAL && log->fd != STDERR_FILENO) {
+			ssize_t r = safe_write(STDERR_FILENO, buf, total);
+			(void) r;
+		}
 		break;
 	case SAY_LOGGER_BOOT:
 	{
 		ssize_t r = safe_write(STDERR_FILENO, buf, total);
 		(void) r;                       /* silence gcc warning */
+
 		break;
 	}
 	default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] [PATCH v2] Fix warnings
@ 2018-04-11 20:56 Gleb
  0 siblings, 0 replies; 12+ messages in thread
From: Gleb @ 2018-04-11 20:56 UTC (permalink / raw)
  To: tarantool-patches

Ensure -Werror -Wall set for the whole src/.
Fix warnings which have been find with -Werror and -Wall.
Add new building target RelWithDebInfoWError.
Change building target on RelWithDebInfoWError in CI.

Fixes #3238
---
Issue from https://github.com/tarantool/tarantool/issues/3238.
Source from https://github.com/tarantool/tarantool/tree/gh-3238-check-warnings.
 .travis.mk                 |  4 ++--
 cmake/compiler.cmake       |  8 +++++++-
 src/box/sql/CMakeLists.txt |  3 ---
 src/box/sql/alter.c        |  1 +
 src/box/sql/pragma.c       |  4 ++--
 src/box/vy_read_iterator.c |  2 +-
 src/box/xrow.c             | 10 +++++++---
 src/httpc.c                |  2 +-
 src/lua/init.c             |  3 ++-
 src/say.c                  |  7 +++++--
 10 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index 393d78f..2328e0d 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -40,7 +40,7 @@ deps_ubuntu:
 		lcov ruby tcl
 
 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 05d33ab..12fc335 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -251,12 +251,18 @@ 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.
+    # 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")
         AND HAVE_STD_C11 AND HAVE_STD_CXX11)
         add_compile_flags("C;CXX" "-Werror")
     endif()
+
+    if ((${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)
 
 if (HAVE_OPENMP)
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 678eb4c..526d9fe 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -4,9 +4,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
   add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
   add_definitions(-DSQLITE_ENABLE_WHERETRACE)
-
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
 endif()
 
 set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index 129ef82..5f553c8 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -156,6 +156,7 @@ sqlite3AlterFinishAddColumn(Parse * pParse, Token * pColDef)
 	if (pParse->nErr || db->mallocFailed)
 		return;
 	assert(v != 0);
+	(void) v;
 	pNew = pParse->pNewTable;
 	assert(pNew);
 
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index b724c98..be973b7 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -256,7 +256,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
 	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
 	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
-	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
 	sqlite3 *db = pParse->db;	/* The database connection */
 	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
 	const PragmaName *pPragma;	/* The pragma */
@@ -516,8 +515,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_tuple_t *tuple;
 		box_iterator_t* iter;
 		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
-		rc = box_iterator_next(iter, &tuple);
+		int rc = box_iterator_next(iter, &tuple);
 		assert(rc==0);
+		(void) rc;
 		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
 			/* 1 is name field number */
 			const char *str = tuple_field_cstr(tuple, 1);
diff --git a/src/box/vy_read_iterator.c b/src/box/vy_read_iterator.c
index 2cad233..fea2c46 100644
--- a/src/box/vy_read_iterator.c
+++ b/src/box/vy_read_iterator.c
@@ -552,7 +552,7 @@ vy_read_iterator_next_lsn(struct vy_read_iterator *itr, struct tuple **ret)
 {
 	uint32_t i;
 	bool unused;
-	struct vy_read_src *src;
+	struct vy_read_src *src = NULL;
 
 	assert(itr->curr_stmt != NULL);
 	assert(itr->curr_src < itr->skipped_src);
diff --git a/src/box/xrow.c b/src/box/xrow.c
index 3ef3d82..d2a0e02 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -301,6 +301,7 @@ iproto_reply_vclock(struct obuf *out, uint64_t sync, uint32_t schema_version,
 			     size - IPROTO_HEADER_LEN);
 
 	char *ptr = obuf_alloc(out, size);
+	(void) ptr;
 	assert(ptr == buf);
 	return 0;
 }
@@ -339,9 +340,12 @@ iproto_write_error(int fd, const struct error *e, uint32_t schema_version,
 			     schema_version, sizeof(body) + msg_len);
 
 	body.v_data_len = mp_bswap_u32(msg_len);
-	(void) write(fd, header, sizeof(header));
-	(void) write(fd, &body, sizeof(body));
-	(void) write(fd, e->errmsg, msg_len);
+	ssize_t r1 = write(fd, header, sizeof(header));
+	ssize_t r2 = write(fd, &body, sizeof(body));
+	ssize_t r3 = write(fd, e->errmsg, msg_len);
+	(void) r1;
+	(void) r2;
+	(void) r3;
 }
 
 int
diff --git a/src/httpc.c b/src/httpc.c
index 633e688..a720cf3 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -249,7 +249,7 @@ httpc_set_low_speed_limit(struct httpc_request *req, long low_speed_limit)
 void
 httpc_set_verbose(struct httpc_request *req, bool curl_verbose)
 {
-	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
+	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, (long) curl_verbose);
 }
 
 void
diff --git a/src/lua/init.c b/src/lua/init.c
index 76e978c..89765e5 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -279,7 +279,8 @@ tarantool_lua_setpaths(struct lua_State *L)
 {
 	const char *home = getenv("HOME");
 	char cwd[PATH_MAX] = {'\0'};
-	getcwd(cwd, sizeof(cwd));
+	char *buf = getcwd(cwd, sizeof(cwd));
+	(void) buf;
 	lua_getglobal(L, "package");
 	int top = lua_gettop(L);
 
diff --git a/src/say.c b/src/say.c
index 4312408..79b383c 100644
--- a/src/say.c
+++ b/src/say.c
@@ -1130,13 +1130,16 @@ log_vsay(struct log *log, int level, const char *filename, int line,
 		break;
 	case SAY_LOGGER_SYSLOG:
 		write_to_syslog(log, total);
-		if (level == S_FATAL && log->fd != STDERR_FILENO)
-			(void) safe_write(STDERR_FILENO, buf, total);
+		if (level == S_FATAL && log->fd != STDERR_FILENO) {
+			ssize_t r = safe_write(STDERR_FILENO, buf, total);
+			(void) r;
+		}
 		break;
 	case SAY_LOGGER_BOOT:
 	{
 		ssize_t r = safe_write(STDERR_FILENO, buf, total);
 		(void) r;                       /* silence gcc warning */
+
 		break;
 	}
 	default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tarantool-patches] [PATCH v2] Fix warnings
@ 2018-04-11 20:49 Gleb
  0 siblings, 0 replies; 12+ messages in thread
From: Gleb @ 2018-04-11 20:49 UTC (permalink / raw)
  To: tarantool-patches

Ensure -Werror -Wall set for the whole src/.
Fix warnings which have been find with -Werror and -Wall.
Add new building target RelWithDebInfoWError.
Change building target on RelWithDebInfoWError in Cl.

Fixes #3238
---
Issue from https://github.com/tarantool/tarantool/issues/3238.
Source from https://github.com/tarantool/tarantool/tree/gh-3238-check-warnings.
 .travis.mk                 |  4 ++--
 cmake/compiler.cmake       |  8 +++++++-
 src/box/sql/CMakeLists.txt |  3 ---
 src/box/sql/alter.c        |  1 +
 src/box/sql/pragma.c       |  4 ++--
 src/box/vy_read_iterator.c |  2 +-
 src/box/xrow.c             | 10 +++++++---
 src/httpc.c                |  2 +-
 src/lua/init.c             |  3 ++-
 src/say.c                  |  7 +++++--
 10 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index 393d78f..2328e0d 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -40,7 +40,7 @@ deps_ubuntu:
 		lcov ruby tcl
 
 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 05d33ab..12fc335 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -251,12 +251,18 @@ 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.
+    # 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")
         AND HAVE_STD_C11 AND HAVE_STD_CXX11)
         add_compile_flags("C;CXX" "-Werror")
     endif()
+
+    if ((${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)
 
 if (HAVE_OPENMP)
diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 678eb4c..526d9fe 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -4,9 +4,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
   add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
   add_definitions(-DSQLITE_ENABLE_WHERETRACE)
-
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
 endif()
 
 set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index 129ef82..5f553c8 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -156,6 +156,7 @@ sqlite3AlterFinishAddColumn(Parse * pParse, Token * pColDef)
 	if (pParse->nErr || db->mallocFailed)
 		return;
 	assert(v != 0);
+	(void) v;
 	pNew = pParse->pNewTable;
 	assert(pNew);
 
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index b724c98..be973b7 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -256,7 +256,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	char *zLeft = 0;	/* Nul-terminated UTF-8 string <id> */
 	char *zRight = 0;	/* Nul-terminated UTF-8 string <value>, or NULL */
 	char *zTable = 0;	/* Nul-terminated UTF-8 string <value2> or NULL */
-	int rc;			/* return value form SQLITE_FCNTL_PRAGMA */
 	sqlite3 *db = pParse->db;	/* The database connection */
 	Vdbe *v = sqlite3GetVdbe(pParse);	/* Prepared statement */
 	const PragmaName *pPragma;	/* The pragma */
@@ -516,8 +515,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_tuple_t *tuple;
 		box_iterator_t* iter;
 		iter = box_index_iterator(space_id, 0,ITER_ALL, key_buf, key_end);
-		rc = box_iterator_next(iter, &tuple);
+		int rc = box_iterator_next(iter, &tuple);
 		assert(rc==0);
+		(void) rc;
 		for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
 			/* 1 is name field number */
 			const char *str = tuple_field_cstr(tuple, 1);
diff --git a/src/box/vy_read_iterator.c b/src/box/vy_read_iterator.c
index 2cad233..fea2c46 100644
--- a/src/box/vy_read_iterator.c
+++ b/src/box/vy_read_iterator.c
@@ -552,7 +552,7 @@ vy_read_iterator_next_lsn(struct vy_read_iterator *itr, struct tuple **ret)
 {
 	uint32_t i;
 	bool unused;
-	struct vy_read_src *src;
+	struct vy_read_src *src = NULL;
 
 	assert(itr->curr_stmt != NULL);
 	assert(itr->curr_src < itr->skipped_src);
diff --git a/src/box/xrow.c b/src/box/xrow.c
index 3ef3d82..d2a0e02 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -301,6 +301,7 @@ iproto_reply_vclock(struct obuf *out, uint64_t sync, uint32_t schema_version,
 			     size - IPROTO_HEADER_LEN);
 
 	char *ptr = obuf_alloc(out, size);
+	(void) ptr;
 	assert(ptr == buf);
 	return 0;
 }
@@ -339,9 +340,12 @@ iproto_write_error(int fd, const struct error *e, uint32_t schema_version,
 			     schema_version, sizeof(body) + msg_len);
 
 	body.v_data_len = mp_bswap_u32(msg_len);
-	(void) write(fd, header, sizeof(header));
-	(void) write(fd, &body, sizeof(body));
-	(void) write(fd, e->errmsg, msg_len);
+	ssize_t r1 = write(fd, header, sizeof(header));
+	ssize_t r2 = write(fd, &body, sizeof(body));
+	ssize_t r3 = write(fd, e->errmsg, msg_len);
+	(void) r1;
+	(void) r2;
+	(void) r3;
 }
 
 int
diff --git a/src/httpc.c b/src/httpc.c
index 633e688..a720cf3 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -249,7 +249,7 @@ httpc_set_low_speed_limit(struct httpc_request *req, long low_speed_limit)
 void
 httpc_set_verbose(struct httpc_request *req, bool curl_verbose)
 {
-	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
+	curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, (long) curl_verbose);
 }
 
 void
diff --git a/src/lua/init.c b/src/lua/init.c
index 76e978c..89765e5 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -279,7 +279,8 @@ tarantool_lua_setpaths(struct lua_State *L)
 {
 	const char *home = getenv("HOME");
 	char cwd[PATH_MAX] = {'\0'};
-	getcwd(cwd, sizeof(cwd));
+	char *buf = getcwd(cwd, sizeof(cwd));
+	(void) buf;
 	lua_getglobal(L, "package");
 	int top = lua_gettop(L);
 
diff --git a/src/say.c b/src/say.c
index 4312408..79b383c 100644
--- a/src/say.c
+++ b/src/say.c
@@ -1130,13 +1130,16 @@ log_vsay(struct log *log, int level, const char *filename, int line,
 		break;
 	case SAY_LOGGER_SYSLOG:
 		write_to_syslog(log, total);
-		if (level == S_FATAL && log->fd != STDERR_FILENO)
-			(void) safe_write(STDERR_FILENO, buf, total);
+		if (level == S_FATAL && log->fd != STDERR_FILENO) {
+			ssize_t r = safe_write(STDERR_FILENO, buf, total);
+			(void) r;
+		}
 		break;
 	case SAY_LOGGER_BOOT:
 	{
 		ssize_t r = safe_write(STDERR_FILENO, buf, total);
 		(void) r;                       /* silence gcc warning */
+
 		break;
 	}
 	default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-05  7:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [tarantool-patches] [PATCH] Add -Werror for CI (1.10 part) Alexander Turenko
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
  -- strict thread matches above, loose matches on Subject: below --
2018-04-12 13:50 [tarantool-patches] [PATCH v2] Fix warnings Gleb
2018-04-11 20:56 Gleb
2018-04-11 20:49 Gleb

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