summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/nosik.monty.fi>2006-11-01 19:41:09 +0200
committerunknown <monty@mysql.com/nosik.monty.fi>2006-11-01 19:41:09 +0200
commit07d8be45443b3ead253dd8ddcc99ca138efb624c (patch)
tree5e83a9c8d05ac5737f80de4551b918fa425184e4
parent9852dfbcf5d3bfb5eec4316977b3d0d37761520e (diff)
downloadmariadb-git-07d8be45443b3ead253dd8ddcc99ca138efb624c.tar.gz
Fixed a lot of compiler warnings (Mainly in mysqld and instance manager)
Fixed some possible fatal wrong arguments to printf() style functions Initialized some not initialized variables Fixed bug in stored procedure and continue handlers (Fixes Bug#22150) include/mysql/plugin.h: Remove compiler warning mysql-test/mysql-test-run.pl: Ensure that --extern works on a clean tree (when 'var' directory doesn't exists) server-tools/instance-manager/commands.cc: Fixed possible use of unitialized variable server-tools/instance-manager/guardian.cc: Fixed wrong arguments to log_info() that could cause crashes server-tools/instance-manager/instance.cc: Fixed wrong arguments to log_info() and log_error() that could cause crashes server-tools/instance-manager/instance_options.cc: Fixed wrong arguments to log_error() that could cause crashes server-tools/instance-manager/mysql_connection.cc: Fixed wrong arguments to log_info() server-tools/instance-manager/parse.cc: Fixed possible use of unitialized variable server-tools/instance-manager/user_map.cc: Fixed wrong arguments to log_error() that could cause crashes sql/Makefile.am: Fix for bison 1.875 (It write an __attribute__() tag that was causing compiler failures) sql/ha_ndbcluster.cc: Fixed wrong snprintf() arguments Remoed not used variables sql/ha_ndbcluster_binlog.cc: Fixed compiler warning (unsigned/signed comparision) sql/handler.cc: Fixed wrong parameter to hton->binlog_func() sql/item_cmpfunc.cc: Removed compiler warnings sql/item_timefunc.cc: Removed compiler warnings sql/log.cc: fixed wrong argument to snprintf() sql/mysqld.cc: Removed compiler warnings Fixed wrong arguments to printf() sql/partition_info.cc: Removed compiler warnings sql/protocol.cc: reset is_fatal_error for stored procedures (Fix for Bug#22150) sql/sp_head.cc: More DBUG information Reset is_fatal_error in case of continue handler. (Fix for Bug#22150) sql/sql_base.cc: Removed compiler warnings sql/sql_class.h: More DBUG information sql/sql_insert.cc: Removed compiler warnings Initialize not initialized variable (fatal bug) sql/sql_parse.cc: Added DBUG_ASSERT to detect if stored procedure code returns with a wrong state Removed compiler warning sql/sql_plugin.cc: Fied wrong aruguments to printf() (Fatal bug) sql/sql_select.cc: Initailize not initialized variable. Remove compiler warnings Fixed wrong argument to printf() (Possible fatal error) sql/sql_view.cc: Removed compiler warnings sql/table.cc: Fixed wrong argument to printf() (Possible fatal)
-rw-r--r--include/mysql/plugin.h2
-rwxr-xr-xmysql-test/mysql-test-run.pl25
-rw-r--r--server-tools/instance-manager/commands.cc2
-rw-r--r--server-tools/instance-manager/guardian.cc10
-rw-r--r--server-tools/instance-manager/instance.cc10
-rw-r--r--server-tools/instance-manager/instance_options.cc2
-rw-r--r--server-tools/instance-manager/mysql_connection.cc20
-rw-r--r--server-tools/instance-manager/parse.cc2
-rw-r--r--server-tools/instance-manager/user_map.cc9
-rw-r--r--sql/Makefile.am3
-rw-r--r--sql/ha_ndbcluster.cc21
-rw-r--r--sql/ha_ndbcluster_binlog.cc5
-rw-r--r--sql/handler.cc8
-rw-r--r--sql/item_cmpfunc.cc3
-rw-r--r--sql/item_timefunc.cc10
-rw-r--r--sql/log.cc2
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/partition_info.cc6
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/sp_head.cc12
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_insert.cc12
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_plugin.cc4
-rw-r--r--sql/sql_select.cc11
-rw-r--r--sql/sql_view.cc2
-rw-r--r--sql/table.cc2
28 files changed, 126 insertions, 76 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 22cd64a52c4..2b97a134c6f 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -65,7 +65,7 @@ __MYSQL_DECLARE_PLUGIN(NAME, \
builtin_ ## NAME ## _sizeof_struct_st_plugin, \
builtin_ ## NAME ## _plugin)
-#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}}
+#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
/*
declarations for SHOW STATUS support in plugins
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index e5ed8a99304..e152ec2d208 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1633,7 +1633,7 @@ sub environment_setup () {
# ----------------------------------------------------
# We are nice and report a bit about our settings
# ----------------------------------------------------
- if (!$opt_extern)
+ if (!$opt_extern && $opt_verbose)
{
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
@@ -2270,6 +2270,11 @@ sub initialize_servers () {
}
check_running_as_root();
}
+ else
+ {
+ # We have to create the 'var' and related directories
+ cleanup_stale_files();
+ }
}
sub mysql_install_db () {
@@ -2590,16 +2595,18 @@ sub do_before_run_mysqltest($)
}
-# MASV cleanup...
- mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
+ if (!$opt_extern)
+ {
+ # MASV cleanup...
+ mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
- # output current test to ndbcluster log file to enable diagnostics
- mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
+ # output current test to ndbcluster log file to enable diagnostics
+ mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
- mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
- if ( $master->[1]->{'pid'} )
- {
- mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ if ( $master->[1]->{'pid'} ) {
+ mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ }
}
}
diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index f45b230171e..66140b8b049 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -1351,7 +1351,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name)
int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id)
{
- int err_code;
+ int err_code= 0;
/* Check that all the specified instances exist and are offline. */
diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
index 68d89a4b375..d0fdab9373f 100644
--- a/server-tools/instance-manager/guardian.cc
+++ b/server-tools/instance-manager/guardian.cc
@@ -158,7 +158,7 @@ void Guardian_thread::process_instance(Instance *instance,
{
/* clear status fields */
log_info("guardian: instance %s is running, set state to STARTED",
- instance->options.instance_name);
+ instance->options.instance_name.str);
current_node->restart_counter= 0;
current_node->crash_moment= 0;
current_node->state= STARTED;
@@ -169,7 +169,7 @@ void Guardian_thread::process_instance(Instance *instance,
switch (current_node->state) {
case NOT_STARTED:
log_info("guardian: starting instance %s",
- instance->options.instance_name);
+ instance->options.instance_name.str);
/* NOTE, set state to STARTING _before_ start() is called */
current_node->state= STARTING;
@@ -194,7 +194,7 @@ void Guardian_thread::process_instance(Instance *instance,
{
instance->start();
log_info("guardian: starting instance %s",
- instance->options.instance_name);
+ instance->options.instance_name.str);
}
}
else
@@ -212,13 +212,13 @@ void Guardian_thread::process_instance(Instance *instance,
current_node->last_checked= current_time;
current_node->restart_counter++;
log_info("guardian: restarting instance %s",
- instance->options.instance_name);
+ instance->options.instance_name.str);
}
}
else
{
log_info("guardian: cannot start instance %s. Abandoning attempts "
- "to (re)start it", instance->options.instance_name);
+ "to (re)start it", instance->options.instance_name.str);
current_node->state= CRASHED_AND_ABANDONED;
}
}
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index dfe26397414..a0b737eb97d 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -166,7 +166,7 @@ static int start_process(Instance_options *instance_options,
exit(1);
case -1:
log_info("cannot create a new process to start instance %s",
- instance_options->instance_name);
+ instance_options->instance_name.str);
return 1;
}
return 0;
@@ -311,9 +311,9 @@ void Instance::remove_pid()
int pid;
if ((pid= options.get_pid()) != 0) /* check the pidfile */
if (options.unlink_pidfile()) /* remove stalled pidfile */
- log_error("cannot remove pidfile for instance %i, this might be \
- since IM lacks permmissions or hasn't found the pidifle",
- options.instance_name);
+ log_error("cannot remove pidfile for instance %s, this might be "
+ "since IM lacks permmissions or hasn't found the pidfile",
+ options.instance_name.str);
}
@@ -619,7 +619,7 @@ void Instance::kill_instance(int signum)
log_error("The instance %s is being stopped forcibly. Normally" \
"it should not happen. Probably the instance has been" \
"hanging. You should also check your IM setup",
- options.instance_name);
+ options.instance_name.str);
/* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile();
}
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index f6ec751678f..00da6660703 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -182,7 +182,7 @@ int Instance_options::fill_instance_version()
err:
if (rc)
log_error("fill_instance_version: Failed to get version of '%s'",
- mysqld_path);
+ mysqld_path.str);
return rc;
}
diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc
index 17cda3af704..435c4756b02 100644
--- a/server-tools/instance-manager/mysql_connection.cc
+++ b/server-tools/instance-manager/mysql_connection.cc
@@ -165,7 +165,7 @@ Mysql_connection_thread::~Mysql_connection_thread()
void Mysql_connection_thread::run()
{
- log_info("accepted mysql connection %d", connection_id);
+ log_info("accepted mysql connection %lu", connection_id);
my_thread_init();
@@ -175,7 +175,7 @@ void Mysql_connection_thread::run()
return;
}
- log_info("connection %d is checked successfully", connection_id);
+ log_info("connection %lu is checked successfully", connection_id);
vio_keepalive(vio, TRUE);
@@ -314,7 +314,7 @@ int Mysql_connection_thread::do_command()
packet= (char*) net.read_pos;
enum enum_server_command command= (enum enum_server_command)
(uchar) *packet;
- log_info("connection %d: packet_length=%d, command=%d",
+ log_info("connection %lu: packet_length=%lu, command=%d",
connection_id, packet_length, command);
return dispatch_command(command, packet + 1, packet_length - 1);
}
@@ -325,27 +325,27 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
{
switch (command) {
case COM_QUIT: // client exit
- log_info("query for connection %d received quit command", connection_id);
+ log_info("query for connection %lu received quit command", connection_id);
return 1;
case COM_PING:
- log_info("query for connection %d received ping command", connection_id);
+ log_info("query for connection %lu received ping command", connection_id);
net_send_ok(&net, connection_id, NULL);
break;
case COM_QUERY:
{
- log_info("query for connection %d : ----\n%s\n-------------------------",
+ log_info("query for connection %lu : ----\n%s\n-------------------------",
connection_id,packet);
if (Command *command= parse_command(&instance_map, packet))
{
int res= 0;
- log_info("query for connection %d successfully parsed",connection_id);
+ log_info("query for connection %lu successfully parsed",connection_id);
res= command->execute(&net, connection_id);
delete command;
if (!res)
- log_info("query for connection %d executed ok",connection_id);
+ log_info("query for connection %lu executed ok",connection_id);
else
{
- log_info("query for connection %d executed err=%d",connection_id,res);
+ log_info("query for connection %lu executed err=%d",connection_id,res);
net_send_error(&net, res);
return 0;
}
@@ -358,7 +358,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
break;
}
default:
- log_info("query for connection %d received unknown command",connection_id);
+ log_info("query for connection %lu received unknown command",connection_id);
net_send_error(&net, ER_UNKNOWN_COM_ERROR);
break;
}
diff --git a/server-tools/instance-manager/parse.cc b/server-tools/instance-manager/parse.cc
index d69fb1cecec..048f7983b32 100644
--- a/server-tools/instance-manager/parse.cc
+++ b/server-tools/instance-manager/parse.cc
@@ -273,7 +273,7 @@ Command *parse_command(Instance_map *map, const char *text)
{
uint word_len;
LEX_STRING instance_name;
- Command *command;
+ Command *command= 0;
const char *saved_text= text;
Token tok1= shift_token(&text, &word_len);
diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc
index e8128cf015b..c1439e983d8 100644
--- a/server-tools/instance-manager/user_map.cc
+++ b/server-tools/instance-manager/user_map.cc
@@ -74,11 +74,10 @@ int User::init(const char *line)
password_length= strlen(password);
if (password_length > SCRAMBLED_PASSWORD_CHAR_LENGTH)
{
- log_info("Error: password is too long (%d). Max length: %d. ",
- "User line: '%s'.",
- (int) password_length,
- (int) SCRAMBLED_PASSWORD_CHAR_LENGTH,
- (const char *) line);
+ log_info("Error: password is too long (%d). Max length: %d. User line: '%s'.",
+ (int) password_length,
+ (int) SCRAMBLED_PASSWORD_CHAR_LENGTH,
+ line);
return 1;
}
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 38a99aaef88..81be480e652 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -150,9 +150,12 @@ mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES)
# things like different grammars for different pars of MySQL can
# happen if you are unlucky.
sql_yacc.cc: sql_yacc.yy
+
sql_yacc.h: sql_yacc.yy
sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
+ @SED@ -e 's/__attribute__ ((__unused__))//' sql_yacc.cc > sql_yacc.cc-new
+ @MV@ sql_yacc.cc-new sql_yacc.cc
@echo "Note: The following compile may take a long time."
@echo "If it fails, re-run configure with --with-low-memory"
$(CXXCOMPILE) $(LM_CFLAGS) -c $<
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 13ea471511c..5862af061fb 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -6488,7 +6488,7 @@ static int ndbcluster_init(void *p)
}
{
char buf[128];
- my_snprintf(buf, sizeof(buf), "mysqld --server-id=%d", server_id);
+ my_snprintf(buf, sizeof(buf), "mysqld --server-id=%lu", server_id);
g_ndb_cluster_connection->set_name(buf);
}
g_ndb_cluster_connection->set_optimized_node_selection
@@ -7245,7 +7245,7 @@ int handle_trailing_share(NDB_SHARE *share)
share->key_length= min_key_length;
}
share->key_length=
- my_snprintf(share->key, min_key_length + 1, "#leak%d",
+ my_snprintf(share->key, min_key_length + 1, "#leak%lu",
trailing_share_id++);
}
/* Keep it for possible the future trailing free */
@@ -9764,12 +9764,12 @@ ndbcluster_show_status(handlerton *hton, THD* thd, stat_print_fn *stat_print,
update_status_variables(g_ndb_cluster_connection);
buflen=
my_snprintf(buf, sizeof(buf),
- "cluster_node_id=%u, "
+ "cluster_node_id=%ld, "
"connected_host=%s, "
- "connected_port=%u, "
- "number_of_data_nodes=%u, "
- "number_of_ready_data_nodes=%u, "
- "connect_count=%u",
+ "connected_port=%ld, "
+ "number_of_data_nodes=%ld, "
+ "number_of_ready_data_nodes=%ld, "
+ "connect_count=%ld",
ndb_cluster_node_id,
ndb_connected_host,
ndb_connected_port,
@@ -10691,7 +10691,8 @@ static int ndbcluster_fill_files_table(handlerton *hton,
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[100];
- int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
+ int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",
+ id, (ulong) lfg.getUndoBufferSize());
table->field[c]->set_notnull();
table->field[c]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table);
@@ -10708,7 +10709,6 @@ static int ndbcluster_fill_files_table(handlerton *hton,
for (i= 0; i < lfglist.count; i++)
{
NdbDictionary::Dictionary::List::Element& elt= lfglist.elements[i];
- unsigned id;
NdbDictionary::LogfileGroup lfg= dict->getLogfileGroup(elt.name);
ndberr= dict->getNdbError();
@@ -10779,7 +10779,8 @@ static int ndbcluster_fill_files_table(handlerton *hton,
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[100];
- int len= my_snprintf(extra,sizeof(extra),"UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
+ int len= my_snprintf(extra, sizeof(extra), "UNDO_BUFFER_SIZE=%lu",
+ (ulong) lfg.getUndoBufferSize());
table->field[c]->set_notnull();
table->field[c]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table);
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 5f5c8bcb221..3dfca5d1bb2 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -3907,7 +3907,7 @@ err:
close_thread_tables(thd);
pthread_mutex_lock(&injector_mutex);
/* don't mess with the injector_ndb anymore from other threads */
- int ndb_obj_cnt= 1; // g_ndb
+ uint ndb_obj_cnt= 1; // g_ndb
ndb_obj_cnt+= injector_ndb == 0 ? 0 : 1;
ndb_obj_cnt+= schema_ndb == 0 ? 0 : 1;
ndb_obj_cnt+= ndbcluster_util_inited ? 1 : 0;
@@ -3930,7 +3930,8 @@ err:
* otherwise user thread can have ongoing SUB_DATA
*/
int sleep_cnt= 0;
- while (sleep_cnt < 300 && g_ndb_cluster_connection->get_active_ndb_objects() > ndb_obj_cnt)
+ while (sleep_cnt < 300 &&
+ g_ndb_cluster_connection->get_active_ndb_objects() > ndb_obj_cnt)
{
my_sleep(10000); // 10ms
sleep_cnt++;
diff --git a/sql/handler.cc b/sql/handler.cc
index ccf1a1ef8d9..21b6705b98a 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2947,15 +2947,15 @@ static my_bool binlog_func_list(THD *thd, st_plugin_int *plugin, void *arg)
static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn)
{
- handlerton *hton;
hton_list_st hton_list;
+ uint i, sz;
+
hton_list.sz= 0;
plugin_foreach(thd, binlog_func_list,
MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
- uint i= 0, sz= hton_list.sz;
- while(i < sz)
- hton_list.hton[i++]->binlog_func(hton, thd, bfn->fn, bfn->arg);
+ for (i= 0, sz= hton_list.sz; i < sz ; i++)
+ hton_list.hton[i]->binlog_func(hton_list.hton[i], thd, bfn->fn, bfn->arg);
return FALSE;
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9435b3767a0..691715c3bff 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -275,6 +275,9 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
my_bitmap_map *old_write_map;
my_bitmap_map *old_read_map;
+ LINT_INIT(old_write_map);
+ LINT_INIT(old_read_map);
+
if (table)
{
old_write_map= dbug_tmp_use_all_columns(table, table->write_set);
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index d32adde5e64..08f2a332556 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1249,6 +1249,11 @@ bool get_interval_value(Item *args,interval_type int_type,
interval->second= array[0];
interval->second_part= array[1];
break;
+ /* purecov: begin deadcode */
+ case INTERVAL_LAST:
+ DBUG_ASSERT(0);
+ break;
+ /* purecov: end */
}
return 0;
}
@@ -2088,6 +2093,7 @@ void Item_extract::fix_length_and_dec()
case INTERVAL_HOUR_MICROSECOND: max_length=13; date_value=0; break;
case INTERVAL_MINUTE_MICROSECOND: max_length=11; date_value=0; break;
case INTERVAL_SECOND_MICROSECOND: max_length=9; date_value=0; break;
+ case INTERVAL_LAST: DBUG_ASSERT(0); break; /* purecov: deadcode */
}
}
@@ -2157,6 +2163,8 @@ longlong Item_extract::val_int()
ltime.second_part)*neg;
case INTERVAL_SECOND_MICROSECOND: return ((longlong)ltime.second*1000000L+
ltime.second_part)*neg;
+ case INTERVAL_LAST: DBUG_ASSERT(0); return(0); /* purecov: deadcode */
+ /* purecov: end */
}
return 0; // Impossible
}
@@ -2271,7 +2279,7 @@ String *Item_char_typecast::val_str(String *str)
{ // Safe even if const arg
char char_type[40];
my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
- cast_cs == &my_charset_bin ? "BINARY" : "CHAR", length);
+ cast_cs == &my_charset_bin ? "BINARY" : "CHAR", (ulong) length);
if (!res->alloced_length())
{ // Don't change const str
diff --git a/sql/log.cc b/sql/log.cc
index a1ed9bd6df3..fb14aa62dd8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2010,7 +2010,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
goto err;
/* command_type, thread_id */
- length= my_snprintf(buff, 32, "%5ld ", thread_id);
+ length= my_snprintf(buff, 32, "%5ld ", (long) thread_id);
if (my_b_write(&log_file, (byte*) buff, length))
goto err;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6674dd87757..04d827e341f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1609,7 +1609,7 @@ static void network_init(void)
if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1))
{
- sql_print_error("The socket file path is too long (> %lu): %s",
+ sql_print_error("The socket file path is too long (> %u): %s",
sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port);
unireg_abort(1);
}
@@ -3506,7 +3506,7 @@ int main(int argc, char **argv)
{
if (global_system_variables.log_warnings)
sql_print_warning("Asked for %ld thread stack, but got %ld",
- thread_stack, stack_size);
+ thread_stack, (long) stack_size);
#if defined(__ia64__) || defined(__ia64)
thread_stack= stack_size*2;
#else
@@ -5316,7 +5316,7 @@ master-ssl",
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
--skip-merge.",
- (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0},
+ (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index a20fca9404b..c3e67752396 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -485,6 +485,8 @@ bool partition_info::check_range_constants()
DBUG_ENTER("partition_info::check_range_constants");
DBUG_PRINT("enter", ("INT_RESULT with %d parts", no_parts));
+ LINT_INIT(current_largest);
+
part_result_type= INT_RESULT;
range_int_array= (longlong*)sql_alloc(no_parts * sizeof(longlong));
if (unlikely(range_int_array == NULL))
@@ -877,7 +879,6 @@ void partition_info::print_no_partition_found(TABLE *table)
bool partition_info::set_up_charset_field_preps()
{
Field *field, **ptr;
- char *field_buf;
char **char_ptrs;
unsigned i;
bool found;
@@ -919,6 +920,7 @@ bool partition_info::set_up_charset_field_preps()
{
if (field_is_partition_charset(field))
{
+ char *field_buf;
CHARSET_INFO *cs= ((Field_str*)field)->charset();
size= field->pack_length();
if (!(field_buf= sql_calloc(size)))
@@ -956,6 +958,8 @@ bool partition_info::set_up_charset_field_preps()
unsigned j= 0;
Field *part_field;
CHARSET_INFO *cs;
+ char *field_buf;
+ LINT_INIT(field_buf);
if (!field_is_partition_charset(field))
continue;
diff --git a/sql/protocol.cc b/sql/protocol.cc
index e00a70cf3a2..a2ae194c374 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -79,6 +79,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
if (net && net->no_send_error)
{
thd->clear_error();
+ thd->is_fatal_error= 0; // Error message is given
DBUG_PRINT("info", ("sending error messages prohibited"));
DBUG_VOID_RETURN;
}
@@ -111,7 +112,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
net_send_error_packet(thd, sql_errno, err);
- thd->is_fatal_error=0; // Error message is given
+ thd->is_fatal_error= 0; // Error message is given
thd->net.report_error= 0;
/* Abort multi-result sets */
@@ -156,6 +157,7 @@ net_printf_error(THD *thd, uint errcode, ...)
if (net && net->no_send_error)
{
thd->clear_error();
+ thd->is_fatal_error= 0; // Error message is given
DBUG_PRINT("info", ("sending error messages prohibited"));
DBUG_VOID_RETURN;
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index a061ae12dd1..c6fb2a4064e 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1143,6 +1143,7 @@ sp_head::execute(THD *thd)
ctx->clear_handler();
ctx->enter_handler(hip);
thd->clear_error();
+ thd->is_fatal_error= 0;
thd->killed= THD::NOT_KILLED;
continue;
}
@@ -1170,8 +1171,9 @@ sp_head::execute(THD *thd)
state= EXECUTED;
done:
- DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d",
- err_status, thd->killed, thd->query_error));
+ DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d report_error: %d",
+ err_status, thd->killed, thd->query_error,
+ thd->net.report_error));
if (thd->killed)
err_status= TRUE;
@@ -2375,6 +2377,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
bool open_tables, sp_instr* instr)
{
int res= 0;
+ DBUG_ENTER("reset_lex_and_exec_core");
DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->change_list.is_empty());
@@ -2419,7 +2422,10 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
res= -1;
if (!res)
+ {
res= instr->exec_core(thd, nextp);
+ DBUG_PRINT("info",("exec_core returned: %d", res));
+ }
m_lex->unit.cleanup();
@@ -2457,7 +2463,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
cleanup_items() is called in sp_head::execute()
*/
- return res || thd->net.report_error;
+ DBUG_RETURN(res || thd->net.report_error);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3e7bcf7798a..5a1586c21fd 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -6558,6 +6558,8 @@ static bool
has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables)
{
char *first_table_name= NULL, *first_db;
+ LINT_INIT(first_db);
+
for (TABLE_LIST *table= tables; table; table= table->next_global)
{
/* we must do preliminary checks as table->table may be NULL */
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 95283ec2fc8..502ac3d2259 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1449,10 +1449,12 @@ public:
#ifndef EMBEDDED_LIBRARY
inline void clear_error()
{
+ DBUG_ENTER("clear_error");
net.last_error[0]= 0;
net.last_errno= 0;
net.report_error= 0;
query_error= 0;
+ DBUG_VOID_RETURN;
}
inline bool vio_ok() const { return net.vio != 0; }
#else
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 4dcbf9af4a0..dcb4152f64f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -261,6 +261,8 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
TABLE *table= insert_table_list->table;
my_bool timestamp_mark;
+ LINT_INIT(timestamp_mark);
+
if (table->timestamp_field)
{
/*
@@ -1699,7 +1701,7 @@ static int
write_delayed(THD *thd,TABLE *table, enum_duplicates duplic,
LEX_STRING query, bool ignore, bool log_on)
{
- delayed_row *row;
+ delayed_row *row= 0;
delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc;
DBUG_ENTER("write_delayed");
@@ -2306,14 +2308,18 @@ bool delayed_insert::handle_inserts(void)
DBUG_RETURN(0);
err:
- DBUG_EXECUTE("error", max_rows= 0;);
+#ifndef DBUG_OFF
+ max_rows= 0; // For DBUG output
+#endif
/* Remove all not used rows */
while ((row=rows.get()))
{
delete row;
thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
stacked_inserts--;
- DBUG_EXECUTE("error", max_rows++;);
+#ifndef DBUG_OFF
+ max_rows++;
+#endif
}
DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows));
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fc7ed7ff673..edf43fd4fb5 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4633,7 +4633,10 @@ end_with_restore_list:
send_ok(thd, (ulong) (thd->row_count_func < 0 ? 0 :
thd->row_count_func));
else
+ {
+ DBUG_ASSERT(thd->net.report_error == 1 || thd->killed);
goto error; // Substatement should already have sent error
+ }
}
break;
}
@@ -4918,7 +4921,7 @@ end_with_restore_list:
LEX_STRING *name;
int i;
- for (i= 0; name= names++; i++)
+ for (i= 0; (name= names++); i++)
{
buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 34fb447792e..7a0a143dcc9 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -502,7 +502,7 @@ void plugin_deinitialize(struct st_plugin_int *plugin)
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
{
sql_print_error("Plugin '%s' of type %s failed deinitialization",
- plugin->name.str, plugin_type_names[plugin->plugin->type]);
+ plugin->name.str, plugin_type_names[plugin->plugin->type].str);
}
}
else if (plugin->plugin->deinit)
@@ -562,7 +562,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
{
sql_print_error("Plugin '%s' registration as a %s failed.",
- plugin->name.str, plugin_type_names[plugin->plugin->type]);
+ plugin->name.str, plugin_type_names[plugin->plugin->type].str);
goto err;
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7908bb8c95f..640cde78434 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3598,7 +3598,7 @@ best_access_path(JOIN *join,
double best= DBL_MAX;
double best_time= DBL_MAX;
double records= DBL_MAX;
- table_map best_ref_depends_map;
+ table_map best_ref_depends_map= 0;
double tmp;
ha_rows rec;
@@ -10099,7 +10099,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab;
DBUG_ENTER("do_select");
-
+ LINT_INIT(join_tab);
+
join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */
join->fields= fields;
@@ -10129,9 +10130,9 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
*/
if (!join->conds || join->conds->val_int())
{
- error= (*end_select)(join,join_tab,0);
+ error= (*end_select)(join, 0, 0);
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_QUERY_LIMIT)
- error= (*end_select)(join,join_tab,1);
+ error= (*end_select)(join, 0, 1);
}
else if (join->send_row_on_empty_set())
{
@@ -10687,7 +10688,7 @@ int report_error(TABLE *table, int error)
*/
if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
sql_print_error("Got error %d when reading table '%s'",
- error, table->s->path);
+ error, table->s->path.str);
table->file->print_error(error,MYF(0));
return 1;
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 7f6d935ff5e..744fbf1c9f1 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1073,6 +1073,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
lex->can_be_merged());
TABLE_LIST *view_main_select_tables;
+ LINT_INIT(view_main_select_tables);
+
if (view_is_mergeable)
{
/*
diff --git a/sql/table.cc b/sql/table.cc
index 8505b15459b..f15555138f8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -480,7 +480,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
sql_print_warning("'%s' had no or invalid character set, "
"and default character set is multi-byte, "
"so character column sizes may have changed",
- share->path);
+ share->path.str);
}
share->table_charset= default_charset_info;
}