Update SENF to compile using g++ 4.3.2 (Ubuntu 8.10)
g0dil [Tue, 4 Nov 2008 16:20:33 +0000 (16:20 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@945 270642c3-0616-0410-b53a-bc976706d245

24 files changed:
Examples/Sniffer/Sniffer.cc
PPI/IntervalTimer.test.cc
Packets/Packet.test.cc
Scheduler/ClockService.test.cc
Scheduler/Console/Config.test.cc
Scheduler/Console/Parse.ih
Scheduler/Console/ProgramOptions.cc
Scheduler/Console/ProgramOptions.cci
Scheduler/Console/ProgramOptions.hh
Scheduler/Console/ProgramOptions.ih
Scheduler/Console/ProgramOptions.test.cc
Scheduler/Console/Server.cc
Scheduler/Console/Server.hh
Scheduler/Console/Server.ih
Socket/ClientSocketHandle.hh
Socket/ProtocolServerSocketHandle.test.cc
Socket/Protocols/INet/INet6Address.cci
Socket/ServerSocketHandle.cti
Socket/ServerSocketHandle.hh
Socket/ServerSocketHandle.test.cc
Utils/Daemon/Daemon.test.cc
Utils/Logger/Config.ih
senfscons/BoostUnitTests.py
senfscons/SENFSCons.py

index 2582ad0..5c81dda 100644 (file)
@@ -114,11 +114,12 @@ int main(int argc, char const * argv[])
     std::cout << "Registered packets:\n\n";
     senf::dumpPacketRegistries(std::cout);
 
-    if (argc >= 3)
+    if (argc >= 3) {
         if (std::string(argv[1]) == "loop")
             return loop_main(argc,argv);
         else if (std::string(argv[1]) == "scheduler")
             return scheduler_main(argc,argv);
+    }
 
     std::cerr << "Usage: sniffer { loop | scheduler } [interface]" << std::endl;
     return 1;
index 3f5d92b..631915c 100644 (file)
@@ -65,7 +65,7 @@ namespace {
     };
 
     bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b,
-                        unsigned long delta = senf::ClockService::milliseconds(100))
+                        unsigned long delta)
     {
         return (a<b ? b-a : a-b ) < delta;
     }
@@ -78,7 +78,8 @@ BOOST_AUTO_UNIT_TEST(intervalTimer)
     senf::ppi::run();
     BOOST_CHECK_PREDICATE( is_close_clock,
                            (senf::ClockService::now())
-                           (start+senf::ClockService::milliseconds(400)) );
+                           (start+senf::ClockService::milliseconds(400))
+                           (senf::ClockService::milliseconds(100)) );
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
index dd8d173..e61d67a 100644 (file)
@@ -290,7 +290,7 @@ COMPILE_FAIL(invalidAnnotation)
 
 #   else
 
-    BOOST_STATIC_ASSERT(( false ));
+    invalid_annotation_check_disabled();
 
 #   endif
 }
index 182755b..8ffa717 100644 (file)
 namespace {
 
     bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b, 
-                        unsigned long delta = senf::ClockService::milliseconds(100))
-    {
-        return (a<b ? b-a : a-b ) < delta;
-    }
-
-    bool is_close_pt(boost::posix_time::ptime a, boost::posix_time::ptime b,
-                     boost::posix_time::time_duration delta = boost::posix_time::milliseconds(100) )
+                        unsigned long delta)
     {
         return (a<b ? b-a : a-b ) < delta;
     }
@@ -69,7 +63,8 @@ BOOST_AUTO_UNIT_TEST(clockService)
     senf::ClockService::clock_type t2 (senf::ClockService::now());
     BOOST_CHECK_PREDICATE( is_close_clock,
                            (t1 + senf::ClockService::milliseconds(200)) 
-                           (t2) );
+                           (t2)
+                           (senf::ClockService::milliseconds(100)) );
 
     t1 = t2;
 
@@ -87,14 +82,16 @@ BOOST_AUTO_UNIT_TEST(clockService)
     delay(200);
     BOOST_CHECK_PREDICATE( is_close_clock,
                            (t1 + senf::ClockService::milliseconds(200))
-                           (senf::ClockService::now()) );
+                           (senf::ClockService::now())
+                           (senf::ClockService::milliseconds(100)) );
 
     // The next check validates that the clock service itimer/heartbeat_ is correctly reset after a
     // clock-skew is detected
 
     BOOST_CHECK_PREDICATE( is_close_clock,
                            (t1 + senf::ClockService::milliseconds(200))
-                           (senf::ClockService::now()) );
+                           (senf::ClockService::now()) 
+                           (senf::ClockService::milliseconds(100)) );
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
index 8d55c84..f13457c 100644 (file)
@@ -77,7 +77,7 @@ BOOST_AUTO_UNIT_TEST(configBundle)
     TempFile cfg ("test.cfg");
     cfg << "dir1/fun1 foo; fun2;" << TempFile::close;
 
-    char * argv[] = { "", "--dir1-fun1=bar" };
+    char const * argv[] = { "", "--dir1-fun1=bar" };
 
     senf::console::ConfigBundle bundle(root);
     bundle.add( senf::console::FileConfig(cfg.name()) );
index 7816764..61c5cee 100644 (file)
@@ -120,8 +120,8 @@ namespace detail {
 
                 // Invalid characters: All chars below \x20 (space) which are not space_p
                 // (don't put a \0 in the chset<> argument *string* ...)
-                invalid_p (
-                    boost::spirit::chset<>('\0') | boost::spirit::chset<>("\x01-\x20") - space_p ),
+                invalid_p ( (boost::spirit::chset<>('\0') 
+                             | boost::spirit::chset<>("\x01-\x20")) - space_p ),
 
                 // Valid word characters
                 word_p (
index 6eb3107..9f14736 100644 (file)
@@ -49,7 +49,7 @@ prefix_ void senf::console::detail::ProgramOptionsSource::v_parse(RestrictedExec
         nonOptions_->clear();
     if (argc_ <= 1)
         return;
-    char ** argp (argv_+1);
+    char const ** argp (argv_+1);
     int n (argc_-1);
     for (; n; --n, ++argp) {
         std::string arg (*argp);
@@ -151,7 +151,7 @@ senf::console::detail::ProgramOptionsSource::parseNonOption(std::string const &
 
 ///////////////////////////////////////////////////////////////////////////
 
-prefix_ void senf::console::parseOptions(int argc, char ** argv, DirectoryNode & root)
+prefix_ void senf::console::parseOptions(int argc, char const ** argv, DirectoryNode & root)
 {
     ProgramOptions opts (argc, argv, root);
     opts.parse();
index 8896fa0..3949e38 100644 (file)
 // senf::console::detail::ProgramOptionsSource
 
 prefix_ senf::console::detail::ProgramOptionsSource::ptr
-senf::console::detail::ProgramOptionsSource::create(int argc, char ** argv)
+senf::console::detail::ProgramOptionsSource::create(int argc, char const ** argv)
 {
     return ptr(new ProgramOptionsSource(argc,argv));
 }
 
 prefix_ senf::console::detail::ProgramOptionsSource::ProgramOptionsSource(int argc,
-                                                                          char ** argv)
+                                                                          char const ** argv)
     : argc_ (argc), argv_ (argv)
 {}
 
@@ -63,7 +63,7 @@ ShortOption(bool withArg_, std::string const & longOpt_)
 ///////////////////////////////////////////////////////////////////////////
 // senf::console::ProgramOptions
 
-prefix_ senf::console::ProgramOptions::ProgramOptions(int argc, char ** argv,
+prefix_ senf::console::ProgramOptions::ProgramOptions(int argc, char const ** argv,
                                                       DirectoryNode & root)
     : detail::BundleMixin (root), config_ (add(detail::ProgramOptionsSource::create(argc, argv)))
 {}
@@ -78,7 +78,7 @@ senf::console::ProgramOptions::alias(char letter, std::string const & longOpt, b
 ///////////////////////////////////////////////////////////////////////////
 
 prefix_ senf::console::detail::ProgramOptionsSource::ptr
-senf::console::OptionsConfig(int argc, char ** argv)
+senf::console::OptionsConfig(int argc, char const ** argv)
 {
     return detail::ProgramOptionsSource::create(argc, argv);
 }
index 25fbb2e..d8f819e 100644 (file)
@@ -72,7 +72,7 @@ namespace console {
         ///\name Structors and default members
         ///@{
         
-        ProgramOptions(int argc, char ** argv, DirectoryNode & root = root());
+        ProgramOptions(int argc, char const ** argv, DirectoryNode & root = root());
                                         ///< Create ProgramOptions parser for given options
                                         /**< The given argc/argv values are those passed to main by
                                              the operating system. Especially argv[0] is \e not an
@@ -113,7 +113,7 @@ namespace console {
 
         \related ProgramOptions
      */
-    void parseOptions(int argc, char ** argv, DirectoryNode & root = root());
+    void parseOptions(int argc, char const ** argv, DirectoryNode & root = root());
 
     /** \brief ConfigBundle source reading command line options
 
@@ -122,7 +122,7 @@ namespace console {
 
         \related ProgramOptions
      */
-    detail::ProgramOptionsSource::ptr OptionsConfig(int argc, char ** argv);
+    detail::ProgramOptionsSource::ptr OptionsConfig(int argc, char const ** argv);
 }}
 
 ///////////////////////////////hh.e////////////////////////////////////////
index e02d174..d99d899 100644 (file)
@@ -43,14 +43,14 @@ namespace detail {
     public:
         typedef boost::intrusive_ptr<ProgramOptionsSource> ptr;
 
-        static ptr create(int argc, char ** argv);
+        static ptr create(int argc, char const ** argv);
 
         template <class Container>
         ProgramOptionsSource & nonOptions(Container & container);
         ProgramOptionsSource & alias(char letter, std::string const & longOpt, bool withArg=false);
         
     private:
-        ProgramOptionsSource(int argc, char ** argv);
+        ProgramOptionsSource(int argc, char const ** argv);
         
         virtual void v_parse(RestrictedExecutor & executor);
 
@@ -86,7 +86,7 @@ namespace detail {
         typedef std::map<char, ShortOption> ShortOptions;
         
         int argc_;
-        char ** argv_;
+        char const ** argv_;
         CommandParser parser_;
         ShortOptions shortOptions_;
         boost::scoped_ptr<NonOptionContainer> nonOptions_;
index cf1e12f..e8f9763 100644 (file)
@@ -58,7 +58,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     root.mkdir("name-with-dashes").add("fun-2", &fun2);
 
     {
-        char * argv[] = { "", "--dir1-fun1=foo","--fun2" };
+        char const * argv[] = { "", "--dir1-fun1=foo","--fun2" };
         senf::console::ProgramOptions opts (sizeof(argv)/sizeof(argv[0]), argv, root);
 
         SENF_CHECK_NO_THROW( opts.parse() );
@@ -67,7 +67,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     }
 
     {
-        char * argv[] = { "", "--d-f=foo","--fun" };
+        char const * argv[] = { "", "--d-f=foo","--fun" };
         senf::console::ProgramOptions opts (sizeof(argv)/sizeof(argv[0]), argv, root);
 
         val1 = "";
@@ -79,7 +79,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     }
 
     {
-        char * argv[] = { "", "--name-w-fun" };
+        char const * argv[] = { "", "--name-w-fun" };
         senf::console::ProgramOptions opts (sizeof(argv)/sizeof(argv[0]), argv, root);
 
         val1 = "";
@@ -91,7 +91,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     }
     
     {
-        char * argv[] = { "", "-ab" };
+        char const * argv[] = { "", "-ab" };
         senf::console::ProgramOptions opts(sizeof(argv)/sizeof(argv[0]), argv, root);
         opts
             .alias('a', "--dir1-fun1=baz")
@@ -106,7 +106,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     }
 
     {
-        char * argv[] = { "", "-badoo" };
+        char const * argv[] = { "", "-badoo" };
         senf::console::ProgramOptions opts(sizeof(argv)/sizeof(argv[0]), argv, root);
         opts
             .alias('a', "--dir1-fun1", true)
@@ -121,7 +121,7 @@ BOOST_AUTO_UNIT_TEST(programOptions)
     }
 
     {
-        char * argv[] = { "", "-a","dii","-b" };
+        char const * argv[] = { "", "-a","dii","-b" };
         senf::console::ProgramOptions opts(sizeof(argv)/sizeof(argv[0]), argv, root);
         opts
             .alias('a', "--dir1-fun1", true)
index ef885ba..04b54be 100644 (file)
@@ -99,7 +99,7 @@ prefix_ senf::console::Server::Server(ServerHandle handle)
 
 prefix_ void senf::console::Server::newClient(int event)
 {
-    ServerHandle::ClientSocketHandle client (handle_.accept());
+    ServerHandle::ClientHandle client (handle_.accept());
     boost::intrusive_ptr<Client> p (new Client(*this, client));
     clients_.insert( p );
     SENF_LOG(( "Registered new client " << p.get() ));
index 0f98094..7ccf284 100644 (file)
@@ -161,7 +161,7 @@ namespace console {
         static const unsigned INTERACTIVE_TIMEOUT = 500; // milliseconds;
 
     public:
-        typedef Server::ServerHandle::ClientSocketHandle ClientHandle;
+        typedef Server::ServerHandle::ClientHandle ClientHandle;
 
         ~Client();
 
index c65a88f..332512a 100644 (file)
@@ -98,7 +98,7 @@ namespace detail {
     class ClientReader
     {
     public:
-        typedef ServerHandle::ClientSocketHandle ClientHandle;
+        typedef ServerHandle::ClientHandle ClientHandle;
 
         virtual ~ClientReader() = 0;
 
index cb9868f..7495a69 100644 (file)
@@ -106,7 +106,7 @@ namespace senf {
         /** This class will probably only be usable, if the \c CommunicationPolicy is \c
             ConnectedCommunicationPolicy and the \c AddressingPolicy is not \c
             NoAddressingPolicy. */
-        typedef ServerSocketHandle<SPolicy> ServerSocketHandle;
+        typedef ServerSocketHandle<SPolicy> ServerHandle;
 
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
index 86d91e4..5ebde9a 100644 (file)
@@ -62,7 +62,7 @@ BOOST_AUTO_UNIT_TEST(protocolServerSocketHandle)
         OtherSocketHandle osh (h);
         h = senf::static_socket_cast<MySocketHandle>(osh);
 
-        MySocketHandle::ClientSocketHandle client = h.accept();
+        MySocketHandle::ClientHandle client = h.accept();
         BOOST_CHECK_EQUAL( client.fd(), -1 );
 
         BOOST_CHECK_EQUAL( h.dumpState(),
index b2d0e2a..61fa0c6 100644 (file)
@@ -127,7 +127,7 @@ prefix_ bool senf::INet6Address::inet4Mapped()
 prefix_ bool senf::INet6Address::multicast()
     const
 {
-    return (*this)[0] == 0xFFu || inet4Mapped() && inet4address().multicast();
+    return (*this)[0] == 0xFFu || (inet4Mapped() && inet4address().multicast());
 }
 
 prefix_ senf::INet6Address::ScopeId senf::INet6Address::scope()
index 3d91c90..4044b1e 100644 (file)
@@ -92,30 +92,30 @@ prefix_ void senf::ServerSocketHandle<SPolicy>::local(Address & addr)
 }
 
 template <class SPolicy>
-prefix_ typename senf::ServerSocketHandle<SPolicy>::ClientSocketHandle
+prefix_ typename senf::ServerSocketHandle<SPolicy>::ClientHandle
 senf::ServerSocketHandle<SPolicy>::accept()
 {
-    return ClientSocketHandle(this->body().clone(
-                                  SPolicy::CommunicationPolicy::accept(*this), false));
+    return ClientHandle(this->body().clone(
+                            SPolicy::CommunicationPolicy::accept(*this), false));
 }
 
 template <class SPolicy>
-prefix_ std::pair<typename senf::ServerSocketHandle<SPolicy>::ClientSocketHandle,
+prefix_ std::pair<typename senf::ServerSocketHandle<SPolicy>::ClientHandle,
                   typename senf::ServerSocketHandle<SPolicy>::Address>
 senf::ServerSocketHandle<SPolicy>::acceptfrom()
 {
 
     Address address;
-    ClientSocketHandle handle = acceptfrom(address);
+    ClientHandle handle = acceptfrom(address);
     return std::make_pair(handle,address);
 }
 
 template <class SPolicy>
-prefix_ typename senf::ServerSocketHandle<SPolicy>::ClientSocketHandle
+prefix_ typename senf::ServerSocketHandle<SPolicy>::ClientHandle
 senf::ServerSocketHandle<SPolicy>::acceptfrom(Address & addr)
 {
-    return ClientSocketHandle(this->protocol().clone(),
-                              SPolicy::CommunicationPolicy::accept(*this,addr));
+    return ClienttHandle(this->protocol().clone(),
+                         SPolicy::CommunicationPolicy::accept(*this,addr));
 }
 
 ///////////////////////////////////////////////////////////////////////////
index 837b454..819fb71 100644 (file)
@@ -90,7 +90,7 @@ namespace senf {
          */
         typedef typename boost::call_traits<Address>::param_type AddressParam;
         /// Corresponding client socket handle with the same policy
-        typedef ClientSocketHandle<SPolicy> ClientSocketHandle;
+        typedef ClientSocketHandle<SPolicy> ClientHandle;
 
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
@@ -171,17 +171,15 @@ namespace senf {
 
             \returns handle of new client connection
          */
-        ClientSocketHandle
-                     accept       ();
-        std::pair<ClientSocketHandle, Address>
+        ClientHandle accept       ();
+        std::pair<ClientHandle, Address>
                      acceptfrom   ();   ///< Accept new connection
                                         /**< This variant will additionally return the remote
                                            address of the client
                                            \returns \c std::pair with client handle and client
                                            address.
                                            \see \ref accept() */
-        ClientSocketHandle
-                     acceptfrom   (Address & addr);
+        ClientHandle acceptfrom   (Address & addr);
                                         ///< Accept new connection
                                         /**< This variant will additionally return the remote
                                            address of the client
index 0180144..18f9967 100644 (file)
@@ -84,7 +84,7 @@ BOOST_AUTO_UNIT_TEST(serverSocketHandle)
     BOOST_CHECK_EQUAL( myh.local(), 2u );
 
     {
-        MySocketHandle::ClientSocketHandle client = myh.accept();
+        MySocketHandle::ClientHandle client = myh.accept();
         BOOST_CHECK_EQUAL( client.fd(), -1 );
     }
 
index cdf74b8..d9e4a3e 100644 (file)
@@ -118,10 +118,11 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(testDaemon)
 {
-    char * args[] = { "run", 
-                      "--console-log=testDaemon.log", 
-                      "--pid-file=testDaemon.pid" };
-    BOOST_CHECK_EQUAL( run(sizeof(args)/sizeof(*args),args), 0 );
+    char const * args[] = { "run", 
+                            "--console-log=testDaemon.log", 
+                            "--pid-file=testDaemon.pid" };
+
+    BOOST_CHECK_EQUAL( run(sizeof(args)/sizeof(*args), const_cast<char **>(args)), 0 );
 
     BOOST_CHECK( ! boost::filesystem::exists("invalid.log") );
     BOOST_CHECK( ! boost::filesystem::exists("invalid.pid") );
index f2f6777..004368d 100644 (file)
@@ -33,6 +33,7 @@
 #include <boost/preprocessor/seq/fold_right.hpp>
 #include <boost/preprocessor/seq/pop_back.hpp>
 #include <boost/preprocessor/if.hpp>
+#include <boost/preprocessor/facilities/is_empty.hpp>
 #include "../preprocessor.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
@@ -74,7 +75,15 @@ namespace detail {
 
 }}}
 
-#define SENF_LOG_SEQ_TO_NAME_(s,state,elem) state::elem
+#define SENF_LOG_CHECK_NA_
+
+#define SENF_LOG_CAT(a,b) SENF_LOG_CAT_I(a,b)
+#define SENF_LOG_CAT_I(a,b) a ## b
+
+#define SENF_LOG_IS_NA(elt) BOOST_PP_IS_EMPTY( SENF_LOG_CAT(SENF_LOG_CHECK_NA, elt) )
+
+#define SENF_LOG_SEQ_TO_NAME_(s,state,elem)                                                       \
+    BOOST_PP_IF( SENF_LOG_IS_NA(elem), senf::log::detail::na, state::elem )
 
 #define SENF_LOG_SEQ_TO_NAME(seq)                                                                 \
     BOOST_PP_SEQ_FOLD_LEFT(SENF_LOG_SEQ_TO_NAME_, , seq)
@@ -88,7 +97,7 @@ namespace detail {
                              BOOST_PP_SEQ_POP_BACK(seq) )
 
 #define SENF_LOG_PREDECL_short(seq)                                                               \
-        class SENF_PP_SEQ_BACK(seq);
+   BOOST_PP_IF( SENF_LOG_IS_NA( SENF_PP_SEQ_BACK(seq) ), ; , class SENF_PP_SEQ_BACK(seq); )
 
 #define SENF_LOG_PREDECL(seq)                                                                     \
     BOOST_PP_CAT(SENF_LOG_PREDECL_,                                                               \
@@ -110,14 +119,12 @@ namespace detail {
 
 #ifdef SENF_LOG_CONF
 
-#   define _ senf::log::detail::na
 #   define SLC_elt(r, data, elt) \
         SENF_LOG_CONF_DEFINE elt
 
     BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF)
 
 #   undef SLC_elt
-#   undef _
 
 #endif
 
index f2516f3..1e28824 100644 (file)
@@ -33,7 +33,7 @@ def BoostUnitTests(env, target, objects, test_sources=None, LIBS = [], OBJECTS =
             test_sources = [ test_sources ]
     else:
         test_sources = []
-    testEnv = env.Copy(**kw)
+    testEnv = env.Clone(**kw)
     testEnv.Prepend(_LIBFLAGS = ' -Wl,-Bstatic -l$BOOSTTESTLIB -Wl,-Bdynamic ')
     testEnv.Prepend(LIBS = LIBS)
     testEnv.Append(LIBS = env['TEST_EXTRA_LIBS'])
index 15414fd..7f08d0b 100644 (file)
@@ -654,7 +654,7 @@ def Binary(env, binary, sources, testSources = None, LIBS = [], OBJECTS = [], no
     objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS)
     program = None
     if objects:
-        progEnv = env.Copy()
+        progEnv = env.Clone()
         progEnv.Prepend(LIBS = [ x + '$LIBADDSUFFIX' for x in LIBS ])
         program = progEnv.ProgramNoScan(target=binary,source=objects+OBJECTS)
         env.Default(program)