Skip to content

Commit 5bfe4e9

Browse files
committed
Bug#36500268 Upgrade to clang-format 15 [8.4]
Switch to Latest for Standard: Cpp11 is in fact alias for Latest: https://clang.llvm.org/docs/ClangFormatStyleOptions.html Also remove duplicate specifications for same option, which is error in clang 18+. Change-Id: I7649b1bc09ec1eef1925918034e596f188bff867
1 parent c057e37 commit 5bfe4e9

File tree

309 files changed

+1572
-1630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+1572
-1630
lines changed

.clang-format

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# along with this program; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24-
# We currently use clang-format version 10.
24+
# We currently use clang-format version 15.
2525
#
2626
# This is the output of
2727
#
@@ -98,15 +98,13 @@ ConstructorInitializerIndentWidth: 4
9898
ContinuationIndentWidth: 4
9999
Cpp11BracedListStyle: true
100100
DeriveLineEnding: true
101-
#DerivePointerAlignment: true
102101
DisableFormat: false
103102
ExperimentalAutoDetectBinPacking: false
104103
FixNamespaceComments: true
105104
ForEachMacros:
106105
- foreach
107106
- Q_FOREACH
108107
- BOOST_FOREACH
109-
#IncludeBlocks: Regroup
110108
IncludeCategories:
111109
- Regex: '^<ext/.*\.h>'
112110
Priority: 2
@@ -146,7 +144,6 @@ PenaltyBreakString: 1000
146144
PenaltyBreakTemplateDeclaration: 10
147145
PenaltyExcessCharacter: 1000000
148146
PenaltyReturnTypeOnItsOwnLine: 200
149-
#PointerAlignment: Left
150147
RawStringFormats:
151148
- Language: Cpp
152149
Delimiters:
@@ -197,7 +194,6 @@ SpacesInCStyleCastParentheses: false
197194
SpacesInParentheses: false
198195
SpacesInSquareBrackets: false
199196
SpaceBeforeSquareBrackets: false
200-
#Standard: Auto
201197
StatementMacros:
202198
- Q_UNUSED
203199
- QT_REQUIRE_VERSION
@@ -210,7 +206,6 @@ UseTab: Never
210206
DerivePointerAlignment: false
211207
PointerAlignment: Right
212208

213-
# MySQL source code is allowed to use the latest c++ features.
214209
Standard: Latest
215210

216211
# MySQL includes frequently are not order-independent (e.g. my_config.h needs
@@ -277,15 +272,13 @@ ConstructorInitializerIndentWidth: 4
277272
ContinuationIndentWidth: 4
278273
Cpp11BracedListStyle: true
279274
DeriveLineEnding: true
280-
DerivePointerAlignment: true
281275
DisableFormat: false
282276
ExperimentalAutoDetectBinPacking: false
283277
FixNamespaceComments: true
284278
ForEachMacros:
285279
- foreach
286280
- Q_FOREACH
287281
- BOOST_FOREACH
288-
IncludeBlocks: Regroup
289282
IncludeCategories:
290283
- Regex: '^<ext/.*\.h>'
291284
Priority: 2
@@ -325,7 +318,6 @@ PenaltyBreakString: 1000
325318
PenaltyBreakTemplateDeclaration: 10
326319
PenaltyExcessCharacter: 1000000
327320
PenaltyReturnTypeOnItsOwnLine: 200
328-
PointerAlignment: Left
329321
RawStringFormats:
330322
- Language: Cpp
331323
Delimiters:
@@ -376,7 +368,6 @@ SpacesInCStyleCastParentheses: false
376368
SpacesInParentheses: false
377369
SpacesInSquareBrackets: false
378370
SpaceBeforeSquareBrackets: false
379-
Standard: Auto
380371
StatementMacros:
381372
- Q_UNUSED
382373
- QT_REQUIRE_VERSION

client/mysql.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3347,7 +3347,8 @@ void add_syslog(const char *line) {
33473347
"CONNECTION_ID:%lu, DB_SERVER:'%s', DB:'%s', QUERY:'%s'",
33483348
/* use the cached user/sudo_user value. */
33493349
current_os_sudouser ? current_os_sudouser
3350-
: current_os_user ? current_os_user : "--",
3350+
: current_os_user ? current_os_user
3351+
: "--",
33513352
current_user ? current_user : "--", mysql_thread_id(&mysql_handle),
33523353
current_host ? current_host : "--", current_db ? current_db : "--",
33533354
line);

client/mysqlbinlog.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,8 +2260,10 @@ extern "C" bool get_one_option(int optid, const struct my_option *opt,
22602260
"--read-from-remote-source"));
22612261
[[fallthrough]];
22622262
case OPT_REMOTE_PROTO:
2263-
opt_remote_proto = (enum_remote_proto)(
2264-
find_type_or_exit(argument, &remote_proto_typelib, opt->name) - 1);
2263+
opt_remote_proto =
2264+
(enum_remote_proto)(find_type_or_exit(argument, &remote_proto_typelib,
2265+
opt->name) -
2266+
1);
22652267
break;
22662268
case OPT_MYSQL_PROTOCOL:
22672269
opt_protocol =
@@ -2274,9 +2276,11 @@ extern "C" bool get_one_option(int optid, const struct my_option *opt,
22742276
stop_datetime = convert_str_to_timestamp(stop_datetime_str);
22752277
break;
22762278
case OPT_BASE64_OUTPUT_MODE:
2277-
opt_base64_output_mode = (enum_base64_output_mode)(
2278-
find_type_or_exit(argument, &base64_output_mode_typelib, opt->name) -
2279-
1);
2279+
opt_base64_output_mode =
2280+
(enum_base64_output_mode)(find_type_or_exit(
2281+
argument, &base64_output_mode_typelib,
2282+
opt->name) -
2283+
1);
22802284
break;
22812285
case 'v':
22822286
if (argument == disabled_my_option)

client/mysqldump.cc

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6060,9 +6060,9 @@ static bool get_view_structure(char *table, char *db) {
60606060
search_len =
60616061
(ulong)(strxmov(ptr, "WITH ", row[0], " CHECK OPTION", NullS) - ptr);
60626062
ptr = replace_buf;
6063-
replace_len = (ulong)(
6064-
strxmov(ptr, "*/\n/*!50002 WITH ", row[0], " CHECK OPTION", NullS) -
6065-
ptr);
6063+
replace_len = (ulong)(strxmov(ptr, "*/\n/*!50002 WITH ", row[0],
6064+
" CHECK OPTION", NullS) -
6065+
ptr);
60666066
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
60676067
}
60686068

@@ -6082,19 +6082,23 @@ static bool get_view_structure(char *table, char *db) {
60826082
host_name_str, &host_name_len);
60836083

60846084
ptr = search_buf;
6085-
search_len = (ulong)(
6086-
strxmov(ptr, "DEFINER=",
6087-
quote_name(user_name_str, quoted_user_name_str, false), "@",
6088-
quote_name(host_name_str, quoted_host_name_str, false),
6089-
" SQL SECURITY ", row[2], NullS) -
6090-
ptr);
6085+
search_len =
6086+
(ulong)(strxmov(
6087+
ptr, "DEFINER=",
6088+
quote_name(user_name_str, quoted_user_name_str, false),
6089+
"@",
6090+
quote_name(host_name_str, quoted_host_name_str, false),
6091+
" SQL SECURITY ", row[2], NullS) -
6092+
ptr);
60916093
ptr = replace_buf;
6092-
replace_len = (ulong)(
6093-
strxmov(ptr, "*/\n/*!50013 DEFINER=",
6094-
quote_name(user_name_str, quoted_user_name_str, false), "@",
6095-
quote_name(host_name_str, quoted_host_name_str, false),
6096-
" SQL SECURITY ", row[2], " */\n/*!50001", NullS) -
6097-
ptr);
6094+
replace_len =
6095+
(ulong)(strxmov(
6096+
ptr, "*/\n/*!50013 DEFINER=",
6097+
quote_name(user_name_str, quoted_user_name_str, false),
6098+
"@",
6099+
quote_name(host_name_str, quoted_host_name_str, false),
6100+
" SQL SECURITY ", row[2], " */\n/*!50001", NullS) -
6101+
ptr);
60986102
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
60996103
}
61006104

client/mysqlshow.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,15 @@ static int list_tables(MYSQL *mysql, const char *db, const char *table) {
619619
}
620620

621621
print_trailer(
622-
head_length, (opt_table_type ? 10 : opt_verbose > 0 ? 8 : 0),
622+
head_length,
623+
(opt_table_type ? 10
624+
: opt_verbose > 0 ? 8
625+
: 0),
623626
(opt_table_type ? (opt_verbose > 0 ? 8 : 0) : (opt_verbose > 1 ? 10 : 0)),
624-
!opt_table_type ? 0 : opt_verbose > 1 ? 10 : 0, 0);
627+
!opt_table_type ? 0
628+
: opt_verbose > 1 ? 10
629+
: 0,
630+
0);
625631

626632
if (counter && opt_verbose)
627633
printf("%u row%s in set.\n\n", counter, (counter > 1) ? "s" : "");

client/mysqltest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,7 +2881,7 @@ static void var_set_escape(struct st_command *command, VAR *dst) {
28812881
- the second string,
28822882
- a bool that is false if the parsing succeeded; true if it failed.
28832883
*/
2884-
auto parse_args = [&]() -> auto {
2884+
auto parse_args = [&]() -> auto{
28852885
// command->first_argument contains '(characters,text)'
28862886
char *p = command->first_argument;
28872887
// Find (
@@ -3557,7 +3557,7 @@ static void free_dynamic_strings(T *val) {
35573557
/// the function, through recursion, end up being
35583558
/// freed by dynstr_free().
35593559
template <typename T1, typename... T2>
3560-
static void free_dynamic_strings(T1 *first, T2 *... rest) {
3560+
static void free_dynamic_strings(T1 *first, T2 *...rest) {
35613561
free_dynamic_strings(first);
35623562
free_dynamic_strings(rest...);
35633563
}

components/libminchassis/gunit_harness/include/mock/pfs_plugin_table_v1_all_empty.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2929
namespace pfs_plugin_table_v1_all_empty {
3030

3131
DEFINE_METHOD(int, add_tables,
32-
(PFS_engine_table_share_proxy * */*st_share*/,
32+
(PFS_engine_table_share_proxy * * /*st_share*/,
3333
unsigned int /*share_count*/)) {
3434
return 0;
3535
}
3636

3737
DEFINE_METHOD(int, delete_tables,
38-
(PFS_engine_table_share_proxy * */*st_share*/,
38+
(PFS_engine_table_share_proxy * * /*st_share*/,
3939
unsigned int /*share_count*/)) {
4040
return 0;
4141
}

components/mysqlbackup/backup_page_tracker.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ bool Backup_page_tracker::page_track_get_changed_pages_init(UDF_INIT *,
347347
Callback method for initialization of UDF
348348
"mysqlbackup_page_track_get_changed_pages".
349349
*/
350-
void Backup_page_tracker::page_track_get_changed_pages_deinit(UDF_INIT *initid [
351-
[maybe_unused]]) {
350+
void Backup_page_tracker::page_track_get_changed_pages_deinit(
351+
UDF_INIT *initid [[maybe_unused]]) {
352352
free(m_changed_pages_buf);
353353
m_changed_pages_buf = nullptr;
354354
}

components/test/test_status_var_reader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class udf_list {
8888

8989
private:
9090
udf_list_t set;
91-
} * list;
91+
} *list;
9292

9393
/* actual test material */
9494
namespace udf_impl {

components/test/test_udf_registration.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class udf_list {
9494

9595
private:
9696
udf_list_t set;
97-
} * list;
97+
} *list;
9898

9999
/* actual test material */
100100
namespace udf_impl {

components/test_server_telemetry_metrics/server_metrics_component.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ static void meter_change_notify_callback(const char *meter,
567567
MeterNotifyType change) {
568568
// just log the notification, real metric component would need to update its
569569
// OTEL object collection
570-
const char *change_type =
571-
(change == MeterNotifyType::METER_ADDED)
572-
? "added"
573-
: (change == MeterNotifyType::METER_REMOVED) ? "removed" : "updated";
570+
const char *change_type = (change == MeterNotifyType::METER_ADDED) ? "added"
571+
: (change == MeterNotifyType::METER_REMOVED)
572+
? "removed"
573+
: "updated";
574574
g_log.write("*** Meter change notification: %s %s\n", meter, change_type);
575575

576576
// to test for possible deadlock, simulate production component

include/my_alloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ using unique_ptr_destroy_only = std::unique_ptr<T, Destroy_only<T>>;
478478

479479
template <typename T, typename... Args>
480480
unique_ptr_destroy_only<T> make_unique_destroy_only(MEM_ROOT *mem_root,
481-
Args &&... args) {
481+
Args &&...args) {
482482
return unique_ptr_destroy_only<T>(new (mem_root)
483483
T(std::forward<Args>(args)...));
484484
}

include/mysql/components/library_mysys/component_malloc_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Component_malloc_allocator {
104104
void deallocate(pointer p, size_type) { my_free(p); }
105105

106106
template <class U, class... Args>
107-
void construct(U *p, Args &&... args) {
107+
void construct(U *p, Args &&...args) {
108108
assert(p != nullptr);
109109
try {
110110
::new ((void *)p) U(std::forward<Args>(args)...);

include/mysql/plugin_trace.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,10 @@ struct MYSQL;
253253
@return A pointer to plugin-specific, per-connection data if any.
254254
*/
255255

256-
typedef void *(tracing_start_callback)(
257-
struct st_mysql_client_plugin_TRACE *self, MYSQL *connection_handle,
258-
enum protocol_stage stage);
256+
typedef void *(
257+
tracing_start_callback)(struct st_mysql_client_plugin_TRACE *self,
258+
MYSQL *connection_handle,
259+
enum protocol_stage stage);
259260

260261
/**
261262
Trace plugin tracing_stop() method.

include/mysql/service_command.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ extern "C" struct command_service_st {
397397
const struct st_command_service_cbs *callbacks,
398398
enum cs_text_or_binary text_or_binary,
399399
void *service_callbacks_ctx);
400-
} * command_service;
400+
} *command_service;
401401

402402
#ifdef MYSQL_DYNAMIC_PLUGIN
403403

include/mysql/service_locking.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ typedef int (*mysql_release_locks_t)(MYSQL_THD opaque_thd,
108108
extern "C" struct mysql_locking_service_st {
109109
mysql_acquire_locks_t mysql_acquire_locks;
110110
mysql_release_locks_t mysql_release_locks;
111-
} * mysql_locking_service;
111+
} *mysql_locking_service;
112112

113113
#ifdef MYSQL_DYNAMIC_PLUGIN
114114

include/mysql/service_my_plugin_log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern "C" struct my_plugin_log_service {
5353
int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level,
5454
const char *, ...)
5555
MY_ATTRIBUTE((format(printf, 3, 4)));
56-
} * my_plugin_log_service;
56+
} *my_plugin_log_service;
5757

5858
#ifdef MYSQL_DYNAMIC_PLUGIN
5959

include/mysql/service_mysql_keyring.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extern "C" struct mysql_keyring_service_st {
8686
@sa my_key_generate, st_mysql_keyring::mysql_key_generate
8787
*/
8888
int (*my_key_generate_func)(const char *, const char *, const char *, size_t);
89-
} * mysql_keyring_service;
89+
} *mysql_keyring_service;
9090

9191
#ifdef MYSQL_DYNAMIC_PLUGIN
9292

include/mysql/service_mysql_password_policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extern "C" struct mysql_password_policy_service_st {
5858
st_mysql_validate_password::get_password_strength
5959
*/
6060
int (*my_calculate_password_strength_func)(const char *, unsigned int);
61-
} * mysql_password_policy_service;
61+
} *mysql_password_policy_service;
6262

6363
#ifdef MYSQL_DYNAMIC_PLUGIN
6464

include/mysql/service_mysql_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern "C" struct mysql_string_service_st {
4949
mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle);
5050
void (*mysql_string_free_type)(mysql_string_handle);
5151
void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle);
52-
} * mysql_string_service;
52+
} *mysql_string_service;
5353

5454
#ifdef MYSQL_DYNAMIC_PLUGIN
5555

include/mysql/service_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ extern "C" struct mysql_parser_service_st {
210210
mysql_free_string_t mysql_free_string;
211211
mysql_get_query_t mysql_get_query;
212212
mysql_get_normalized_query_t mysql_get_normalized_query;
213-
} * mysql_parser_service;
213+
} *mysql_parser_service;
214214

215215
#ifdef MYSQL_DYNAMIC_PLUGIN
216216

include/mysql/service_plugin_registry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ extern "C" struct plugin_registry_service_st {
114114
*/
115115
int (*mysql_plugin_registry_release_func)(SERVICE_TYPE(registry) *
116116
registry_ptr);
117-
} * plugin_registry_service;
117+
} *plugin_registry_service;
118118

119119
#ifdef MYSQL_DYNAMIC_PLUGIN
120120
#define mysql_plugin_registry_acquire() \

include/mysql/service_rpl_transaction_ctx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct Transaction_termination_ctx {
6363
extern "C" struct rpl_transaction_ctx_service_st {
6464
int (*set_transaction_ctx)(
6565
Transaction_termination_ctx transaction_termination_ctx);
66-
} * rpl_transaction_ctx_service;
66+
} *rpl_transaction_ctx_service;
6767

6868
#ifdef MYSQL_DYNAMIC_PLUGIN
6969

include/mysql/service_rpl_transaction_write_set.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern "C" struct transaction_write_set_service_st {
6565
void (*require_full_write_set)(bool requires_ws);
6666
void (*set_write_set_memory_size_limit)(uint64 size_limit);
6767
void (*update_write_set_memory_size_limit)(uint64 size_limit);
68-
} * transaction_write_set_service;
68+
} *transaction_write_set_service;
6969

7070
#ifdef MYSQL_DYNAMIC_PLUGIN
7171

include/mysql/service_security_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extern "C" struct security_context_service_st {
121121
*/
122122
my_svc_bool (*security_context_set_option)(MYSQL_SECURITY_CONTEXT,
123123
const char *name, void *pvalue);
124-
} * security_context_service;
124+
} *security_context_service;
125125

126126
#ifdef MYSQL_DYNAMIC_PLUGIN
127127

0 commit comments

Comments
 (0)