Skip to content

Commit 3d09732

Browse files
committed
Bug#36500268 Upgrade to clang-format 15 [8.0]
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: Ia72205fd259f428bde7e6f952e5b105844fee91f
1 parent 2cd3dad commit 3d09732

File tree

293 files changed

+1325
-1378
lines changed

Some content is hidden

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

293 files changed

+1325
-1378
lines changed

.clang-format

Lines changed: 2 additions & 11 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,8 +206,7 @@ UseTab: Never
210206
DerivePointerAlignment: false
211207
PointerAlignment: Right
212208

213-
# MySQL source code is allowed to use C++11 (and C++14) features.
214-
Standard: Cpp11
209+
Standard: Latest
215210

216211
# MySQL includes frequently are not order-independent (e.g. my_config.h needs
217212
# to go on top). This is unfortunate, but not something we can change easily,
@@ -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/base/ssl_options.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ void Mysql_connection_options::Ssl_options::create_options() {
7979
"succeed even if session data cannot be reused.");
8080
}
8181

82-
void Mysql_connection_options::Ssl_options::ca_option_callback(char *argument [
83-
[maybe_unused]]) {
82+
void Mysql_connection_options::Ssl_options::ca_option_callback(
83+
char *argument [[maybe_unused]]) {
8484
if (!ssl_mode_set_explicitly) ::opt_ssl_mode = SSL_MODE_VERIFY_CA;
8585
}
8686

client/mysql.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,15 +2247,11 @@ static int read_and_execute(bool interactive) {
22472247
if (!glob_buffer.length()) status.query_start_line = line_number;
22482248
} else {
22492249
const char *prompt =
2250-
(ml_comment
2251-
? " /*> "
2252-
: glob_buffer.is_empty()
2253-
? construct_prompt()
2254-
: !in_string
2255-
? " -> "
2256-
: in_string == '\''
2257-
? " '> "
2258-
: (in_string == '`' ? " `> " : " \"> "));
2250+
(ml_comment ? " /*> "
2251+
: glob_buffer.is_empty() ? construct_prompt()
2252+
: !in_string ? " -> "
2253+
: in_string == '\'' ? " '> "
2254+
: (in_string == '`' ? " `> " : " \"> "));
22592255
if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE);
22602256

22612257
#if defined(_WIN32)
@@ -3029,7 +3025,8 @@ void add_syslog(const char *line) {
30293025
"CONNECTION_ID:%lu, DB_SERVER:'%s', DB:'%s', QUERY:'%s'",
30303026
/* use the cached user/sudo_user value. */
30313027
current_os_sudouser ? current_os_sudouser
3032-
: current_os_user ? current_os_user : "--",
3028+
: current_os_user ? current_os_user
3029+
: "--",
30333030
current_user ? current_user : "--", mysql_thread_id(&mysql),
30343031
current_host ? current_host : "--", current_db ? current_db : "--",
30353032
line);

client/mysqlbinlog.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,8 +2264,10 @@ extern "C" bool get_one_option(int optid, const struct my_option *opt,
22642264
"--read-from-remote-source"));
22652265
[[fallthrough]];
22662266
case OPT_REMOTE_PROTO:
2267-
opt_remote_proto = (enum_remote_proto)(
2268-
find_type_or_exit(argument, &remote_proto_typelib, opt->name) - 1);
2267+
opt_remote_proto =
2268+
(enum_remote_proto)(find_type_or_exit(argument, &remote_proto_typelib,
2269+
opt->name) -
2270+
1);
22692271
break;
22702272
case OPT_MYSQL_PROTOCOL:
22712273
opt_protocol =
@@ -2278,9 +2280,11 @@ extern "C" bool get_one_option(int optid, const struct my_option *opt,
22782280
stop_datetime = convert_str_to_timestamp(stop_datetime_str);
22792281
break;
22802282
case OPT_BASE64_OUTPUT_MODE:
2281-
opt_base64_output_mode = (enum_base64_output_mode)(
2282-
find_type_or_exit(argument, &base64_output_mode_typelib, opt->name) -
2283-
1);
2283+
opt_base64_output_mode =
2284+
(enum_base64_output_mode)(find_type_or_exit(
2285+
argument, &base64_output_mode_typelib,
2286+
opt->name) -
2287+
1);
22842288
break;
22852289
case 'v':
22862290
if (argument == disabled_my_option)

client/mysqldump.cc

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5812,9 +5812,9 @@ static bool get_view_structure(char *table, char *db) {
58125812
search_len =
58135813
(ulong)(strxmov(ptr, "WITH ", row[0], " CHECK OPTION", NullS) - ptr);
58145814
ptr = replace_buf;
5815-
replace_len = (ulong)(
5816-
strxmov(ptr, "*/\n/*!50002 WITH ", row[0], " CHECK OPTION", NullS) -
5817-
ptr);
5815+
replace_len = (ulong)(strxmov(ptr, "*/\n/*!50002 WITH ", row[0],
5816+
" CHECK OPTION", NullS) -
5817+
ptr);
58185818
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
58195819
}
58205820

@@ -5834,19 +5834,23 @@ static bool get_view_structure(char *table, char *db) {
58345834
host_name_str, &host_name_len);
58355835

58365836
ptr = search_buf;
5837-
search_len = (ulong)(
5838-
strxmov(ptr, "DEFINER=",
5839-
quote_name(user_name_str, quoted_user_name_str, false), "@",
5840-
quote_name(host_name_str, quoted_host_name_str, false),
5841-
" SQL SECURITY ", row[2], NullS) -
5842-
ptr);
5837+
search_len =
5838+
(ulong)(strxmov(
5839+
ptr, "DEFINER=",
5840+
quote_name(user_name_str, quoted_user_name_str, false),
5841+
"@",
5842+
quote_name(host_name_str, quoted_host_name_str, false),
5843+
" SQL SECURITY ", row[2], NullS) -
5844+
ptr);
58435845
ptr = replace_buf;
5844-
replace_len = (ulong)(
5845-
strxmov(ptr, "*/\n/*!50013 DEFINER=",
5846-
quote_name(user_name_str, quoted_user_name_str, false), "@",
5847-
quote_name(host_name_str, quoted_host_name_str, false),
5848-
" SQL SECURITY ", row[2], " */\n/*!50001", NullS) -
5849-
ptr);
5846+
replace_len =
5847+
(ulong)(strxmov(
5848+
ptr, "*/\n/*!50013 DEFINER=",
5849+
quote_name(user_name_str, quoted_user_name_str, false),
5850+
"@",
5851+
quote_name(host_name_str, quoted_host_name_str, false),
5852+
" SQL SECURITY ", row[2], " */\n/*!50001", NullS) -
5853+
ptr);
58505854
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
58515855
}
58525856

client/mysqlshow.cc

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

616616
print_trailer(
617-
head_length, (opt_table_type ? 10 : opt_verbose > 0 ? 8 : 0),
617+
head_length,
618+
(opt_table_type ? 10
619+
: opt_verbose > 0 ? 8
620+
: 0),
618621
(opt_table_type ? (opt_verbose > 0 ? 8 : 0) : (opt_verbose > 1 ? 10 : 0)),
619-
!opt_table_type ? 0 : opt_verbose > 1 ? 10 : 0, 0);
622+
!opt_table_type ? 0
623+
: opt_verbose > 1 ? 10
624+
: 0,
625+
0);
620626

621627
if (counter && opt_verbose)
622628
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
@@ -2856,7 +2856,7 @@ static void var_set_escape(struct st_command *command, VAR *dst) {
28562856
- the second string,
28572857
- a bool that is false if the parsing succeeded; true if it failed.
28582858
*/
2859-
auto parse_args = [&]() -> auto {
2859+
auto parse_args = [&]() -> auto{
28602860
// command->first_argument contains '(characters,text)'
28612861
char *p = command->first_argument;
28622862
// Find (
@@ -3532,7 +3532,7 @@ static void free_dynamic_strings(T *val) {
35323532
/// the function, through recursion, end up being
35333533
/// freed by dynstr_free().
35343534
template <typename T1, typename... T2>
3535-
static void free_dynamic_strings(T1 *first, T2 *... rest) {
3535+
static void free_dynamic_strings(T1 *first, T2 *...rest) {
35363536
free_dynamic_strings(first);
35373537
free_dynamic_strings(rest...);
35383538
}

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 {

include/my_alloc.h

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

491491
template <typename T, typename... Args>
492492
unique_ptr_destroy_only<T> make_unique_destroy_only(MEM_ROOT *mem_root,
493-
Args &&... args) {
493+
Args &&...args) {
494494
return unique_ptr_destroy_only<T>(new (mem_root)
495495
T(std::forward<Args>(args)...));
496496
}

include/my_bit.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,27 @@ static inline uint my_count_bits(ulonglong v) {
5656
/* The following code is a bit faster on 16 bit machines than if we would
5757
only shift v */
5858
ulong v2 = (ulong)(v >> 32);
59-
return (uint)(uchar)(
60-
_my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
61-
_my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)] +
62-
_my_bits_nbits[(uchar)(v2)] + _my_bits_nbits[(uchar)(v2 >> 8)] +
63-
_my_bits_nbits[(uchar)(v2 >> 16)] + _my_bits_nbits[(uchar)(v2 >> 24)]);
59+
return (uint)(uchar)(_my_bits_nbits[(uchar)v] +
60+
_my_bits_nbits[(uchar)(v >> 8)] +
61+
_my_bits_nbits[(uchar)(v >> 16)] +
62+
_my_bits_nbits[(uchar)(v >> 24)] +
63+
_my_bits_nbits[(uchar)(v2)] +
64+
_my_bits_nbits[(uchar)(v2 >> 8)] +
65+
_my_bits_nbits[(uchar)(v2 >> 16)] +
66+
_my_bits_nbits[(uchar)(v2 >> 24)]);
6467
#else
65-
return (uint)(uchar)(
66-
_my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
67-
_my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)]);
68+
return (uint)(uchar)(_my_bits_nbits[(uchar)v] +
69+
_my_bits_nbits[(uchar)(v >> 8)] +
70+
_my_bits_nbits[(uchar)(v >> 16)] +
71+
_my_bits_nbits[(uchar)(v >> 24)]);
6872
#endif
6973
}
7074

7175
static inline uint my_count_bits_uint32(uint32 v) {
72-
return (uint)(uchar)(
73-
_my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
74-
_my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)]);
76+
return (uint)(uchar)(_my_bits_nbits[(uchar)v] +
77+
_my_bits_nbits[(uchar)(v >> 8)] +
78+
_my_bits_nbits[(uchar)(v >> 16)] +
79+
_my_bits_nbits[(uchar)(v >> 24)]);
7580
}
7681

7782
/*

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
@@ -107,7 +107,7 @@ typedef int (*mysql_release_locks_t)(MYSQL_THD opaque_thd,
107107
extern "C" struct mysql_locking_service_st {
108108
mysql_acquire_locks_t mysql_acquire_locks;
109109
mysql_release_locks_t mysql_release_locks;
110-
} * mysql_locking_service;
110+
} *mysql_locking_service;
111111

112112
#ifdef MYSQL_DYNAMIC_PLUGIN
113113

include/mysql/service_my_plugin_log.h

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

5656
#ifdef MYSQL_DYNAMIC_PLUGIN
5757

include/mysql/service_mysql_keyring.h

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

8787
#ifdef MYSQL_DYNAMIC_PLUGIN
8888

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

0 commit comments

Comments
 (0)