Skip to content
Snippets Groups Projects
Commit da505ee7 authored by Alexander Turenko's avatar Alexander Turenko Committed by Kirill Yukhin
Browse files

Add -Werror for CI (1.10 part)

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.
parent 129099bc
No related branches found
No related tags found
No related merge requests found
......@@ -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 || :
......
......@@ -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)
......
......@@ -336,6 +336,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;
}
......@@ -374,6 +375,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;
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment