diff --git a/INSTALL b/INSTALL index 9ff786775e..7f27ad2093 100644 --- a/INSTALL +++ b/INSTALL @@ -5,9 +5,11 @@ To then build from source: ./configure make -For detailed installation directions, see the guide -at doc/guide/kea-guide.txt or doc/guide/kea-guide.html. +Kea depends on C++ compiler, make, libtool, boost (at least includes, but many +OSes require boost-system library), log4cplus and one crypto library (either +OpenSSL or Botan) for compilation. Optional backends (MySQL, PostgreSQL and +Cassandra) have additional dependencies. For detailed installation directions, +see the guide at doc/guide/kea-guide.txt or doc/guide/kea-guide.html. You can find user-contributed OS-specific build/installation -instructions on the Kea wiki: -http://kea.isc.org/wiki/SystemSpecificNotes +instructions on the Kea wiki: http://kea.isc.org/wiki/Install diff --git a/configure.ac b/configure.ac index 150fffc772..535201cf30 100755 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,7 @@ AC_LANG([C++]) AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes") AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"]) AC_CHECK_DECL([__clang__], [CLANGPP="yes"], [CLANGPP="no"]) +# USE_CLANGPP is no longer used, keep it by summetry with USE_GXX? AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes") dnl Determine if we are using GNU sed @@ -136,9 +137,9 @@ AC_DEFUN([KEA_CXX_TRY_FLAG], [ AC_MSG_CHECKING([whether $CXX supports $1]) kea_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $1" + CXXFLAGS="$CXXFLAGS -Werror $1" - AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])], + AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){ return 0;}])], [kea_cxx_flag=yes], [kea_cxx_flag=no]) CXXFLAGS="$kea_save_CXXFLAGS" @@ -169,16 +170,12 @@ fi # happen if clang++ is used via ccache. So, although probably suboptimal, # we suppress this particular warning. Note that it doesn't weaken checks # on the source code. -if test "$CLANGPP" = "yes"; then +if test "X$CLANGPP" = "Xyes"; then CXX_VERSION=`$CXX --version 2> /dev/null | head -1` KEA_CXXFLAGS="$KEA_CXXFLAGS -Qunused-arguments" fi -KEA_CXX_TRY_FLAG([-Wno-missing-field-initializers], - [WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG="-Wno-missing-field-initializers"]) -AC_SUBST(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - -# gcc specific settings: +# gcc/clang specific settings: if test "X$GXX" = "Xyes"; then CXX_VERSION=`$CXX --version 2> /dev/null | head -1` KEA_CXXFLAGS="$KEA_CXXFLAGS -Wall -Wextra -Wnon-virtual-dtor -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare" @@ -206,13 +203,15 @@ esac KEA_CXXFLAGS="$KEA_CXXFLAGS $MULTITHREADING_FLAG" # Don't use -Werror if configured not to +werror_extras= AC_ARG_WITH(werror, AC_HELP_STRING([--with-werror], [Compile using -Werror (default=yes)]), [ case "${withval}" in yes) with_werror=1 ;; no) with_werror=0 ;; - *) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;; + -*) with_werror=1; werror_extras=${withval} ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;; esac], [with_werror=1]) @@ -236,6 +235,30 @@ if test $with_werror = 1; then CXXFLAGS="$CXXFLAGS_SAVED" fi +# Added flags after -Werror + +# Some versions of GCC warn about some versions of Boost regarding +# missing initializer for members in its posix_time. +# https://svn.boost.org/trac/boost/ticket/3477 +# But older GCC compilers don't have the flag. +KEA_CXX_TRY_FLAG([-Wno-missing-field-initializers], + [KEA_CXXFLAGS="$KEA_CXXFLAGS -Wno-missing-field-initializers"]) + +if test "X$CLANGPP" = "Xyes"; then + # This is to workaround unused variables tcout and tcerr in + # log4cplus's streams.h and unused parameters from some of the + # Boost headers. + KEA_CXXFLAGS="$KEA_CXXFLAGS -Wno-unused-variable -Wno-unused-parameter" +fi + +# Add the extras at the very last +# Note it can be used to re-enable a (fatal) warning +for extra in $werror_extras; do + KEA_CXX_TRY_FLAG([$extra], + [KEA_CXXFLAGS="$KEA_CXXFLAGS $extra"], + [AC_MSG_ERROR([$CXX does not support $extra"])]) +done + fi dnl GXX = yes # allow building programs with static link. we need to make it selective @@ -1114,7 +1137,7 @@ LIBS=$LIBS_SAVED AX_BOOST_FOR_KEA # Boost offset_ptr is required in one library and not optional right now, so # we unconditionally fail here if it doesn't work. -if test "$BOOST_OFFSET_PTR_WOULDFAIL" = "yes" -a "$werror_ok" = 1; then +if test "$BOOST_OFFSET_PTR_WOULDFAIL" = "yes" -a X"$werror_ok" = X1; then AC_MSG_ERROR([Failed to compile a required header file. Try upgrading Boost to 1.44 or higher (when using clang++) or specifying --without-werror. See the ChangeLog entry for Trac no. 2147 for more details.]) fi diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index df266ad4a1..0b4e7d5862 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -14,10 +14,6 @@ AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index 6c5dbe4866..dc18d81d5e 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -29,10 +29,6 @@ CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile DISTCLEANFILES = d2_process_tests.sh AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index 24e2e95d3f..8360677861 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -15,10 +15,6 @@ AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index ffbf3a3d8d..9f658e14fc 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -32,10 +32,6 @@ CLEANFILES += *.json *.log DISTCLEANFILES = dhcp4_process_tests.sh AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index c69e99406c..47155aecf5 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -15,10 +15,6 @@ AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 3573b4ad63..a85119cc9a 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -33,10 +33,6 @@ CLEANFILES += *.json *.log DISTCLEANFILES = dhcp6_process_tests.sh AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index 9cdd5bae78..7bfeb96df7 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -3,12 +3,7 @@ SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += $(BOOST_INCLUDES) - AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 208f970520..ee20ebf94b 100644 --- a/src/bin/lfc/tests/Makefile.am +++ b/src/bin/lfc/tests/Makefile.am @@ -24,10 +24,6 @@ CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile DISTCLEANFILES = AM_CXXFLAGS = $(KEA_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some Boost headers when compiling with clang -AM_CXXFLAGS += -Wno-unused-parameter -endif if USE_STATIC_LINK AM_LDFLAGS = -static diff --git a/src/bin/perfdhcp/Makefile.am b/src/bin/perfdhcp/Makefile.am index bf6d1887b0..74d2975bab 100644 --- a/src/bin/perfdhcp/Makefile.am +++ b/src/bin/perfdhcp/Makefile.am @@ -6,12 +6,6 @@ AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - AM_LDFLAGS = -lm if USE_STATIC_LINK AM_LDFLAGS += -static @@ -32,16 +26,8 @@ libperfdhcp_la_SOURCES += rate_control.cc rate_control.h libperfdhcp_la_SOURCES += stats_mgr.h libperfdhcp_la_SOURCES += test_control.cc test_control.h -libperfdhcp_la_CXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libperfdhcp_la_CXXFLAGS += -Wno-unused-parameter -endif - sbin_PROGRAMS = perfdhcp perfdhcp_SOURCES = main.cc -libkea_perfdhcp___la_CXXFLAGS = $(AM_CXXFLAGS) perfdhcp_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) diff --git a/src/bin/perfdhcp/tests/Makefile.am b/src/bin/perfdhcp/tests/Makefile.am index ab0a914fa3..b41141ac6d 100644 --- a/src/bin/perfdhcp/tests/Makefile.am +++ b/src/bin/perfdhcp/tests/Makefile.am @@ -35,12 +35,6 @@ run_unittests_SOURCES += command_options_helper.h run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) run_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -run_unittests_CXXFLAGS = -Wno-unused-parameter -endif - run_unittests_LDADD = $(top_builddir)/src/bin/perfdhcp/libperfdhcp.la run_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la diff --git a/src/bin/perfdhcp/tests/rate_control_unittest.cc b/src/bin/perfdhcp/tests/rate_control_unittest.cc index d2824a2729..cf2e0f6e30 100644 --- a/src/bin/perfdhcp/tests/rate_control_unittest.cc +++ b/src/bin/perfdhcp/tests/rate_control_unittest.cc @@ -138,7 +138,7 @@ TEST(RateControl, getOutboundMessageCount) { // when the calcuation is made may be different from the interval set.) The // margin in this test is reasonably generous, allowing for a timing error // of around 10ms. - uint64_t count; + uint64_t count = 0; ASSERT_NO_THROW(count = rc1.getOutboundMessageCount()); EXPECT_TRUE((count >= 5240) && (count <= 5260)) << "count is " << count << ", expected range 5240-5260"; diff --git a/src/bin/perfdhcp/tests/test_control_unittest.cc b/src/bin/perfdhcp/tests/test_control_unittest.cc index c125d3383b..6473bdbea1 100644 --- a/src/bin/perfdhcp/tests/test_control_unittest.cc +++ b/src/bin/perfdhcp/tests/test_control_unittest.cc @@ -90,6 +90,8 @@ public: void setRelativeDueTimes(const int send_secs, const int renew_secs = 0, const int release_secs = 0) { ptime now = microsec_clock::universal_time(); + // Use now to avoid unused but set warning + ASSERT_FALSE(now.is_special()); basic_rate_control_.setRelativeDue(send_secs); renew_rate_control_.setRelativeDue(renew_secs); release_rate_control_.setRelativeDue(release_secs); diff --git a/src/hooks/dhcp/user_chk/Makefile.am b/src/hooks/dhcp/user_chk/Makefile.am index 3636a0bebb..41ad7b2e3c 100644 --- a/src/hooks/dhcp/user_chk/Makefile.am +++ b/src/hooks/dhcp/user_chk/Makefile.am @@ -4,12 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - # Define rule to build logging source files from message file user_chk_messages.h user_chk_messages.cc: s-messages s-messages: user_chk_messages.mes @@ -48,11 +42,6 @@ nodist_libduc_la_SOURCES = user_chk_messages.cc user_chk_messages.h libduc_la_CXXFLAGS = $(AM_CXXFLAGS) libduc_la_CPPFLAGS = $(AM_CPPFLAGS) -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libduc_la_CXXFLAGS += -Wno-unused-parameter -endif noinst_LTLIBRARIES += libdhcp_user_chk.la diff --git a/src/hooks/dhcp/user_chk/tests/Makefile.am b/src/hooks/dhcp/user_chk/tests/Makefile.am index 145e3b1179..fe1960d745 100644 --- a/src/hooks/dhcp/user_chk/tests/Makefile.am +++ b/src/hooks/dhcp/user_chk/tests/Makefile.am @@ -8,12 +8,6 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - USER_CHK_LIB = $(top_builddir)/src/hooks/dhcp/user_chk/libdhcp_user_chk.la if USE_STATIC_LINK @@ -44,12 +38,6 @@ libdhcp_user_chk_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPL libdhcp_user_chk_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) libdhcp_user_chk_unittests_CXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# This is to workaround unused variables tcout and tcerr in -# log4cplus's streams.h and unused parameters from some of the -# Boost headers. -libdhcp_user_chk_unittests_CXXFLAGS += -Wno-unused-parameter -endif libdhcp_user_chk_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/user_chk/libduc.la libdhcp_user_chk_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la diff --git a/src/lib/asiolink/tests/Makefile.am b/src/lib/asiolink/tests/Makefile.am index c3be47f887..6e5592a566 100644 --- a/src/lib/asiolink/tests/Makefile.am +++ b/src/lib/asiolink/tests/Makefile.am @@ -8,12 +8,6 @@ if USE_STATIC_LINK AM_LDFLAGS = -static endif -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - CLEANFILES = *.gcno *.gcda TESTS_ENVIRONMENT = \ diff --git a/src/lib/dhcp/Makefile.am b/src/lib/dhcp/Makefile.am index 72c4083545..ccdb74b2ab 100644 --- a/src/lib/dhcp/Makefile.am +++ b/src/lib/dhcp/Makefile.am @@ -4,12 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - CLEANFILES = *.gcno *.gcda lib_LTLIBRARIES = libkea-dhcp++.la @@ -113,9 +107,3 @@ libkea_dhcp___include_HEADERS = \ pkt_filter_lpf.h \ protocol_util.h \ std_option_defs.h - -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libkea_dhcp___la_CXXFLAGS += -Wno-unused-parameter -endif diff --git a/src/lib/dhcp/tests/Makefile.am b/src/lib/dhcp/tests/Makefile.am index 05928bd7e6..c0c584e712 100644 --- a/src/lib/dhcp/tests/Makefile.am +++ b/src/lib/dhcp/tests/Makefile.am @@ -7,12 +7,6 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - if USE_STATIC_LINK AM_LDFLAGS = -static endif @@ -102,12 +96,6 @@ libdhcp___unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) libdhcp___unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) libdhcp___unittests_CXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# This is to workaround unused variables tcout and tcerr in -# log4cplus's streams.h and unused parameters from some of the -# Boost headers. -libdhcp___unittests_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -endif libdhcp___unittests_LDADD = $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la libdhcp___unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la diff --git a/src/lib/dhcp_ddns/Makefile.am b/src/lib/dhcp_ddns/Makefile.am index e229943f63..b909bd50b8 100644 --- a/src/lib/dhcp_ddns/Makefile.am +++ b/src/lib/dhcp_ddns/Makefile.am @@ -4,13 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - - # Define rule to build logging source files from message file dhcp_ddns_messages.h dhcp_ddns_messages.cc: s-messages @@ -54,12 +47,4 @@ libkea_dhcp_ddns_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la libkea_dhcp_ddns_la_LIBADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la libkea_dhcp_ddns_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la libkea_dhcp_ddns_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la - libkea_dhcp_ddns_la_LIBADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) - -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libkea_dhcp_ddns_la_CXXFLAGS += -Wno-unused-parameter -endif - diff --git a/src/lib/dhcp_ddns/tests/Makefile.am b/src/lib/dhcp_ddns/tests/Makefile.am index 8a0731de31..b0538f5564 100644 --- a/src/lib/dhcp_ddns/tests/Makefile.am +++ b/src/lib/dhcp_ddns/tests/Makefile.am @@ -7,12 +7,6 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - if USE_STATIC_LINK AM_LDFLAGS = -static endif @@ -33,15 +27,9 @@ libdhcp_ddns_unittests_SOURCES += test_utils.cc test_utils.h libdhcp_ddns_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) -libdhcp_ddns_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) - libdhcp_ddns_unittests_CXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# This is to workaround unused variables tcout and tcerr in -# log4cplus's streams.h and unused parameters from some of the -# Boost headers. -libdhcp_ddns_unittests_CXXFLAGS += -Wno-unused-parameter -endif + +libdhcp_ddns_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) libdhcp_ddns_unittests_LDADD = $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la libdhcp_ddns_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 362169052d..70b1152954 100755 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -67,12 +67,6 @@ BUILT_SOURCES = alloc_engine_messages.h alloc_engine_messages.cc BUILT_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc BUILT_SOURCES += hosts_messages.h hosts_messages.cc -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - # Make sure the generated files are deleted in a "clean" operation CLEANFILES = *.gcno *.gcda CLEANFILES += alloc_engine_messages.h alloc_engine_messages.cc @@ -208,12 +202,6 @@ if HAVE_CQL libkea_dhcpsrv_la_LDFLAGS += $(CQL_LIBS) endif -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libkea_dhcpsrv_la_CXXFLAGS += -Wno-unused-parameter -endif - # The message file should be in the distribution EXTRA_DIST += alloc_engine_messages.mes EXTRA_DIST += dhcpsrv_messages.mes diff --git a/src/lib/dhcpsrv/database_backends.dox b/src/lib/dhcpsrv/database_backends.dox index 3364e04ceb..104318ece2 100644 --- a/src/lib/dhcpsrv/database_backends.dox +++ b/src/lib/dhcpsrv/database_backends.dox @@ -194,6 +194,18 @@ host all all 127.0.0.1/32 password host all all ::1/128 password @endverbatim + Another possible problem is to get no password prompt, in general because + you have no pg_hba.conf config file and everybody is by default + trusted. As it has a very bad effect on the security you should have + been warned it is a highly unsafe config. The solution is the same, + i.e., require password or md5 authentication method. If you lose + the postgres user access you can add first: +@verbatim +local all postgres trust +@endverbatim + to trust only the local postgres user. Note the postgres user can + be pgsql on some systems. + Please consult your PostgreSQL user manual before applying those changes as those changes may expose your other databases that you run on the same system. In general case, it is a poor idea to run anything of value on a system diff --git a/src/lib/dhcpsrv/tests/Makefile.am b/src/lib/dhcpsrv/tests/Makefile.am index aea9898f7c..2d65439e4d 100755 --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@ -14,12 +14,6 @@ if USE_STATIC_LINK AM_LDFLAGS = -static endif -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - CLEANFILES = *.gcno *.gcda TESTS_ENVIRONMENT = \ @@ -144,6 +138,8 @@ if HAVE_CQL libdhcpsrv_unittests_CPPFLAGS += $(CQL_CPPFLAGS) endif +libdhcpsrv_unittests_CXXFLAGS = $(AM_CXXFLAGS) + libdhcpsrv_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) if HAVE_MYSQL libdhcpsrv_unittests_LDFLAGS += $(MYSQL_LIBS) @@ -155,14 +151,6 @@ if HAVE_CQL libdhcpsrv_unittests_LDFLAGS += $(CQL_LIBS) endif -libdhcpsrv_unittests_CXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# This is to workaround unused variables tcout and tcerr in -# log4cplus's streams.h and unused parameters from some of the -# Boost headers. -libdhcpsrv_unittests_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -endif - libdhcpsrv_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la diff --git a/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc b/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc index 214e90da8e..55fc9ed6bd 100644 --- a/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc +++ b/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc @@ -25,8 +25,7 @@ namespace { const uint8_t HWADDR0[] = { 0, 1, 2, 3, 4, 5 }; const uint8_t HWADDR1[] = { 0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf }; -const uint8_t CLIENTID0[] = { 1, 2, 3, 4 }; -const uint8_t CLIENTID1[] = { 0xa, 0xb, 0xc, 0xd }; +const uint8_t CLIENTID[] = { 1, 2, 3, 4 }; /// @brief Test fixture class for @c CSVLeaseFile4 validation. class CSVLeaseFile4Test : public ::testing::Test { @@ -219,7 +218,7 @@ TEST_F(CSVLeaseFile4Test, recreate) { // Create second lease, with non-NULL client id. lease.reset(new Lease4(IOAddress("192.0.3.10"), hwaddr1_, - CLIENTID0, sizeof(CLIENTID0), + CLIENTID, sizeof(CLIENTID), 100, 60, 90, 0, 7)); { SCOPED_TRACE("Second write"); diff --git a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc index 05a6a43810..11ed6afe23 100644 --- a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc @@ -32,7 +32,7 @@ namespace { /// @brief Holds a type of the last identifier in @c IdentifierType enum. /// /// This value must be updated when new identifiers are added to the enum. -const Host::IdentifierType LAST_IDENTIFIER_TYPE = Host::IDENT_CIRCUIT_ID; +// const Host::IdentifierType LAST_IDENTIFIER_TYPE = Host::IDENT_CIRCUIT_ID; /// @brief Test fixture class for @c HostReservationParser. class HostReservationParserTest : public ::testing::Test { diff --git a/src/lib/dhcpsrv/tests/lease_unittest.cc b/src/lib/dhcpsrv/tests/lease_unittest.cc index 3604033756..979b965326 100644 --- a/src/lib/dhcpsrv/tests/lease_unittest.cc +++ b/src/lib/dhcpsrv/tests/lease_unittest.cc @@ -70,10 +70,6 @@ TEST_F(Lease4Test, constructor) { // Get current time for the use in Lease. const time_t current_time = time(NULL); - // Other random constants. - const uint32_t SUBNET_ID = 42; - const uint32_t VALID_LIFETIME = 500; - // We want to check that various addresses work, so let's iterate over // these. const uint32_t ADDRESS[] = { @@ -108,10 +104,6 @@ TEST_F(Lease4Test, copyConstructor) { // Get current time for the use in Lease4. const time_t current_time = time(NULL); - // Other random constants. - const uint32_t SUBNET_ID = 42; - const uint32_t VALID_LIFETIME = 500; - // Create the lease Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time, SUBNET_ID); @@ -149,10 +141,6 @@ TEST_F(Lease4Test, operatorAssign) { // Get the current time for the use in Lease4. const time_t current_time = time(NULL); - // Other random constants. - const uint32_t SUBNET_ID = 42; - const uint32_t VALID_LIFETIME = 500; - // Create the lease Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time, SUBNET_ID); @@ -257,8 +245,6 @@ TEST_F(Lease4Test, operatorEquals) { // Random values for the tests const uint32_t ADDRESS = 0x01020304; const time_t current_time = time(NULL); - const uint32_t SUBNET_ID = 42; - const uint32_t VALID_LIFETIME = 500; // Check when the leases are equal. Lease4 lease1(ADDRESS, hwaddr_, clientid_, VALID_LIFETIME, current_time, 0, @@ -504,7 +490,7 @@ TEST(Lease6Test, Lease6ConstructorDefault) { // Other values uint8_t llt[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; DuidPtr duid(new DUID(llt, sizeof(llt))); - uint32_t iaid = 7; // Just a number + uint32_t iaid = IAID; // Just a number SubnetID subnet_id = 8; // Just another number for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) { @@ -551,7 +537,7 @@ TEST(Lease6Test, Lease6ConstructorWithFQDN) { // Other values uint8_t llt[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; DuidPtr duid(new DUID(llt, sizeof(llt))); - uint32_t iaid = 7; // Just a number + uint32_t iaid = IAID; // Just a number SubnetID subnet_id = 8; // Just another number for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) { @@ -593,7 +579,7 @@ TEST(Lease6Test, operatorEquals) { const IOAddress addr("2001:db8:1::456"); uint8_t duid_array[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; DuidPtr duid(new DUID(duid_array, sizeof(duid_array))); - uint32_t iaid = 7; // just a number + uint32_t iaid = IAID; // just a number SubnetID subnet_id = 8; // just another number // Check for equality. @@ -723,7 +709,7 @@ TEST(Lease6Test, Lease6Expired) { const IOAddress addr("2001:db8:1::456"); const uint8_t duid_array[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; const DuidPtr duid(new DUID(duid_array, sizeof(duid_array))); - const uint32_t iaid = 7; // Just a number + const uint32_t iaid = IAID; // Just a number const SubnetID subnet_id = 8; // Just another number Lease6 lease(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50, 80, subnet_id); diff --git a/src/lib/eval/Makefile.am b/src/lib/eval/Makefile.am index e3d56421dd..2c8dd8ccd7 100644 --- a/src/lib/eval/Makefile.am +++ b/src/lib/eval/Makefile.am @@ -4,12 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - # GCC 4.4 emits warning about breaking strict aliasing rule. # This warning is a result of a GCC bug: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874 diff --git a/src/lib/eval/tests/Makefile.am b/src/lib/eval/tests/Makefile.am index a492686eff..f3a882efde 100644 --- a/src/lib/eval/tests/Makefile.am +++ b/src/lib/eval/tests/Makefile.am @@ -6,12 +6,6 @@ AM_CPPFLAGS += -DLOGGING_SPEC_FILE=\"$(abs_top_srcdir)/src/lib/dhcpsrv/logging.s AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - if USE_STATIC_LINK AM_LDFLAGS = -static endif @@ -46,14 +40,6 @@ libeval_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exception libeval_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la libeval_unittests_LDADD += $(CRYPTO_LIBS) $(LOG4CPLUS_LIBS) libeval_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD) - -if USE_CLANGPP -# This is to workaround unused variables tcout and tcerr in -# log4cplus's streams.h and unused parameters from some of the -# Boost headers. -libeval_unittests_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -endif - endif noinst_PROGRAMS = $(TESTS) diff --git a/src/lib/hooks/Makefile.am b/src/lib/hooks/Makefile.am index 01f1d4565f..de4c5d6635 100644 --- a/src/lib/hooks/Makefile.am +++ b/src/lib/hooks/Makefile.am @@ -4,13 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) - - # Define rule to build logging source files from message file hooks_messages.h hooks_messages.cc: s-messages @@ -74,9 +67,3 @@ libkea_hooks_include_HEADERS = \ library_handle.h \ hooks.h \ server_hooks.h - -if USE_CLANGPP -# Disable unused parameter warning caused by some of the -# Boost headers when compiling with clang. -libkea_hooks_la_CXXFLAGS += -Wno-unused-parameter -endif diff --git a/src/lib/hooks/tests/Makefile.am b/src/lib/hooks/tests/Makefile.am index 22b2a224e7..d9016a6565 100644 --- a/src/lib/hooks/tests/Makefile.am +++ b/src/lib/hooks/tests/Makefile.am @@ -4,11 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CXXFLAGS = $(KEA_CXXFLAGS) -# Some versions of GCC warn about some versions of Boost regarding -# missing initializer for members in its posix_time. -# https://svn.boost.org/trac/boost/ticket/3477 -# But older GCC compilers don't have the flag. -AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG) # Kea libraries against which the test user libraries are linked. HOOKS_LIB = $(top_builddir)/src/lib/hooks/libkea-hooks.la @@ -19,11 +14,6 @@ EXCEPTIONS_LIB = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la ALL_LIBS = $(HOOKS_LIB) $(LOG_LIB) $(THREADS_LIB) $(UTIL_LIB) $(EXCEPTIONS_LIB) $(LOG4CPLUS_LIBS) -if USE_CLANGPP -# see ../Makefile.am -AM_CXXFLAGS += -Wno-unused-parameter -endif - # Files to clean include the file created by testing. CLEANFILES = *.gcno *.gcda $(builddir)/marker_file.dat diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am index d50e8fa9d8..03806f987e 100644 --- a/src/lib/log/tests/Makefile.am +++ b/src/lib/log/tests/Makefile.am @@ -71,10 +71,6 @@ TESTS = # Define the flags used in each set of tests TESTSCXXFLAGS = $(AM_CXXFLAGS) -if USE_CLANGPP -# Workaround unused variables tcout and tcerr in log4cplus's streams.h. -TESTSCXXFLAGS += -Wno-unused-variable -endif TESTSCPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) TESTSLDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)