From: g0dil Date: Tue, 4 Nov 2008 16:20:33 +0000 (+0000) Subject: Update SENF to compile using g++ 4.3.2 (Ubuntu 8.10) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=55d09e34a5b9a9c7af23cc5ecb0ab79d58757a2d;p=senf.git Update SENF to compile using g++ 4.3.2 (Ubuntu 8.10) git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@945 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Examples/Sniffer/Sniffer.cc b/Examples/Sniffer/Sniffer.cc index 2582ad0..5c81dda 100644 --- a/Examples/Sniffer/Sniffer.cc +++ b/Examples/Sniffer/Sniffer.cc @@ -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; diff --git a/PPI/IntervalTimer.test.cc b/PPI/IntervalTimer.test.cc index 3f5d92b..631915c 100644 --- a/PPI/IntervalTimer.test.cc +++ b/PPI/IntervalTimer.test.cc @@ -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 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 ( diff --git a/Scheduler/Console/ProgramOptions.cc b/Scheduler/Console/ProgramOptions.cc index 6eb3107..9f14736 100644 --- a/Scheduler/Console/ProgramOptions.cc +++ b/Scheduler/Console/ProgramOptions.cc @@ -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(); diff --git a/Scheduler/Console/ProgramOptions.cci b/Scheduler/Console/ProgramOptions.cci index 8896fa0..3949e38 100644 --- a/Scheduler/Console/ProgramOptions.cci +++ b/Scheduler/Console/ProgramOptions.cci @@ -34,13 +34,13 @@ // 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); } diff --git a/Scheduler/Console/ProgramOptions.hh b/Scheduler/Console/ProgramOptions.hh index 25fbb2e..d8f819e 100644 --- a/Scheduler/Console/ProgramOptions.hh +++ b/Scheduler/Console/ProgramOptions.hh @@ -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//////////////////////////////////////// diff --git a/Scheduler/Console/ProgramOptions.ih b/Scheduler/Console/ProgramOptions.ih index e02d174..d99d899 100644 --- a/Scheduler/Console/ProgramOptions.ih +++ b/Scheduler/Console/ProgramOptions.ih @@ -43,14 +43,14 @@ namespace detail { public: typedef boost::intrusive_ptr ptr; - static ptr create(int argc, char ** argv); + static ptr create(int argc, char const ** argv); template 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 ShortOptions; int argc_; - char ** argv_; + char const ** argv_; CommandParser parser_; ShortOptions shortOptions_; boost::scoped_ptr nonOptions_; diff --git a/Scheduler/Console/ProgramOptions.test.cc b/Scheduler/Console/ProgramOptions.test.cc index cf1e12f..e8f9763 100644 --- a/Scheduler/Console/ProgramOptions.test.cc +++ b/Scheduler/Console/ProgramOptions.test.cc @@ -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) diff --git a/Scheduler/Console/Server.cc b/Scheduler/Console/Server.cc index ef885ba..04b54be 100644 --- a/Scheduler/Console/Server.cc +++ b/Scheduler/Console/Server.cc @@ -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 p (new Client(*this, client)); clients_.insert( p ); SENF_LOG(( "Registered new client " << p.get() )); diff --git a/Scheduler/Console/Server.hh b/Scheduler/Console/Server.hh index 0f98094..7ccf284 100644 --- a/Scheduler/Console/Server.hh +++ b/Scheduler/Console/Server.hh @@ -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(); diff --git a/Scheduler/Console/Server.ih b/Scheduler/Console/Server.ih index c65a88f..332512a 100644 --- a/Scheduler/Console/Server.ih +++ b/Scheduler/Console/Server.ih @@ -98,7 +98,7 @@ namespace detail { class ClientReader { public: - typedef ServerHandle::ClientSocketHandle ClientHandle; + typedef ServerHandle::ClientHandle ClientHandle; virtual ~ClientReader() = 0; diff --git a/Socket/ClientSocketHandle.hh b/Socket/ClientSocketHandle.hh index cb9868f..7495a69 100644 --- a/Socket/ClientSocketHandle.hh +++ b/Socket/ClientSocketHandle.hh @@ -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 ServerSocketHandle; + typedef ServerSocketHandle ServerHandle; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members diff --git a/Socket/ProtocolServerSocketHandle.test.cc b/Socket/ProtocolServerSocketHandle.test.cc index 86d91e4..5ebde9a 100644 --- a/Socket/ProtocolServerSocketHandle.test.cc +++ b/Socket/ProtocolServerSocketHandle.test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_UNIT_TEST(protocolServerSocketHandle) OtherSocketHandle osh (h); h = senf::static_socket_cast(osh); - MySocketHandle::ClientSocketHandle client = h.accept(); + MySocketHandle::ClientHandle client = h.accept(); BOOST_CHECK_EQUAL( client.fd(), -1 ); BOOST_CHECK_EQUAL( h.dumpState(), diff --git a/Socket/Protocols/INet/INet6Address.cci b/Socket/Protocols/INet/INet6Address.cci index b2d0e2a..61fa0c6 100644 --- a/Socket/Protocols/INet/INet6Address.cci +++ b/Socket/Protocols/INet/INet6Address.cci @@ -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() diff --git a/Socket/ServerSocketHandle.cti b/Socket/ServerSocketHandle.cti index 3d91c90..4044b1e 100644 --- a/Socket/ServerSocketHandle.cti +++ b/Socket/ServerSocketHandle.cti @@ -92,30 +92,30 @@ prefix_ void senf::ServerSocketHandle::local(Address & addr) } template -prefix_ typename senf::ServerSocketHandle::ClientSocketHandle +prefix_ typename senf::ServerSocketHandle::ClientHandle senf::ServerSocketHandle::accept() { - return ClientSocketHandle(this->body().clone( - SPolicy::CommunicationPolicy::accept(*this), false)); + return ClientHandle(this->body().clone( + SPolicy::CommunicationPolicy::accept(*this), false)); } template -prefix_ std::pair::ClientSocketHandle, +prefix_ std::pair::ClientHandle, typename senf::ServerSocketHandle::Address> senf::ServerSocketHandle::acceptfrom() { Address address; - ClientSocketHandle handle = acceptfrom(address); + ClientHandle handle = acceptfrom(address); return std::make_pair(handle,address); } template -prefix_ typename senf::ServerSocketHandle::ClientSocketHandle +prefix_ typename senf::ServerSocketHandle::ClientHandle senf::ServerSocketHandle::acceptfrom(Address & addr) { - return ClientSocketHandle(this->protocol().clone(), - SPolicy::CommunicationPolicy::accept(*this,addr)); + return ClienttHandle(this->protocol().clone(), + SPolicy::CommunicationPolicy::accept(*this,addr)); } /////////////////////////////////////////////////////////////////////////// diff --git a/Socket/ServerSocketHandle.hh b/Socket/ServerSocketHandle.hh index 837b454..819fb71 100644 --- a/Socket/ServerSocketHandle.hh +++ b/Socket/ServerSocketHandle.hh @@ -90,7 +90,7 @@ namespace senf { */ typedef typename boost::call_traits
::param_type AddressParam; /// Corresponding client socket handle with the same policy - typedef ClientSocketHandle ClientSocketHandle; + typedef ClientSocketHandle ClientHandle; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -171,17 +171,15 @@ namespace senf { \returns handle of new client connection */ - ClientSocketHandle - accept (); - std::pair + ClientHandle accept (); + std::pair 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 diff --git a/Socket/ServerSocketHandle.test.cc b/Socket/ServerSocketHandle.test.cc index 0180144..18f9967 100644 --- a/Socket/ServerSocketHandle.test.cc +++ b/Socket/ServerSocketHandle.test.cc @@ -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 ); } diff --git a/Utils/Daemon/Daemon.test.cc b/Utils/Daemon/Daemon.test.cc index cdf74b8..d9e4a3e 100644 --- a/Utils/Daemon/Daemon.test.cc +++ b/Utils/Daemon/Daemon.test.cc @@ -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(args)), 0 ); BOOST_CHECK( ! boost::filesystem::exists("invalid.log") ); BOOST_CHECK( ! boost::filesystem::exists("invalid.pid") ); diff --git a/Utils/Logger/Config.ih b/Utils/Logger/Config.ih index f2f6777..004368d 100644 --- a/Utils/Logger/Config.ih +++ b/Utils/Logger/Config.ih @@ -33,6 +33,7 @@ #include #include #include +#include #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 diff --git a/senfscons/BoostUnitTests.py b/senfscons/BoostUnitTests.py index f2516f3..1e28824 100644 --- a/senfscons/BoostUnitTests.py +++ b/senfscons/BoostUnitTests.py @@ -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']) diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 15414fd..7f08d0b 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -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)