Skip to content

Commit 072f0cd

Browse files
committed
Merge pull request #284 from redboltz/fixed_unused_parameter
Fixed unused parameter
2 parents 4af6d4d + 5002f2c commit 072f0cd

File tree

5 files changed

+52
-45
lines changed

5 files changed

+52
-45
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ IF (MSGPACK_BUILD_TESTS)
196196
ENDIF ()
197197

198198
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
199-
SET_PROPERTY (TARGET msgpack APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3 -DPIC")
200-
SET_PROPERTY (TARGET msgpack-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3" )
199+
SET_PROPERTY (TARGET msgpack APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC")
200+
SET_PROPERTY (TARGET msgpack-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
201201
ENDIF ()
202202
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
203203
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")

configure.in

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ AC_CONFIG_AUX_DIR(ac)
33
AM_INIT_AUTOMAKE
44
AC_CONFIG_HEADER(config.h)
55
AC_SUBST(CFLAGS)
6-
CFLAGS="-O3 -Wall $CFLAGS"
6+
CFLAGS="-O3 -Wall -Wextra -Werror $CFLAGS"
77

88
AC_SUBST(CXXFLAGS)
9-
CXXFLAGS="-O3 -Wall $CXXFLAGS"
9+
CXXFLAGS="-O3 -Wall -Wextra -Werror $CXXFLAGS"
1010

1111

1212
AC_PROG_CC
1313

1414

1515
AC_MSG_CHECKING([if C++ API is enabled])
1616
AC_ARG_ENABLE(cxx,
17-
AS_HELP_STRING([--disable-cxx],
18-
[don't build C++ API]) ) #'
17+
AS_HELP_STRING([--disable-cxx],
18+
[don't build C++ API]) ) #'
1919
AC_MSG_RESULT([$enable_cxx])
2020
if test "$enable_cxx" != "no"; then
21-
AC_PROG_CXX
22-
AM_PROG_CC_C_O
21+
AC_PROG_CXX
22+
AM_PROG_CC_C_O
2323
fi
2424
AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")
2525

@@ -30,56 +30,56 @@ AM_PROG_AS
3030

3131
AC_MSG_CHECKING([if debug option is enabled])
3232
AC_ARG_ENABLE(debug,
33-
AS_HELP_STRING([--disable-debug],
34-
[disable assert macros and omit -g option]) )
33+
AS_HELP_STRING([--disable-debug],
34+
[disable assert macros and omit -g option]) )
3535
AC_MSG_RESULT([$enable_debug])
3636
if test "$enable_debug" != "no"; then
37-
CXXFLAGS="$CXXFLAGS -g"
38-
CFLAGS="$CFLAGS -g"
37+
CXXFLAGS="$CXXFLAGS -g"
38+
CFLAGS="$CFLAGS -g"
3939
else
40-
CXXFLAGS="$CXXFLAGS -DNDEBUG"
41-
CFLAGS="$CFLAGS -DNDEBUG"
40+
CXXFLAGS="$CXXFLAGS -DNDEBUG"
41+
CFLAGS="$CFLAGS -DNDEBUG"
4242
fi
4343

4444

4545
AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
46-
AC_TRY_LINK([
47-
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
48-
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
49-
], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
50-
])
46+
AC_TRY_LINK([
47+
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
48+
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
49+
], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
50+
])
5151
if test "$msgpack_cv_atomic_ops" != "yes"; then
52-
if test "$enable_cxx" = "no"; then
53-
AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
52+
if test "$enable_cxx" = "no"; then
53+
AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
5454
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
5555
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
5656

5757
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
58-
])
59-
fi
60-
61-
AC_LANG_PUSH([C++])
62-
AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
63-
AC_TRY_LINK([
64-
#include <bits/atomicity.h>
65-
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
66-
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
67-
], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
68-
])
69-
AC_LANG_POP([C++])
70-
71-
if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
72-
AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
58+
])
59+
fi
60+
61+
AC_LANG_PUSH([C++])
62+
AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
63+
AC_TRY_LINK([
64+
#include <bits/atomicity.h>
65+
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
66+
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
67+
], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
68+
])
69+
AC_LANG_POP([C++])
70+
71+
if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
72+
AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
7373

7474
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
7575
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
7676

7777
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
78-
])
78+
])
7979

80-
else
81-
enable_gcc_cxx_atomic=yes
82-
fi
80+
else
81+
enable_gcc_cxx_atomic=yes
82+
fi
8383
fi
8484

8585
AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")
@@ -93,6 +93,6 @@ AC_SUBST(VERSION_REVISION, $revision)
9393

9494

9595
AC_OUTPUT([Makefile
96-
msgpack.pc
97-
src/Makefile
98-
test/Makefile])
96+
msgpack.pc
97+
src/Makefile
98+
test/Makefile])

include/msgpack/adaptor/check_container_size.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ inline void check_container_size(std::size_t size) {
4444
}
4545

4646
template <>
47-
inline void check_container_size<4>(std::size_t size) {
47+
inline void check_container_size<4>(std::size_t /*size*/) {
4848
}
4949

5050
} // namespace detail

include/msgpack/adaptor/vector.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ struct object_with_zone<std::vector<T> > {
8080
o.via.array.size = size;
8181
typename std::vector<T>::const_iterator it(v.begin());
8282
do {
83+
#if defined(__GNUC__) && !defined(__clang__)
84+
#pragma GCC diagnostic push
85+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
86+
#endif // defined(__GNUC__) && !defined(__clang__)
8387
*p = msgpack::object(*it, o.zone);
88+
#if defined(__GNUC__) && !defined(__clang__)
89+
#pragma GCC diagnostic pop
90+
#endif // defined(__GNUC__) && !defined(__clang__)
8491
++p;
8592
++it;
8693
} while(p < pend);

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ FOREACH (source_file ${check_PROGRAMS})
6161
)
6262
ADD_TEST (${source_file_we} ${source_file_we})
6363
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
64-
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3")
64+
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
6565
ENDIF ()
6666
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
6767
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")

0 commit comments

Comments
 (0)