Browse Source

[2673] Modifications to avoid clang warnings and errors in DHCP code

Stephen Morris 12 years ago
parent
commit
20f1346962

+ 4 - 0
src/bin/dhcp4/Makefile.am

@@ -5,6 +5,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 AM_CXXFLAGS = $(B10_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
 if USE_STATIC_LINK
 AM_LDFLAGS = -static
 AM_LDFLAGS = -static

+ 2 - 2
src/bin/dhcp4/config_parser.cc

@@ -967,13 +967,13 @@ public:
         return (new OptionDataListParser(param_name));
         return (new OptionDataListParser(param_name));
     }
     }
 
 
+    /// Pointer to options instances storage.
+    OptionStorage* options_;
     /// Intermediate option storage. This storage is used by
     /// Intermediate option storage. This storage is used by
     /// lower level parsers to add new options.  Values held
     /// lower level parsers to add new options.  Values held
     /// in this storage are assigned to main storage (options_)
     /// in this storage are assigned to main storage (options_)
     /// if overall parsing was successful.
     /// if overall parsing was successful.
     OptionStorage local_options_;
     OptionStorage local_options_;
-    /// Pointer to options instances storage.
-    OptionStorage* options_;
     /// Collection of parsers;
     /// Collection of parsers;
     ParserCollection parsers_;
     ParserCollection parsers_;
 };
 };

+ 15 - 0
src/bin/dhcp4/dhcp4_srv.cc

@@ -42,6 +42,18 @@ using namespace isc::dhcp;
 using namespace isc::log;
 using namespace isc::log;
 using namespace std;
 using namespace std;
 
 
+namespace isc {
+namespace dhcp {
+
+/// @brief file name of a server-id file
+///
+/// Server must store its server identifier in persistent storage that must not
+/// change between restarts. This is name of the file that is created in dataDir
+/// (see isc::dhcp::CfgMgr::getDataDir()). It is a text file that uses
+/// regular IPv4 address, e.g. 192.0.2.1. Server will create it during
+/// first run and then use it afterwards.
+static const char* SERVER_ID_FILE = "b10-dhcp4-serverid";
+
 // These are hardcoded parameters. Currently this is a skeleton server that only
 // These are hardcoded parameters. Currently this is a skeleton server that only
 // grants those options and a single, fixed, hardcoded lease.
 // grants those options and a single, fixed, hardcoded lease.
 
 
@@ -717,3 +729,6 @@ Dhcpv4Srv::sanityCheck(const Pkt4Ptr& pkt, RequirementLevel serverid) {
         ;
         ;
     }
     }
 }
 }
+
+}   // namespace dhcp
+}   // namespace isc

+ 0 - 9
src/bin/dhcp4/dhcp4_srv.h

@@ -28,15 +28,6 @@
 namespace isc {
 namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
-/// @brief file name of a server-id file
-///
-/// Server must store its server identifier in persistent storage that must not
-/// change between restarts. This is name of the file that is created in dataDir
-/// (see isc::dhcp::CfgMgr::getDataDir()). It is a text file that uses
-/// regular IPv4 address, e.g. 192.0.2.1. Server will create it during
-/// first run and then use it afterwards.
-static const char* SERVER_ID_FILE = "b10-dhcp4-serverid";
-
 /// @brief DHCPv4 server service.
 /// @brief DHCPv4 server service.
 ///
 ///
 /// This singleton class represents DHCPv4 server. It contains all
 /// This singleton class represents DHCPv4 server. It contains all

+ 4 - 0
src/bin/dhcp4/tests/Makefile.am

@@ -34,6 +34,10 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
 CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
 CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
 
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 AM_CXXFLAGS = $(B10_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
 if USE_STATIC_LINK
 AM_LDFLAGS = -static
 AM_LDFLAGS = -static

+ 4 - 0
src/bin/dhcp6/Makefile.am

@@ -6,6 +6,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/lib/cc -I$(top_builddir)/src/lib/cc
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 AM_CXXFLAGS = $(B10_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
 if USE_STATIC_LINK
 AM_LDFLAGS = -static
 AM_LDFLAGS = -static

+ 2 - 2
src/bin/dhcp6/config_parser.cc

@@ -996,13 +996,13 @@ public:
         return (new OptionDataListParser(param_name));
         return (new OptionDataListParser(param_name));
     }
     }
 
 
+    /// Pointer to options instances storage.
+    OptionStorage* options_;
     /// Intermediate option storage. This storage is used by
     /// Intermediate option storage. This storage is used by
     /// lower level parsers to add new options.  Values held
     /// lower level parsers to add new options.  Values held
     /// in this storage are assigned to main storage (options_)
     /// in this storage are assigned to main storage (options_)
     /// if overall parsing was successful.
     /// if overall parsing was successful.
     OptionStorage local_options_;
     OptionStorage local_options_;
-    /// Pointer to options instances storage.
-    OptionStorage* options_;
     /// Collection of parsers;
     /// Collection of parsers;
     ParserCollection parsers_;
     ParserCollection parsers_;
 };
 };

+ 10 - 0
src/bin/dhcp6/dhcp6_srv.cc

@@ -56,6 +56,16 @@ using namespace std;
 namespace isc {
 namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
+/// @brief file name of a server-id file
+///
+/// Server must store its duid in persistent storage that must not change
+/// between restarts. This is name of the file that is created in dataDir
+/// (see isc::dhcp::CfgMgr::getDataDir()). It is a text file that uses
+/// double digit hex values separated by colons format, e.g.
+/// 01:ff:02:03:06:80:90:ab:cd:ef. Server will create it during first
+/// run and then use it afterwards.
+static const char* SERVER_DUID_FILE = "b10-dhcp6-serverid";
+
 Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
 Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
     : alloc_engine_(), serverid_(), shutdown_(true) {
     : alloc_engine_(), serverid_(), shutdown_(true) {
 
 

+ 0 - 10
src/bin/dhcp6/dhcp6_srv.h

@@ -31,16 +31,6 @@
 namespace isc {
 namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
-/// @brief file name of a server-id file
-///
-/// Server must store its duid in persistent storage that must not change
-/// between restarts. This is name of the file that is created in dataDir
-/// (see isc::dhcp::CfgMgr::getDataDir()). It is a text file that uses
-/// double digit hex values separated by colons format, e.g.
-/// 01:ff:02:03:06:80:90:ab:cd:ef. Server will create it during first
-/// run and then use it afterwards.
-static const char* SERVER_DUID_FILE = "b10-dhcp6-serverid";
-
 /// @brief DHCPv6 server service.
 /// @brief DHCPv6 server service.
 ///
 ///
 /// This class represents DHCPv6 server. It contains all
 /// This class represents DHCPv6 server. It contains all

+ 4 - 0
src/bin/dhcp6/tests/Makefile.am

@@ -30,6 +30,10 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
 CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
 CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
 
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 AM_CXXFLAGS = $(B10_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
 if USE_STATIC_LINK
 AM_LDFLAGS = -static
 AM_LDFLAGS = -static

+ 1 - 1
src/bin/dhcp6/tests/config_parser_unittest.cc

@@ -277,9 +277,9 @@ public:
                             expected_data_len));
                             expected_data_len));
     }
     }
 
 
+    int rcode_;
     Dhcpv6Srv srv_;
     Dhcpv6Srv srv_;
 
 
-    int rcode_;
     ConstElementPtr comment_;
     ConstElementPtr comment_;
 
 
     string valid_iface_;
     string valid_iface_;