Skip to content

Commit

Permalink
Bug #33608154 libmysqlclient C++20 compilation fails due to reserved
Browse files Browse the repository at this point in the history
'requires' keyword

Summary:
Porting upstream commits: mysql/mysql-server@e4a4aac

in C++20, requires becomes keyword and cause compiler fail

```
mysql/components/services/dynamic_loader.h:266:31: error: expected member name or ';' after declaration specifiers
  struct mysql_service_ref_t *requires;
                              ^
mysql/components/services/dynamic_loader.h:266:39: error: expected expression
  struct mysql_service_ref_t *requires;
                                      ^
mysql/components/services/dynamic_loader.h:266:31: error: trailing requires clause can only be used when declaring a function
  struct mysql_service_ref_t *requires;
```

Test Plan:
CI

dynamic_loader.h is referenced by table_access_services, which will be used by xsql

Reviewers: pgl, #mysql_eng, #xsql-mysql_eng

Reviewed By: pgl

Subscribers: pgl, [email protected]

Differential Revision: https://phabricator.intern.facebook.com/D38969126
  • Loading branch information
luqun committed Sep 6, 2022
1 parent 52ee91b commit 671ffae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,9 @@ MYSQL_CHECK_LIBEVENT()
# Add lz4 library
MYSQL_CHECK_LZ4()
# Add icu library
MYSQL_CHECK_ICU()
IF(NOT WITHOUT_SERVER)
MYSQL_CHECK_ICU()
ENDIF()
# Add protoc and libprotobuf
IF(NOT WITHOUT_SERVER)
MYSQL_CHECK_PROTOBUF()
Expand Down
2 changes: 1 addition & 1 deletion components/libminchassis/mysql_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ std::vector<mysql_service_placeholder_ref_t *>
mysql_component::get_required_services() const {
std::vector<mysql_service_placeholder_ref_t *> res;
for (mysql_service_placeholder_ref_t *implementation_it =
m_component_data->requires;
m_component_data->requires_service;
implementation_it->name != nullptr; ++implementation_it) {
res.push_back(implementation_it);
}
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/components/services/dynamic_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct mysql_component_t {
#endif
const char *name;
struct mysql_service_ref_t *provides;
struct mysql_service_placeholder_ref_t *requires;
struct mysql_service_placeholder_ref_t *requires_service;
struct mysql_metadata_ref_t *metadata;
mysql_service_status_t (*init)();
mysql_service_status_t (*deinit)();
Expand Down

0 comments on commit 671ffae

Please sign in to comment.