From 7189f09aa6d434fc889cb6d819e97c09f8cc0bcf Mon Sep 17 00:00:00 2001
From: Sergei Golubchik <sergii@pisem.net>
Date: Wed, 23 Nov 2011 18:25:07 +0100
Subject: [PATCH] compiler warnings/errors

---
 client/mysqldump.c                                          | 2 +-
 client/mysqltest.cc                                         | 4 ++--
 .../suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test    | 2 ++
 mysys/CMakeLists.txt                                        | 4 ++++
 storage/maria/ma_bitmap.c                                   | 6 ++----
 storage/maria/maria_chk.c                                   | 3 +--
 storage/myisam/myisamchk.c                                  | 4 ++--
 7 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/client/mysqldump.c b/client/mysqldump.c
index 0d209bd7034..bfdbf90d313 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -4427,7 +4427,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
 static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos)
 {
   MYSQL_ROW row;
-  MYSQL_RES *master;
+  MYSQL_RES *UNINIT_VAR(master);
   char binlog_pos_file[FN_REFLEN];
   char binlog_pos_offset[LONGLONG_LEN+1];
   char *file, *offset;
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 29235dbd234..386577a4224 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -8137,8 +8137,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
 char *re_eprint(int err)
 {
   static char epbuf[100];
-  size_t len= my_regerror(REG_ITOA|err, (my_regex_t *)NULL,
-			  epbuf, sizeof(epbuf));
+  size_t len __attribute__((unused))=
+          my_regerror(REG_ITOA|err, (my_regex_t *)NULL, epbuf, sizeof(epbuf));
   assert(len <= sizeof(epbuf));
   return(epbuf);
 }
diff --git a/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test b/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test
index 73f61c45623..20958d03d89 100644
--- a/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test
+++ b/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test
@@ -1,5 +1,7 @@
 # ulong global
 
+--source include/have_debug.inc
+
 SET @start_global_value = @@global.debug_binlog_fsync_sleep;
 
 #
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 5837764a171..5b611601955 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -70,6 +70,10 @@ TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
  ${LIBNSL} ${LIBM} ${LIBRT})
 DTRACE_INSTRUMENT(mysys)
 
+IF (WIN32)
+  TARGET_LINK_LIBRARIES(mysys IPHLPAPI)  
+ENDIF(WIN32)
+
 ADD_EXECUTABLE(thr_lock thr_lock.c)
 TARGET_LINK_LIBRARIES(thr_lock mysys)
 SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 76049a54238..ab9b49b6219 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -1239,10 +1239,9 @@ static my_bool allocate_head(MARIA_FILE_BITMAP *bitmap, uint size,
   uint min_bits= size_to_head_pattern(bitmap, size);
   uchar *data= bitmap->map, *end= data + bitmap->used_size;
   uchar *best_data= 0;
-  uint best_bits= (uint) -1, best_pos;
+  uint best_bits= (uint) -1, UNINIT_VAR(best_pos);
   DBUG_ENTER("allocate_head");
 
-  LINT_INIT(best_pos);
   DBUG_ASSERT(size <= FULL_PAGE_SIZE(bitmap->block_size));
 
   for (; data < end; data+= 6)
@@ -1319,11 +1318,10 @@ static my_bool allocate_tail(MARIA_FILE_BITMAP *bitmap, uint size,
   uint min_bits= size_to_tail_pattern(bitmap, size);
   uchar *data= bitmap->map, *end= data + bitmap->used_size;
   uchar *best_data= 0;
-  uint best_bits= (uint) -1, best_pos;
+  uint best_bits= (uint) -1, UNINIT_VAR(best_pos);
   DBUG_ENTER("allocate_tail");
   DBUG_PRINT("enter", ("size: %u", size));
 
-  LINT_INIT(best_pos);
   /*
     We have to add DIR_ENTRY_SIZE here as this is not part of the data size
     See call to allocate_tail() in find_tail().
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 22d1433b008..27653ae5574 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -798,8 +798,7 @@ get_one_option(int optid,
   case OPT_STATS_METHOD:
   {
     int method;
-    enum_handler_stats_method method_conv;
-    LINT_INIT(method_conv);
+    enum_handler_stats_method UNINIT_VAR(method_conv);
     maria_stats_method_str= argument;
     if ((method=find_type(argument, &maria_stats_method_typelib, 2)) <= 0)
     {
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 6f27b1bc0d2..981ae61fe9d 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -670,8 +670,8 @@ get_one_option(int optid,
   case OPT_STATS_METHOD:
   {
     int method;
-    enum_handler_stats_method method_conv;
-    LINT_INIT(method_conv);
+    enum_handler_stats_method UNINIT_VAR(method_conv);
+
     myisam_stats_method_str= argument;
     if ((method= find_type(argument, &myisam_stats_method_typelib,
                            FIND_TYPE_BASIC)) <= 0)
-- 
2.30.9