git: 1c1158a52009 - main - databases/mysql80-server: fix build with clang/libc++ 17

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 16 Oct 2023 06:28:20 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1c1158a5200990584a0ec761e3869963ead26adc

commit 1c1158a5200990584a0ec761e3869963ead26adc
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-10-14 13:55:03 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-10-16 06:27:53 +0000

    databases/mysql80-server: fix build with clang/libc++ 17
    
    Building databases/mysql80-server with clang and libc++ 17 results in
    the following errors:
    
      In file included from /wrkdirs/usr/ports/databases/mysql80-server/work/mysql-8.0.33/sql/auth/sql_authorization.cc:23:
      In file included from /wrkdirs/usr/ports/databases/mysql80-server/work/mysql-8.0.33/sql/auth/sql_authorization.h:26:
      In file included from /usr/include/c++/v1/functional:515:
      In file included from /usr/include/c++/v1/__algorithm/search.h:23:
      /usr/include/c++/v1/__utility/pair.h:613:22: error: invalid operands to binary expression ('const Auth_id' and 'const MYSQL_LEX_CSTRING')
        613 |     return __x.first == __y.first && __x.second == __y.second;
            |            ~~~~~~~~~ ^  ~~~~~~~~~
      /usr/include/c++/v1/__algorithm/find.h:34:41: note: in instantiation of function template specialization 'std::__1::operator==<const Auth_id, Auth_id, MYSQL_LEX_CSTRING, MYSQL_LEX_CSTRING>' requested here
         34 |     if (std::__invoke(__proj, *__first) == __value)
            |                                         ^
      /usr/include/c++/v1/__algorithm/find.h:72:21: note: in instantiation of function template specialization 'std::__find_impl<std::__hash_map_iterator<std::__hash_iterator<std::__hash_node<std::__hash_value_type<Auth_id, Auth_id>, void *> *>>, std::__hash_map_iterator<std::__hash_iterator<std::__hash_node<std::__hash_value_type<Auth_id, Auth_id>, void *> *>>, std::pair<MYSQL_LEX_CSTRING, MYSQL_LEX_CSTRING>, std::__identity>' requested here
         72 |       __first, std::__find_impl(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __value, __proj));
            |                     ^
      /wrkdirs/usr/ports/databases/mysql80-server/work/mysql-8.0.33/sql/auth/sql_authorization.cc:6591:11: note: in instantiation of function template specialization 'std::find<std::__hash_map_iterator<std::__hash_iterator<std::__hash_node<std::__hash_value_type<Auth_id, Auth_id>, void *> *>>, std::pair<MYSQL_LEX_CSTRING, MYSQL_LEX_CSTRING>>' requested here
       6591 |       if (find(role_it, role_end, *it) == role_end) {
            |           ^
      [... long list of candidates elided ...]
    
    This is because an equality operator for Role_id and LEX_CSTRING is
    missing. Add such an operator to work around the problem.
    
    PR:             274464
    Approved by:    joneum (maintainer)
    MFH:            2023Q4
---
 .../files/patch-sql_auth_sql__authorization.cc              | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/databases/mysql80-server/files/patch-sql_auth_sql__authorization.cc b/databases/mysql80-server/files/patch-sql_auth_sql__authorization.cc
new file mode 100644
index 000000000000..4d35279882d5
--- /dev/null
+++ b/databases/mysql80-server/files/patch-sql_auth_sql__authorization.cc
@@ -0,0 +1,13 @@
+--- sql/auth/sql_authorization.cc.orig	2023-03-16 17:22:37 UTC
++++ sql/auth/sql_authorization.cc
+@@ -7430,6 +7430,10 @@ bool operator==(const Role_id &a, const std::string &b
+   return tmp == b;
+ }
+ 
++bool operator==(const Role_id &a, const LEX_CSTRING &b) {
++  return a == to_string(b);
++}
++
+ bool operator==(const std::pair<Role_id, bool> &a, const std::string &b) {
+   return a.first == b;
+ }