aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-08-21 17:03:00 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-08-21 17:03:00 +0000
commit29873d969e02af4315ba32ac52ae43c9d6597040 (patch)
tree49339a52006fbf1280fe498503a725a0034249fa /net
parentf1108f0172a6590df5e3e338cfbda1c7f5bae026 (diff)
downloadports-29873d969e02af4315ba32ac52ae43c9d6597040.tar.gz
ports-29873d969e02af4315ba32ac52ae43c9d6597040.zip
net/xprobe: Fix build with Clang 16 and remove the workaround
random_shuffle has bee deprecated in C++14 and removed since C++17. Use shuffle instead. target.cc:373:3: error: use of undeclared identifier 'random_shuffle' random_shuffle(ports.begin(), ports.end()); ^ 5 warnings and 1 error generated. Tested on: 14.0-CURRENT (1400093)
Diffstat (limited to 'net')
-rw-r--r--net/xprobe/Makefile9
-rw-r--r--net/xprobe/files/patch-src-target.cc29
2 files changed, 29 insertions, 9 deletions
diff --git a/net/xprobe/Makefile b/net/xprobe/Makefile
index 8c4f775f0f1e..dbc8e5015808 100644
--- a/net/xprobe/Makefile
+++ b/net/xprobe/Makefile
@@ -14,15 +14,6 @@ LICENSE_FILE= ${WRKSRC}/COPYING
CONFIGURE_ENV= INSTALL=${INSTALL}
GNU_CONFIGURE= yes
-.include <bsd.port.options.mk>
-
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400091 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
-USES+= llvm:max=15
-CC= clang${LLVM_VERSION}
-CPP= clang-cpp${LLVM_VERSION}
-CXX= clang++${LLVM_VERSION}
-.endif
-
post-patch:
@${REINPLACE_CMD} -e 's|-DBROKEN_BSD||' ${WRKSRC}/libs-external/USI++/src/configure
diff --git a/net/xprobe/files/patch-src-target.cc b/net/xprobe/files/patch-src-target.cc
new file mode 100644
index 000000000000..21f32bb807d4
--- /dev/null
+++ b/net/xprobe/files/patch-src-target.cc
@@ -0,0 +1,29 @@
+--- src/target.cc.orig 2005-07-27 08:38:17 UTC
++++ src/target.cc
+@@ -28,6 +28,8 @@
+ #include "os_matrix.h"
+ #include "xplib/xplib.h"
+ #include "log.h"
++#include <algorithm>
++#include <random>
+
+ extern Interface *ui;
+ extern Xprobe_Module_Hdlr *xmh;
+@@ -363,6 +365,8 @@ void Port_Range::set_range(u_short a, u_short b) {
+
+ int Port_Range::get_next(u_short *port) {
+ int k, sz=size();
++ std::random_device rd;
++ std::mt19937 g(rd());
+
+ if (curr+low > high)
+ return 1;
+@@ -370,7 +373,7 @@ int Port_Range::get_next(u_short *port) {
+ // initialize
+ for (k=0; k < sz; k++)
+ ports.push_back(low + k);
+- random_shuffle(ports.begin(), ports.end());
++ std::shuffle(ports.begin(), ports.end(), g);
+ *port = ports[curr++];
+ } else
+ *port = ports[curr++];