From: g0dil Date: Thu, 8 May 2008 11:58:31 +0000 (+0000) Subject: BUGFIX: Fix packet regsitry helper macro token pasting X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c80c59ed398f1b65d788b7cd37257b4022442f27;p=senf.git BUGFIX: Fix packet regsitry helper macro token pasting git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@839 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/PacketRegistry.hh b/Packets/PacketRegistry.hh index 8f342eb..a17449c 100644 --- a/Packets/PacketRegistry.hh +++ b/Packets/PacketRegistry.hh @@ -30,6 +30,7 @@ #include #include // for boost::noncopyable #include +#include #include "../Utils/Exception.hh" #include "Packet.hh" @@ -200,7 +201,7 @@ packet of which the key is requested # define SENF_PACKET_REGISTRY_REGISTER( registry, value, type ) \ namespace { \ senf::PacketRegistry< registry >::RegistrationProxy< type > \ - packetRegistration_ ## __LINE__ ( value ); \ + BOOST_PP_CAT(packetRegistration_, __LINE__) ( value ); \ } /** \brief Dump all packet registries diff --git a/Packets/PacketRegistry.test.cc b/Packets/PacketRegistry.test.cc index 6f2e96f..8521827 100644 --- a/Packets/PacketRegistry.test.cc +++ b/Packets/PacketRegistry.test.cc @@ -55,13 +55,11 @@ namespace { struct OtherPacketType : public PacketTypeBase {}; typedef senf::ConcretePacket OtherPacket; - namespace reg { - PacketRegistry::RegistrationProxy registerFoo ("foo"); - PacketRegistry::RegistrationProxy registerBar ("bar"); - } - } +SENF_PACKET_REGISTRY_REGISTER(StringTag, "foo", FooPacket); +SENF_PACKET_REGISTRY_REGISTER(StringTag, "bar", BarPacket); + BOOST_AUTO_UNIT_TEST(packetRegistry_test) { PacketRegistry::registerPacket(1u);