Date: Sun, 15 Sep 2013 19:03:04 +0000 (UTC) From: Antoine Brodin <antoine@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r327355 - head/net/tcpflow/files Message-ID: <201309151903.r8FJ3449084176@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: antoine Date: Sun Sep 15 19:03:03 2013 New Revision: 327355 URL: http://svnweb.freebsd.org/changeset/ports/327355 Log: Fix build with libc++ which does not has tr1 namespace Added: head/net/tcpflow/files/ head/net/tcpflow/files/patch-src__be13_api__plugin.cpp (contents, props changed) head/net/tcpflow/files/patch-src__tcpdemux.h (contents, props changed) Added: head/net/tcpflow/files/patch-src__be13_api__plugin.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/tcpflow/files/patch-src__be13_api__plugin.cpp Sun Sep 15 19:03:03 2013 (r327355) @@ -0,0 +1,48 @@ +--- ./src/be13_api/plugin.cpp.orig 2013-08-03 16:58:46.000000000 +0000 ++++ ./src/be13_api/plugin.cpp 2013-09-07 22:32:02.000000000 +0000 +@@ -9,7 +9,16 @@ + #include <sys/stat.h> + #include <dirent.h> + #include <algorithm> ++#ifdef __clang__ ++#if __has_include(<unordered_set>) ++#define HAVE_CXX11_UNORDERED_SET 1 ++#endif ++#endif ++#ifdef HAVE_CXX11_UNORDERED_SET ++#include <unordered_set> ++#else + #include <tr1/unordered_set> ++#endif + #ifdef HAVE_ERR_H + #include <err.h> + #endif +@@ -23,20 +32,28 @@ + #include "../dfxml/src/hash_t.h" + + namespace std { ++#ifndef HAVE_CXX11_UNORDERED_SET + namespace tr1 { ++#endif + template<> + struct hash<md5_t> { + size_t operator()(const md5_t &key) const { + return *(size_t *)(key.final()); + } + }; ++#ifndef HAVE_CXX11_UNORDERED_SET + } ++#endif + } + + class atomic_hash_set + { + cppmutex M; ++#ifdef HAVE_CXX11_UNORDERED_SET ++ std::unordered_set<md5_t>myset; ++#else + std::tr1::unordered_set<md5_t>myset; ++#endif + public: + atomic_hash_set():M(),myset(){} + bool in(const md5_t &s){ Added: head/net/tcpflow/files/patch-src__tcpdemux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/tcpflow/files/patch-src__tcpdemux.h Sun Sep 15 19:03:03 2013 (r327355) @@ -0,0 +1,39 @@ +--- ./src/tcpdemux.h.orig 2013-05-27 22:28:50.000000000 +0000 ++++ ./src/tcpdemux.h 2013-09-07 22:32:29.000000000 +0000 +@@ -20,8 +20,18 @@ + #include "pcap_writer.h" + #include "dfxml/src/dfxml_writer.h" + #include "dfxml/src/hash_t.h" ++#ifdef __clang__ ++#if __has_include(<unordered_set>) ++#define HAVE_CXX11_UNORDERED_SET 1 ++#endif ++#endif ++#ifdef HAVE_CXX11_UNORDERED_SET ++#include <unordered_map> ++#include <unordered_set> ++#else + #include <tr1/unordered_map> + #include <tr1/unordered_set> ++#endif + #include <queue> + + +@@ -53,10 +63,17 @@ + bool operator() (const flow_addr &x, const flow_addr &y) const { return x==y;} + } flow_addr_key_eq; + ++#ifdef HAVE_CXX11_UNORDERED_SET ++ typedef std::unordered_set<class tcpip *> tcpset; ++ typedef std::vector<class saved_flow *> saved_flows_t; // needs to be ordered ++ typedef std::unordered_map<flow_addr,tcpip *,flow_addr_hash,flow_addr_key_eq> flow_map_t; // active flows ++ typedef std::unordered_map<flow_addr,saved_flow *,flow_addr_hash,flow_addr_key_eq> saved_flow_map_t; // flows that have been saved ++#else + typedef std::tr1::unordered_set<class tcpip *> tcpset; + typedef std::vector<class saved_flow *> saved_flows_t; // needs to be ordered + typedef std::tr1::unordered_map<flow_addr,tcpip *,flow_addr_hash,flow_addr_key_eq> flow_map_t; // active flows + typedef std::tr1::unordered_map<flow_addr,saved_flow *,flow_addr_hash,flow_addr_key_eq> saved_flow_map_t; // flows that have been saved ++#endif + tcpdemux(); + public: + static uint32_t tcp_timeout;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309151903.r8FJ3449084176>