Skip to content

Commit 7a732a3

Browse files
author
Steinar H. Gunderson
committed
Bug #26781567: REMOVE C LEGACY [noclose]
Convert the remaining C files to C++, except for external source code (e.g. memcached) and a few .c files that are there to verify that our client library still builds from C code. The only real exception is libservices/, where ODR violations (services are defined as structs in some files and as void * in others) mean that linking with C++ linkage would break linking on Windows. Post-push fix, second try: Make stack_direction.cc a .c file again, since it doesn't compile as C++, and thus silently makes us think the stack grows upwards. Change-Id: I61f6a281ffcd5c0fca9f4b9976aeb580dd1b0b65
1 parent c36a259 commit 7a732a3

File tree

251 files changed

+397
-392
lines changed

Some content is hidden

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

251 files changed

+397
-392
lines changed

client/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ SET_TARGET_PROPERTIES(mysql_ssl_rsa_setup PROPERTIES LINKER_LANGUAGE CXX)
106106

107107
# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
108108
IF(WIN32)
109-
MYSQL_ADD_EXECUTABLE(echo echo.c)
109+
MYSQL_ADD_EXECUTABLE(echo echo.cc)
110110
ENDIF(WIN32)

client/base/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ ADD_CONVENIENCE_LIBRARY(client_base
4040

4141
mutex.cc
4242

43-
../get_password.c
43+
../get_password.cc
4444

4545
../../sql-common/sql_string.cc
4646
)

client/echo.c renamed to client/echo.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2007 MySQL AB
1+
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
22
Use is subject to license terms
33
44
This program is free software; you can redistribute it and/or modify
File renamed without changes.

cmake/stack_direction.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
2-
Copyright (c) 2009 Sun Microsystems, Inc.
3-
Use is subject to license terms.
2+
Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
43
54
This program is free software; you can redistribute it and/or modify
65
it under the terms of the GNU General Public License as published by

dbug/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# along with this program; if not, write to the Free Software
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

16-
SET(DBUG_SOURCES dbug.c)
16+
SET(DBUG_SOURCES dbug.cc)
1717
ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES})
1818
TARGET_LINK_LIBRARIES(dbug mysys)

dbug/dbug.c renamed to dbug/dbug.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ static bool Writable(const char *pathname)
22492249
}
22502250
else
22512251
{
2252-
lastslash= strrchr(pathname, '/');
2252+
lastslash= strrchr(const_cast<char *>(pathname), '/');
22532253
if (lastslash != NULL)
22542254
*lastslash= '\0';
22552255
else
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

extra/yassl/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ENDIF()
3636
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
3737
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
3838
src/yassl_imp.cpp src/yassl_int.cpp
39-
../../client/get_password.c )
39+
../../client/get_password.cc )
4040

4141
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
4242

include/myisam.h

-7
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#include "my_io.h"
3838
#include "my_macros.h"
3939

40-
#ifdef __cplusplus
41-
extern "C" {
42-
#endif
43-
4440
/*
4541
Limit max keys according to HA_MAX_POSSIBLE_KEY
4642
*/
@@ -476,7 +472,4 @@ int mi_preload(MI_INFO *info, ulonglong key_map, bool ignore_leaves);
476472

477473
extern st_keycache_thread_var main_thread_keycache_var;
478474
st_keycache_thread_var *keycache_thread_var();
479-
#ifdef __cplusplus
480-
}
481-
#endif
482475
#endif

include/myisammrg.h

-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "storage/myisam/queues.h"
3333
#include "typelib.h"
3434

35-
C_MODE_START
36-
3735
#define MYRG_NAME_EXT ".MRG"
3836

3937
/* In which table to INSERT rows */
@@ -121,6 +119,4 @@ extern ha_rows myrg_records(MYRG_INFO *info);
121119

122120
extern ulonglong myrg_position(MYRG_INFO *info);
123121

124-
C_MODE_END
125-
126122
#endif /* _myisammrg_h */

libmysql/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ SET(CLIENT_SOURCES
159159
libmysql.cc
160160
errmsg.cc
161161
../sql-common/client.cc
162-
../sql-common/client_plugin.c
162+
../sql-common/client_plugin.cc
163163
../sql-common/client_authentication.cc
164164
../sql-common/net_serv.cc
165165
../sql/auth/password.cc
@@ -180,7 +180,7 @@ ENDIF()
180180
#
181181
IF (WITH_CLIENT_PROTOCOL_TRACING)
182182

183-
LIST(APPEND CLIENT_SOURCES mysql_trace.c)
183+
LIST(APPEND CLIENT_SOURCES mysql_trace.cc)
184184
ADD_DEFINITIONS(-D CLIENT_PROTOCOL_TRACING)
185185

186186
IF (WITH_TEST_TRACE_PLUGIN)

libmysql/mysql_trace.c renamed to libmysql/mysql_trace.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void mysql_trace_start(struct st_mysql *m)
7575
{
7676
struct st_mysql_trace_info *trace_info;
7777

78-
trace_info= my_malloc(PSI_NOT_INSTRUMENTED,
78+
trace_info= (st_mysql_trace_info *)my_malloc(PSI_NOT_INSTRUMENTED,
7979
sizeof(struct st_mysql_trace_info),
8080
MYF(MY_ZEROFILL));
8181
if (!trace_info)

libservices/locking_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *mysql_locking_service= (void*)VERSION_locking_service;
19+
SERVICE_VERSION *mysql_locking_service= (void**)VERSION_locking_service;

libservices/my_plugin_log_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *my_plugin_log_service= (void*)VERSION_my_plugin_log;
19+
SERVICE_VERSION *my_plugin_log_service= (void**)VERSION_my_plugin_log;

libservices/my_thread_scheduler_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
#include "service_versions.h"
1919

2020
SERVICE_VERSION my_thread_scheduler_service=
21-
(void*)VERSION_my_thread_scheduler;
21+
(void**)VERSION_my_thread_scheduler;

libservices/mysql_keyring_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *mysql_keyring_service= (void*)VERSION_mysql_keyring_service;
19+
SERVICE_VERSION *mysql_keyring_service= (void**)VERSION_mysql_keyring_service;
2020

libservices/mysql_malloc_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
#include "service_versions.h"
1717

18-
SERVICE_VERSION *mysql_malloc_service= (void*)VERSION_mysql_malloc;
18+
SERVICE_VERSION *mysql_malloc_service= (void**)VERSION_mysql_malloc;

libservices/mysql_password_policy_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *mysql_password_policy_service= (void*)VERSION_mysql_password_policy;
19+
SERVICE_VERSION *mysql_password_policy_service= (void**)VERSION_mysql_password_policy;
2020

libservices/mysql_string_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *mysql_string_service= (void*)VERSION_mysql_string;
19+
SERVICE_VERSION *mysql_string_service= (void**)VERSION_mysql_string;

libservices/parser_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *mysql_parser_service= (void*)VERSION_parser;
19+
SERVICE_VERSION *mysql_parser_service= (void**)VERSION_parser;

libservices/plugin_registry_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *plugin_registry_service= (void*)VERSION_plugin_registry_service;
19+
SERVICE_VERSION *plugin_registry_service= (void**)VERSION_plugin_registry_service;

libservices/rpl_transaction_ctx_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
#include "service_versions.h"
1717

18-
SERVICE_VERSION *rpl_transaction_ctx_service= (void*)VERSION_rpl_transaction_ctx_service;
18+
SERVICE_VERSION *rpl_transaction_ctx_service= (void**)VERSION_rpl_transaction_ctx_service;

libservices/rpl_transaction_write_set_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
#include "service_versions.h"
1717

18-
SERVICE_VERSION *transaction_write_set_service= (void*)VERSION_transaction_write_set_service;
18+
SERVICE_VERSION *transaction_write_set_service= (void**)VERSION_transaction_write_set_service;

libservices/security_context_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#include "service_versions.h"
1919

20-
SERVICE_VERSION *security_context_service= (void*)VERSION_security_context_service;
20+
SERVICE_VERSION *security_context_service= (void**)VERSION_security_context_service;

libservices/service_command.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#include "service_versions.h"
1919

20-
SERVICE_VERSION *command_service= (void*)VERSION_command;
20+
SERVICE_VERSION *command_service= (void**)VERSION_command;

libservices/srv_session_info_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#include "service_versions.h"
1919

20-
SERVICE_VERSION *srv_session_info_service= (void*)VERSION_srv_session_info_service;
20+
SERVICE_VERSION *srv_session_info_service= (void**)VERSION_srv_session_info_service;

libservices/srv_session_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#include "service_versions.h"
1919

20-
SERVICE_VERSION *srv_session_service= (void*)VERSION_srv_session_service;
20+
SERVICE_VERSION *srv_session_service= (void**)VERSION_srv_session_service;

libservices/thd_alloc_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "service_versions.h"
1818

19-
SERVICE_VERSION *thd_alloc_service= (void*)VERSION_thd_alloc;
19+
SERVICE_VERSION *thd_alloc_service= (void**)VERSION_thd_alloc;

libservices/thd_wait_service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#include "service_versions.h"
1919

20-
SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait;
20+
SERVICE_VERSION *thd_wait_service= (void**)VERSION_thd_wait;

mysql-test/suite/perfschema/r/myisam_file_io.result

+22-22
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,28 @@ where operation not like "tell"
2020
and event_name like "wait/io/file/myisam/%"
2121
order by thread_id, event_id;
2222
event_name short_source operation number_of_bytes short_name
23-
wait/io/file/myisam/kfile mi_create.c: create NULL no_index_tab.MYI
24-
wait/io/file/myisam/dfile mi_create.c: create NULL no_index_tab.MYD
25-
wait/io/file/myisam/kfile mi_open.c: write 176 no_index_tab.MYI
26-
wait/io/file/myisam/kfile mi_open.c: write 100 no_index_tab.MYI
27-
wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI
28-
wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI
29-
wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI
30-
wait/io/file/myisam/kfile mi_create.c: chsize 1024 no_index_tab.MYI
31-
wait/io/file/myisam/dfile mi_create.c: close NULL no_index_tab.MYD
32-
wait/io/file/myisam/kfile mi_create.c: close NULL no_index_tab.MYI
33-
wait/io/file/myisam/kfile mi_open.c: open NULL no_index_tab.MYI
34-
wait/io/file/myisam/kfile mi_open.c: read 24 no_index_tab.MYI
35-
wait/io/file/myisam/kfile mi_open.c: seek NULL no_index_tab.MYI
36-
wait/io/file/myisam/kfile mi_open.c: read 297 no_index_tab.MYI
37-
wait/io/file/myisam/dfile mi_open.c: open NULL no_index_tab.MYD
38-
wait/io/file/myisam/kfile mi_locking.c: write 3 no_index_tab.MYI
39-
wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD
40-
wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI
41-
wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD
42-
wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI
43-
wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD
44-
wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI
23+
wait/io/file/myisam/kfile mi_create.cc: create NULL no_index_tab.MYI
24+
wait/io/file/myisam/dfile mi_create.cc: create NULL no_index_tab.MYD
25+
wait/io/file/myisam/kfile mi_open.cc: write 176 no_index_tab.MYI
26+
wait/io/file/myisam/kfile mi_open.cc: write 100 no_index_tab.MYI
27+
wait/io/file/myisam/kfile mi_open.cc: write 7 no_index_tab.MYI
28+
wait/io/file/myisam/kfile mi_open.cc: write 7 no_index_tab.MYI
29+
wait/io/file/myisam/kfile mi_open.cc: write 7 no_index_tab.MYI
30+
wait/io/file/myisam/kfile mi_create.cc: chsize 1024 no_index_tab.MYI
31+
wait/io/file/myisam/dfile mi_create.cc: close NULL no_index_tab.MYD
32+
wait/io/file/myisam/kfile mi_create.cc: close NULL no_index_tab.MYI
33+
wait/io/file/myisam/kfile mi_open.cc: open NULL no_index_tab.MYI
34+
wait/io/file/myisam/kfile mi_open.cc: read 24 no_index_tab.MYI
35+
wait/io/file/myisam/kfile mi_open.cc: seek NULL no_index_tab.MYI
36+
wait/io/file/myisam/kfile mi_open.cc: read 297 no_index_tab.MYI
37+
wait/io/file/myisam/dfile mi_open.cc: open NULL no_index_tab.MYD
38+
wait/io/file/myisam/kfile mi_locking.cc: write 3 no_index_tab.MYI
39+
wait/io/file/myisam/dfile mi_dynrec.cc: write 20 no_index_tab.MYD
40+
wait/io/file/myisam/kfile mi_open.cc: write 124 no_index_tab.MYI
41+
wait/io/file/myisam/dfile mi_dynrec.cc: write 20 no_index_tab.MYD
42+
wait/io/file/myisam/kfile mi_open.cc: write 124 no_index_tab.MYI
43+
wait/io/file/myisam/dfile mi_dynrec.cc: write 20 no_index_tab.MYD
44+
wait/io/file/myisam/kfile mi_open.cc: write 124 no_index_tab.MYI
4545
show global status like 'performance_schema_%_lost';
4646
Variable_name Value
4747
Performance_schema_accounts_lost 0

mysql-test/suite/perfschema/r/no_threads.result

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ select event_name, operation,
3232
left(source, locate(":", source)) as short_source
3333
from performance_schema.events_waits_current;
3434
event_name operation short_source
35-
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
35+
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.cc:
3636
select event_name, operation,
3737
left(source, locate(":", source)) as short_source
3838
from performance_schema.events_waits_history;
3939
event_name operation short_source
40-
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
40+
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.cc:
4141
select event_name, operation,
4242
left(source, locate(":", source)) as short_source
4343
from performance_schema.events_waits_history_long;
4444
event_name operation short_source
45-
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
45+
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.cc:
4646
update performance_schema.setup_instruments set enabled='YES';
4747
drop table test.t1;

mysql-test/suite/perfschema/r/one_thread_per_con.result

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ create table test.t3(a int) engine=MYISAM;
1616
"----------------- Connection default"
1717
execute stmt_dump_events using @tid;
1818
event_name short_source operation number_of_bytes
19-
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL
19+
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.cc: lock NULL
2020
execute stmt_dump_thread using @tid;
2121
name
2222
thread/sql/one_connection
2323
execute stmt_dump_events using @tid;
2424
event_name short_source operation number_of_bytes
25-
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL
25+
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.cc: lock NULL
2626
execute stmt_dump_thread using @tid;
2727
name
2828
thread/sql/one_connection
2929
execute stmt_dump_events using @tid;
3030
event_name short_source operation number_of_bytes
31-
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL
31+
wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.cc: lock NULL
3232
execute stmt_dump_thread using @tid;
3333
name
3434
thread/sql/one_connection

mysys/my_thr_init.cc

-3
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ static thread_local int THR_myerrno= 0;
5555
static thread_local int THR_winerrno= 0;
5656
#endif
5757

58-
C_MODE_START
5958
mysql_mutex_t THR_LOCK_myisam_mmap;
6059
mysql_mutex_t THR_LOCK_myisam;
6160
mysql_mutex_t THR_LOCK_heap;
62-
C_MODE_END
63-
6461
mysql_mutex_t THR_LOCK_malloc;
6562
mysql_mutex_t THR_LOCK_open;
6663
mysql_mutex_t THR_LOCK_lock;

mysys/mysys_priv.h

-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include "mysql/psi/mysql_stage.h"
2727
#include "mysql/psi/mysql_file.h"
2828

29-
C_MODE_START
30-
3129
extern PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
3230
key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock,
3331
key_THR_LOCK_charset, key_THR_LOCK_heap,
@@ -83,8 +81,6 @@ extern PSI_memory_key key_memory_win_IP_ADAPTER_ADDRESSES;
8381

8482
extern PSI_thread_key key_thread_timer_notifier;
8583

86-
C_MODE_END
87-
8884
/*
8985
EDQUOT is used only in 3 C files only in mysys/. If it does not exist on
9086
system, we set it to some value which can never happen.

plugin/audit_null/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
1313
# along with this program; if not, write to the Free Software
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

16-
MYSQL_ADD_PLUGIN(audit_null audit_null.c
16+
MYSQL_ADD_PLUGIN(audit_null audit_null.cc
1717
MODULE_ONLY MODULE_OUTPUT_NAME "adt_null")
1818

1919
MYSQL_ADD_PLUGIN(test_security_context test_security_context.cc

plugin/audit_null/audit_null.c renamed to plugin/audit_null/audit_null.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static struct st_mysql_show_var simple_status[] =
122122

123123
#undef AUDIT_NULL_VAR
124124

125-
{ 0, 0, 0, SHOW_SCOPE_GLOBAL }
125+
{ 0, 0, SHOW_UNDEF, SHOW_SCOPE_GLOBAL }
126126
};
127127

128128
/*

0 commit comments

Comments
 (0)