diff --git a/common/Makefile.am b/common/Makefile.am index c14261b1e..956e9275b 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -5,7 +5,7 @@ lib_LTLIBRARIES = libswsscommon.la if DEBUG DBGFLAGS = -ggdb -DDEBUG else -DBGFLAGS = -g +DBGFLAGS = -g -DNDEBUG endif libswsscommon_la_SOURCES = \ diff --git a/common/ipprefix.h b/common/ipprefix.h index 73964b02b..5cfce0c9e 100644 --- a/common/ipprefix.h +++ b/common/ipprefix.h @@ -2,6 +2,7 @@ #define __IPPREFIX__ #include +#include #include "ipaddress.h" namespace swss { @@ -18,7 +19,7 @@ class IpPrefix return m_ip.isV4(); } - inline const IpAddress getIp() const + inline const IpAddress& getIp() const { return m_ip; } @@ -50,11 +51,11 @@ class IpPrefix ipa.ip_addr.ipv6_addr[mid] = 0xFF << left; memset(ipa.ip_addr.ipv6_addr, 0xFF, mid); memset(ipa.ip_addr.ipv6_addr + mid + 1, 0, 16 - mid - 1); - return ipa; + return IpAddress(ipa); } default: { - assert(false); + throw std::logic_error("Invalid family"); } } } diff --git a/tests/Makefile.am b/tests/Makefile.am index 78eae89e8..a5cad5975 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,7 +5,7 @@ bin_PROGRAMS = tests if DEBUG DBGFLAGS = -ggdb -DDEBUG else -DBGFLAGS = -g +DBGFLAGS = -g -DNDEBUG endif CFLAGS_GTEST = -I $(top_srcdir)/googletest/googletest/include