FreeBSD Bugzilla – Attachment 242736 Details for
Bug 271953
japanese/zinnia: fix build with clang 16
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
japanese/zinnia: fix build with clang 16
japanese__zinnia-fix-clang16-build-1.diff (text/plain), 1.65 KB, created by
Dimitry Andric
on 2023-06-11 17:05:13 UTC
(
hide
)
Description:
japanese/zinnia: fix build with clang 16
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2023-06-11 17:05:13 UTC
Size:
1.65 KB
patch
obsolete
>commit 2b0789303d6f2f50e2f7c6100fd2b8b1b315e67a >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2023-06-11 19:01:12 +0200 > > japanese/zinnia: fix build with clang 16 > > Since clang 16 (and gcc 11) the default C++ standard is now gnu++17. > Because japanese/zinnia's build infrastructure does not explicitly set > its C++ standard, this leads to an error: > > svm.cpp:50:10: error: no member named 'random_shuffle' in namespace 'std' > std::random_shuffle(index.begin(), index.begin() + active_size); > ~~~~~^ > > This is because std::random_shuffle has been removed from C++17. An > suitable replacement is std::shuffle, using a std::random_device in > combination with std::mt19937 as the random number engine. > >diff --git a/japanese/zinnia/files/patch-svm.cpp b/japanese/zinnia/files/patch-svm.cpp >new file mode 100644 >index 000000000000..d37a3003bab6 >--- /dev/null >+++ b/japanese/zinnia/files/patch-svm.cpp >@@ -0,0 +1,24 @@ >+--- svm.cpp.orig 2009-04-05 11:40:29 UTC >++++ svm.cpp >+@@ -10,6 +10,7 @@ >+ #include <vector> >+ #include <cmath> >+ #include <algorithm> >++#include <random> >+ #include "feature.h" >+ >+ namespace zinnia { >+@@ -44,10 +45,12 @@ bool svm_train(size_t l, >+ } >+ >+ static const size_t kMaxIteration = 2000; >++ std::random_device device; >++ std::mt19937 engine(device()); >+ for (size_t iter = 0; iter < kMaxIteration; ++iter) { >+ double PGmax_new = -kINF; >+ double PGmin_new = kINF; >+- std::random_shuffle(index.begin(), index.begin() + active_size); >++ std::shuffle(index.begin(), index.begin() + active_size, engine); >+ >+ for (size_t s = 0; s < active_size; ++s) { >+ const size_t i = index[s];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 271953
: 242736