Skip to content

Commit 46634c7

Browse files
author
Steinar H. Gunderson
committed
Bug #24710065: SPLIT MY_GLOBAL.H
Run include-what-you-use limited to adding my_loglevel.h and then re-sorting the #includes (and nothing else); then remove my_loglevel.h from my_global.h. Change-Id: I64f29306d5d19e97c3ba5215994d867163522c67
1 parent 1490999 commit 46634c7

25 files changed

+92
-68
lines changed

client/mysql.cc

+16-9
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@
3030
*
3131
**/
3232

33-
#include "client_priv.h"
34-
#include "my_default.h"
3533
#include <m_ctype.h>
36-
#include <stdarg.h>
3734
#include <mf_wcomp.h> // wild_prefix, wild_one, wild_any
3835
#include <my_dir.h>
39-
#include "my_readline.h"
4036
#include <signal.h>
37+
#include <stdarg.h>
4138
#include <violite.h>
42-
#include "prealloced_array.h"
39+
40+
#include "client_priv.h"
41+
#include "my_default.h"
42+
#include "my_loglevel.h"
43+
#include "my_readline.h"
4344
#include "mysql/service_my_snprintf.h"
45+
#include "prealloced_array.h"
4446

4547
#ifdef HAVE_SYS_IOCTL_H
4648
#include <sys/ioctl.h>
@@ -61,18 +63,20 @@
6163

6264
#if defined(_WIN32)
6365
#include <conio.h>
66+
6467
// Not using syslog but EventLog on Win32, so a dummy facility is enough.
6568
#define LOG_USER 0
6669
#else
67-
#include <syslog.h>
6870
#include <readline.h>
71+
#include <syslog.h>
72+
6973
#define HAVE_READLINE
7074
#define USE_POPEN
7175
#endif
7276

73-
#include <algorithm>
74-
#include <sql_common.h>
7577
#include <mysqld_error.h>
78+
#include <sql_common.h>
79+
#include <algorithm>
7680

7781
using std::min;
7882
using std::max;
@@ -99,9 +103,10 @@ static char *server_version= NULL;
99103
#define cmp_database(cs,A,B) strcmp((A),(B))
100104
#endif
101105

102-
#include "completion_hash.h"
103106
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
104107

108+
#include "completion_hash.h"
109+
105110
#define PROMPT_CHAR '\\'
106111
#define DEFAULT_DELIMITER ";"
107112

@@ -1808,6 +1813,7 @@ static struct my_option my_long_options[] =
18081813
&opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
18091814
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
18101815
#include "sslopt-longopts.h"
1816+
18111817
{"table", 't', "Output in table format.", &output_tables,
18121818
&output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
18131819
{"tee", OPT_TEE,
@@ -2114,6 +2120,7 @@ get_one_option(int optid, const struct my_option *opt MY_ATTRIBUTE((unused)),
21142120
#endif
21152121
break;
21162122
#include <sslopt-case.h>
2123+
21172124
case 'V':
21182125
usage(1);
21192126
exit(0);

include/my_global.h

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "my_double2ulonglong.h"
5656
#include "my_inttypes.h"
5757
#include "my_io.h"
58-
#include "my_loglevel.h"
5958
#include "my_macros.h"
6059
#include "my_sharedlib.h"
6160
#include "my_shm_defaults.h"

libmysql/client_settings.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2003, 2016, 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
@@ -19,6 +19,9 @@
1919
#error You have already included an client_settings.h and it should not be included twice
2020
#endif /* CLIENT_SETTINGS_INCLUDED */
2121

22+
#include "my_macros.h"
23+
#include "mysql.h"
24+
2225
extern uint mysql_port;
2326
extern char * mysql_unix_port;
2427

libmysqld/lib_sql.cc

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@
1818
This code was modified by the MySQL team
1919
*/
2020

21-
#include "my_global.h"
22-
#include "mysql.h"
23-
#include "errmsg.h"
24-
#include "embedded_priv.h"
25-
#include "client_settings.h"
26-
#include "my_default.h"
21+
#include <algorithm>
2722

23+
#include "../storage/perfschema/pfs_server.h"
24+
#include "client_settings.h"
2825
#include "current_thd.h"
26+
#include "embedded_priv.h"
27+
#include "errmsg.h"
2928
#include "log.h"
29+
#include "my_default.h"
30+
#include "my_global.h"
31+
#include "my_loglevel.h"
32+
#include "mysql.h"
3033
#include "mysqld.h"
3134
#include "mysqld_embedded.h"
3235
#include "mysqld_thd_manager.h"
@@ -39,10 +42,6 @@
3942
#include "sql_table.h"
4043
#include "sql_thd_internal_api.h"
4144
#include "tztime.h"
42-
#include "../storage/perfschema/pfs_server.h"
43-
44-
#include "sql_db.h" // mysql_change_db
45-
#include <algorithm>
4645

4746
using std::min;
4847
using std::max;

mysys_ssl/my_default.cc

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "m_string.h"
4747
#include "my_default.h"
4848
#include "my_default_priv.h"
49+
#include "my_loglevel.h"
4950
#include "my_psi_config.h"
5051
#include "mysql/psi/mysql_file.h"
5152
#include "mysql/service_my_snprintf.h"

mysys_ssl/my_getopt.cc

+8-7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
@file mysys_ssl/my_getopt.cc
1818
*/
1919

20-
#include <my_global.h>
21-
#include <m_string.h>
22-
#include <stdlib.h>
23-
#include <mysys_err.h>
24-
#include <my_getopt.h>
2520
#include <errno.h>
26-
#include <m_string.h>
27-
#include "my_default.h"
2821
#include <m_ctype.h>
22+
#include <m_string.h>
23+
#include <my_getopt.h>
24+
#include <my_global.h>
25+
#include <mysys_err.h>
26+
#include <stdlib.h>
27+
2928
#include "../mysys/mysys_priv.h"
29+
#include "my_default.h"
30+
#include "my_loglevel.h"
3031
#include "mysql/service_mysql_alloc.h"
3132
#include "typelib.h"
3233

rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License as
@@ -39,6 +39,7 @@
3939
#include "expr_parser.h"
4040
#include "m_string.h" // needed by writer.h, but has to be included after expr_parser.h
4141
#include "my_global.h"
42+
#include "my_loglevel.h"
4243
#include "mysqlx_crud.h"
4344
#include "mysqlx_error.h"
4445
#include "mysqlx_protocol.h"

sql-common/client.cc

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <my_global.h>
3535

3636
#include "hash.h"
37+
#include "my_loglevel.h"
3738
#include "my_psi_config.h"
3839
#include "mysql.h"
3940
#include "mysql/client_authentication.h"

sql/log.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "my_compiler.h"
2626
#include "my_dbug.h"
2727
#include "my_global.h"
28+
#include "my_loglevel.h"
2829
#include "my_psi_config.h"
2930
#include "my_sys.h"
3031
#include "my_thread_local.h"

sql/log_event.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "my_byteorder.h"
3939
#include "my_compiler.h"
4040
#include "my_decimal.h" // my_decimal
41+
#include "my_loglevel.h"
4142
#include "my_time.h" // MAX_DATE_STRING_REP_LENGTH
4243
#include "mysql.h" // MYSQL_OPT_MAX_ALLOWED_PACKET
4344
#include "mysql/service_my_snprintf.h" // my_snprintf
@@ -69,24 +70,24 @@
6970
#include "enum_query_type.h"
7071
#include "field.h"
7172
#include "handler.h"
72-
#include "item_func.h" // Item_func_set_user_var
7373
#include "item.h"
74+
#include "item_func.h" // Item_func_set_user_var
7475
#include "key.h"
7576
#include "log.h" // Log_throttle
7677
#include "mdl.h"
7778
#include "my_base.h"
7879
#include "my_command.h"
7980
#include "my_dir.h" // my_dir
8081
#include "my_sqlcommand.h"
81-
#include "mysqld_error.h"
82-
#include "mysqld.h" // lower_case_table_names server_uuid ...
8382
#include "mysql/plugin.h"
8483
#include "mysql/psi/mysql_cond.h"
8584
#include "mysql/psi/mysql_file.h"
8685
#include "mysql/psi/mysql_stage.h"
8786
#include "mysql/psi/mysql_statement.h"
8887
#include "mysql/psi/mysql_transaction.h"
8988
#include "mysql/psi/psi_statement.h"
89+
#include "mysqld.h" // lower_case_table_names server_uuid ...
90+
#include "mysqld_error.h"
9091
#include "pfs_file_provider.h"
9192
#include "prealloced_array.h"
9293
#include "protocol.h"

sql/mysqld.cc

+20-23
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@
341341
#include "my_decimal.h"
342342
#include "my_default.h" // print_defaults
343343
#include "my_dir.h"
344+
#include "my_loglevel.h"
344345
#include "my_regex.h"
345346
#include "my_stacktrace.h" // my_set_exception_pointers
346347
#include "my_time.h"
@@ -370,8 +371,8 @@
370371
#include "mysql_time.h"
371372
#include "mysql_version.h"
372373
#include "mysqld_daemon.h"
373-
#include "mysqld_error.h"
374374
#include "mysqld_embedded.h" // IWYU pragma: keep
375+
#include "mysqld_error.h"
375376
#include "mysqld_thd_manager.h" // Global_THD_manager
376377
#include "mysys_err.h" // EXIT_OUT_OF_MEMORY
377378
#include "opt_costconstantcache.h" // delete_optimizer_cost_module
@@ -449,24 +450,22 @@
449450
#include "shared_memory_connection.h"
450451
#endif
451452

452-
#include <algorithm>
453-
#include <atomic>
454-
#include <functional>
455-
#include <list>
456-
#include <set>
457-
#include <string>
458-
#include <vector>
459-
460453
#include <errno.h>
461454
#include <fcntl.h>
462455
#include <fenv.h>
463456
#include <limits.h>
457+
#ifdef HAVE_GRP_H
458+
#include <grp.h>
459+
#endif
464460
#ifndef _WIN32
465461
#include <netdb.h>
466462
#endif
467463
#ifdef HAVE_NETINET_IN_H
468464
#include <netinet/in.h>
469465
#endif
466+
#ifdef HAVE_PWD_H
467+
#include <pwd.h>
468+
#endif
470469
#include <signal.h>
471470
#include <stdarg.h>
472471
#include <stddef.h>
@@ -476,29 +475,27 @@
476475
#ifdef HAVE_SYS_MMAN_H
477476
#include <sys/mman.h>
478477
#endif
478+
#ifdef HAVE_SYS_RESOURCE_H
479+
#include <sys/resource.h>
480+
#endif
479481
#include <sys/stat.h>
480482
#ifdef HAVE_UNISTD_H
481483
#include <unistd.h>
482484
#endif
483-
#include <algorithm>
484-
#include <functional>
485-
#include <new>
486-
#include <string>
487-
#include <vector>
488-
#ifdef HAVE_PWD_H
489-
#include <pwd.h>
490-
#endif
491-
#ifdef HAVE_GRP_H
492-
#include <grp.h>
493-
#endif
494-
#ifdef HAVE_SYS_RESOURCE_H
495-
#include <sys/resource.h>
496-
#endif
497485
#ifdef _WIN32
498486
#include <crtdbg.h>
499487
#include <process.h>
500488
#endif
501489

490+
#include <algorithm>
491+
#include <atomic>
492+
#include <functional>
493+
#include <list>
494+
#include <set>
495+
#include <string>
496+
#include <vector>
497+
#include <new>
498+
502499
#ifndef EMBEDDED_LIBRARY
503500
#include "srv_session.h"
504501
#endif

sql/persisted_variable.cc

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "my_dbug.h"
3333
#include "my_default.h" // check_file_permissions
3434
#include "my_getopt.h"
35+
#include "my_loglevel.h"
3536
#include "my_sys.h"
3637
#include "my_thread.h"
3738
#include "mysql/plugin.h"

sql/persistent_dynamic_loader.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */
3333
#include "handler.h"
3434
#include "key.h"
3535
#include "log.h" // error_log_print
36-
#include "mdl.h"
3736
#include "m_string.h"
37+
#include "mdl.h"
3838
#include "my_base.h"
3939
#include "my_compiler.h"
4040
#include "my_dbug.h"
4141
#include "my_global.h"
42+
#include "my_loglevel.h"
43+
#include "my_sys.h"
4244
#include "mysql/components/service_implementation.h"
4345
#include "mysqld_error.h"
44-
#include "my_sys.h"
4546
#include "records.h"
4647
#include "sql_base.h"
4748
#include "sql_class.h"

sql/protocol_classic.cc

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
#include "my_byteorder.h"
223223
#include "my_compiler.h"
224224
#include "my_dbug.h"
225+
#include "my_loglevel.h"
225226
#include "my_sys.h"
226227
#include "my_time.h"
227228
#include "mysql/com_data.h"

sql/rpl_reporting.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include "my_compiler.h"
2525
#include "my_global.h"
26+
#include "my_loglevel.h"
2627
#include "my_sys.h" // my_time
2728
#include "mysql/psi/mysql_mutex.h"
2829

sql/rpl_rli.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
#ifndef RPL_RLI_H
1717
#define RPL_RLI_H
1818

19+
#include <sys/types.h>
20+
#include <time.h>
1921
#include <atomic>
2022
#include <string>
2123
#include <vector>
2224

23-
#include <sys/types.h>
24-
#include <time.h>
25-
2625
#include "binlog.h" // MYSQL_BIN_LOG
2726
#include "handler.h"
2827
#include "m_string.h"
2928
#include "my_bitmap.h"
3029
#include "my_dbug.h"
3130
#include "my_global.h"
31+
#include "my_loglevel.h"
3232
#include "my_psi_config.h"
3333
#include "my_sys.h"
3434
#include "mysql/psi/mysql_cond.h"

0 commit comments

Comments
 (0)