Skip to content

Commit 33c2404

Browse files
committed
Fix Bug#20380977 COMPILER WARNINGS IN MYSQL-5.6
Remove unsued symbols and resolve other compiler warnings accordingly
1 parent 2b45d0b commit 33c2404

23 files changed

Lines changed: 39 additions & 617 deletions

mysys/my_sync.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2003, 2015, 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
@@ -115,6 +115,8 @@ int my_sync(File fd, myf my_flags)
115115
} /* my_sync */
116116

117117

118+
#ifdef NEED_EXPLICIT_SYNC_DIR
119+
118120
static const char cur_dir_name[]= {FN_CURLIB, 0};
119121

120122

@@ -130,8 +132,6 @@ static const char cur_dir_name[]= {FN_CURLIB, 0};
130132
0 if ok, !=0 if error
131133
*/
132134

133-
#ifdef NEED_EXPLICIT_SYNC_DIR
134-
135135
int my_sync_dir(const char *dir_name, myf my_flags)
136136
{
137137
File dir_fd;

mysys/thr_lock.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, 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
@@ -377,18 +377,6 @@ has_old_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner)
377377
return 0;
378378
}
379379

380-
static inline my_bool have_specific_lock(THR_LOCK_DATA *data,
381-
enum thr_lock_type type)
382-
{
383-
for ( ; data ; data=data->next)
384-
{
385-
if (data->type == type)
386-
return 1;
387-
}
388-
return 0;
389-
}
390-
391-
392380
static void wake_up_waiters(THR_LOCK *lock);
393381

394382

mysys/waiting_threads.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2015, 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
@@ -294,7 +294,10 @@ uint32 wt_wait_stats[WT_WAIT_STATS+1];
294294
uint32 wt_cycle_stats[2][WT_CYCLE_STATS+1];
295295
uint32 wt_success_stats;
296296

297-
static my_atomic_rwlock_t cycle_stats_lock, wait_stats_lock, success_stats_lock;
297+
static my_atomic_rwlock_t
298+
cycle_stats_lock __attribute__((unused)),
299+
wait_stats_lock __attribute__((unused)),
300+
success_stats_lock __attribute__((unused));
298301

299302
#ifdef SAFE_STATISTICS
300303
#define incr(VAR, LOCK) \

sql/binlog.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2009, 2015, 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
@@ -770,7 +770,7 @@ class binlog_cache_mngr {
770770
{
771771
my_off_t stmt_bytes= 0;
772772
my_off_t trx_bytes= 0;
773-
DBUG_ASSERT(stmt_cache.has_xid() == 0 && trx_cache.has_xid() <= 1);
773+
DBUG_ASSERT(stmt_cache.has_xid() == 0);
774774
if (int error= stmt_cache.flush(thd, &stmt_bytes, wrote_xid))
775775
return error;
776776
if (int error= trx_cache.flush(thd, &trx_bytes, wrote_xid))

sql/log.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, 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
@@ -1054,7 +1054,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length)
10541054

10551055
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
10561056
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
1057-
sctx->priv_user ? sctx->priv_user : "", "[",
1057+
sctx->priv_user, "[",
10581058
sctx->user ? sctx->user : "", "] @ ",
10591059
sctx->get_host()->length() ?
10601060
sctx->get_host()->ptr() : "", " [",

sql/log_event_old.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2007, 2015, 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
@@ -1688,7 +1688,7 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
16881688
rli->report(ERROR_LEVEL, thd->net.last_errno,
16891689
"Error in %s event: row application failed. %s",
16901690
get_type_str(),
1691-
thd->net.last_error ? thd->net.last_error : "");
1691+
thd->net.last_error);
16921692
thd->is_slave_error= 1;
16931693
break;
16941694
}
@@ -1728,7 +1728,7 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
17281728
"on table %s.%s. %s",
17291729
get_type_str(), table->s->db.str,
17301730
table->s->table_name.str,
1731-
thd->net.last_error ? thd->net.last_error : "");
1731+
thd->net.last_error);
17321732

17331733
/*
17341734
If one day we honour --skip-slave-errors in row-based replication, and

sql/partition_info.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2006, 2015, 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
@@ -34,8 +34,6 @@
3434
partition_info *partition_info::get_clone()
3535
{
3636
DBUG_ENTER("partition_info::get_clone");
37-
if (!this)
38-
DBUG_RETURN(NULL);
3937
List_iterator<partition_element> part_it(partitions);
4038
partition_element *part;
4139
partition_info *clone= new partition_info();

sql/sql_acl.cc

Lines changed: 3 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -183,221 +183,9 @@ TABLE_FIELD_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
183183
}
184184
};
185185

186-
static const
187-
TABLE_FIELD_TYPE mysql_user_table_fields[MYSQL_USER_FIELD_COUNT] = {
188-
{
189-
{ C_STRING_WITH_LEN("Host") },
190-
{ C_STRING_WITH_LEN("char(60)") },
191-
{ NULL, 0 }
192-
},
193-
{
194-
{ C_STRING_WITH_LEN("User") },
195-
{ C_STRING_WITH_LEN("char(16)") },
196-
{ NULL, 0 }
197-
},
198-
{
199-
{ C_STRING_WITH_LEN("Password") },
200-
{ C_STRING_WITH_LEN("char(41)") },
201-
{ C_STRING_WITH_LEN("latin1") }
202-
},
203-
{
204-
{ C_STRING_WITH_LEN("Select_priv") },
205-
{ C_STRING_WITH_LEN("enum('N','Y')") },
206-
{ C_STRING_WITH_LEN("utf8") }
207-
},
208-
{
209-
{ C_STRING_WITH_LEN("Insert_priv") },
210-
{ C_STRING_WITH_LEN("enum('N','Y')") },
211-
{ C_STRING_WITH_LEN("utf8") }
212-
},
213-
{
214-
{ C_STRING_WITH_LEN("Update_priv") },
215-
{ C_STRING_WITH_LEN("enum('N','Y')") },
216-
{ C_STRING_WITH_LEN("utf8") }
217-
},
218-
{
219-
{ C_STRING_WITH_LEN("Delete_priv") },
220-
{ C_STRING_WITH_LEN("enum('N','Y')") },
221-
{ C_STRING_WITH_LEN("utf8") }
222-
},
223-
{
224-
{ C_STRING_WITH_LEN("Create_priv") },
225-
{ C_STRING_WITH_LEN("enum('N','Y')") },
226-
{ C_STRING_WITH_LEN("utf8") }
227-
},
228-
{
229-
{ C_STRING_WITH_LEN("Drop_priv") },
230-
{ C_STRING_WITH_LEN("enum('N','Y')") },
231-
{ C_STRING_WITH_LEN("utf8") }
232-
},
233-
{
234-
{ C_STRING_WITH_LEN("Reload_priv") },
235-
{ C_STRING_WITH_LEN("enum('N','Y')") },
236-
{ C_STRING_WITH_LEN("utf8") }
237-
},
238-
{
239-
{ C_STRING_WITH_LEN("Shutdown_priv") },
240-
{ C_STRING_WITH_LEN("enum('N','Y')") },
241-
{ C_STRING_WITH_LEN("utf8") }
242-
},
243-
{
244-
{ C_STRING_WITH_LEN("Process_priv") },
245-
{ C_STRING_WITH_LEN("enum('N','Y')") },
246-
{ C_STRING_WITH_LEN("utf8") }
247-
},
248-
{
249-
{ C_STRING_WITH_LEN("File_priv") },
250-
{ C_STRING_WITH_LEN("enum('N','Y')") },
251-
{ C_STRING_WITH_LEN("utf8") }
252-
},
253-
{
254-
{ C_STRING_WITH_LEN("Grant_priv") },
255-
{ C_STRING_WITH_LEN("enum('N','Y')") },
256-
{ C_STRING_WITH_LEN("utf8") }
257-
},
258-
{
259-
{ C_STRING_WITH_LEN("References_priv") },
260-
{ C_STRING_WITH_LEN("enum('N','Y')") },
261-
{ C_STRING_WITH_LEN("utf8") }
262-
},
263-
{
264-
{ C_STRING_WITH_LEN("Index_priv") },
265-
{ C_STRING_WITH_LEN("enum('N','Y')") },
266-
{ C_STRING_WITH_LEN("utf8") }
267-
},
268-
{
269-
{ C_STRING_WITH_LEN("Alter_priv") },
270-
{ C_STRING_WITH_LEN("enum('N','Y')") },
271-
{ C_STRING_WITH_LEN("utf8") }
272-
},
273-
{
274-
{ C_STRING_WITH_LEN("Show_db_priv") },
275-
{ C_STRING_WITH_LEN("enum('N','Y')") },
276-
{ C_STRING_WITH_LEN("utf8") }
277-
},
278-
{
279-
{ C_STRING_WITH_LEN("Super_priv") },
280-
{ C_STRING_WITH_LEN("enum('N','Y')") },
281-
{ C_STRING_WITH_LEN("utf8") }
282-
},
283-
{
284-
{ C_STRING_WITH_LEN("Create_tmp_table_priv") },
285-
{ C_STRING_WITH_LEN("enum('N','Y')") },
286-
{ C_STRING_WITH_LEN("utf8") }
287-
},
288-
{
289-
{ C_STRING_WITH_LEN("Lock_tables_priv") },
290-
{ C_STRING_WITH_LEN("enum('N','Y')") },
291-
{ C_STRING_WITH_LEN("utf8") }
292-
},
293-
{
294-
{ C_STRING_WITH_LEN("Execute_priv") },
295-
{ C_STRING_WITH_LEN("enum('N','Y')") },
296-
{ C_STRING_WITH_LEN("utf8") }
297-
},
298-
{
299-
{ C_STRING_WITH_LEN("Repl_slave_priv") },
300-
{ C_STRING_WITH_LEN("enum('N','Y')") },
301-
{ C_STRING_WITH_LEN("utf8") }
302-
},
303-
{
304-
{ C_STRING_WITH_LEN("Repl_client_priv") },
305-
{ C_STRING_WITH_LEN("enum('N','Y')") },
306-
{ C_STRING_WITH_LEN("utf8") }
307-
},
308-
{
309-
{ C_STRING_WITH_LEN("Create_view_priv") },
310-
{ C_STRING_WITH_LEN("enum('N','Y')") },
311-
{ C_STRING_WITH_LEN("utf8") }
312-
},
313-
{
314-
{ C_STRING_WITH_LEN("Show_view_priv") },
315-
{ C_STRING_WITH_LEN("enum('N','Y')") },
316-
{ C_STRING_WITH_LEN("utf8") }
317-
},
318-
{
319-
{ C_STRING_WITH_LEN("Create_routine_priv") },
320-
{ C_STRING_WITH_LEN("enum('N','Y')") },
321-
{ C_STRING_WITH_LEN("utf8") }
322-
},
323-
{
324-
{ C_STRING_WITH_LEN("Alter_routine_priv") },
325-
{ C_STRING_WITH_LEN("enum('N','Y')") },
326-
{ C_STRING_WITH_LEN("utf8") }
327-
},
328-
{
329-
{ C_STRING_WITH_LEN("Create_user_priv") },
330-
{ C_STRING_WITH_LEN("enum('N','Y')") },
331-
{ C_STRING_WITH_LEN("utf8") }
332-
},
333-
{
334-
{ C_STRING_WITH_LEN("Event_priv") },
335-
{ C_STRING_WITH_LEN("enum('N','Y')") },
336-
{ C_STRING_WITH_LEN("utf8") }
337-
},
338-
{
339-
{ C_STRING_WITH_LEN("Trigger_priv") },
340-
{ C_STRING_WITH_LEN("enum('N','Y')") },
341-
{ C_STRING_WITH_LEN("utf8") }
342-
},
343-
{
344-
{ C_STRING_WITH_LEN("Create_tablespace_priv") },
345-
{ C_STRING_WITH_LEN("enum('N','Y')") },
346-
{ C_STRING_WITH_LEN("utf8") }
347-
},
348-
{
349-
{ C_STRING_WITH_LEN("ssl_type") },
350-
{ C_STRING_WITH_LEN("enum('','ANY','X509','SPECIFIED')") },
351-
{ C_STRING_WITH_LEN("utf8") }
352-
},
353-
{
354-
{ C_STRING_WITH_LEN("ssl_cipher") },
355-
{ C_STRING_WITH_LEN("blob") },
356-
{ NULL, 0 }
357-
},
358-
{
359-
{ C_STRING_WITH_LEN("x509_issuer") },
360-
{ C_STRING_WITH_LEN("blob") },
361-
{ NULL, 0 }
362-
},
363-
{
364-
{ C_STRING_WITH_LEN("x509_subject") },
365-
{ C_STRING_WITH_LEN("blob") },
366-
{ NULL, 0 }
367-
},
368-
{
369-
{ C_STRING_WITH_LEN("max_questions") },
370-
{ C_STRING_WITH_LEN("int(11)") },
371-
{ NULL, 0 }
372-
},
373-
{
374-
{ C_STRING_WITH_LEN("max_updates") },
375-
{ C_STRING_WITH_LEN("int(11)") },
376-
{ NULL, 0 }
377-
},
378-
{
379-
{ C_STRING_WITH_LEN("max_connections") },
380-
{ C_STRING_WITH_LEN("int(11)") },
381-
{ NULL, 0 }
382-
},
383-
{
384-
{ C_STRING_WITH_LEN("plugin") },
385-
{ C_STRING_WITH_LEN("char(64)") },
386-
{ NULL, 0 }
387-
},
388-
{
389-
{ C_STRING_WITH_LEN("authentication_string") },
390-
{ C_STRING_WITH_LEN("text") },
391-
{ NULL, 0 }
392-
}
393-
};
394-
395186
const TABLE_FIELD_DEF
396187
mysql_db_table_def= {MYSQL_DB_FIELD_COUNT, mysql_db_table_fields};
397188

398-
const TABLE_FIELD_DEF
399-
mysql_user_table_def= {MYSQL_USER_FIELD_COUNT, mysql_user_table_fields};
400-
401189
static LEX_STRING native_password_plugin_name= {
402190
C_STRING_WITH_LEN("mysql_native_password")
403191
};
@@ -6203,7 +5991,7 @@ bool check_grant_db(THD *thd,const char *db)
62035991
bool error= TRUE;
62045992
size_t copy_length;
62055993

6206-
copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") +
5994+
copy_length= (size_t) (strlen(sctx->priv_user) +
62075995
strlen(db ? db : "")) + 1; /* Added 1 at the end to avoid
62085996
buffer overflow at strmov()*/
62095997

@@ -9299,7 +9087,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
92999087
DBUG_PRINT("enter", ("Host: '%s', Ip: '%s', User: '%s', table: `%s`.`%s`",
93009088
sctx->priv_host, (sctx->get_ip()->length() ?
93019089
sctx->get_ip()->ptr() : "(NULL)"),
9302-
(sctx->priv_user ? sctx->priv_user : "(NULL)"),
9090+
sctx->priv_user,
93039091
db, table));
93049092
/* --skip-grants */
93059093
if (!initialized)
@@ -11292,8 +11080,7 @@ acl_authenticate(THD *thd, uint com_change_user_pkt_len)
1129211080
{
1129311081
general_log_print(thd, command, "%s@%s as %s on %s",
1129411082
mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip,
11295-
mpvio.auth_info.authenticated_as ?
11296-
mpvio.auth_info.authenticated_as : "anonymous",
11083+
mpvio.auth_info.authenticated_as,
1129711084
mpvio.db.str ? mpvio.db.str : (char*) "");
1129811085
}
1129911086
else

0 commit comments

Comments
 (0)