diff options
25 files changed, 76 insertions, 69 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 4e902d7fed8..caba370c4ae 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -28,10 +28,15 @@ SET(MY_WARNING_FLAGS -Woverloaded-virtual -Wvla -Wwrite-strings + -Werror ) -IF(MYSQL_MAINTAINER_MODE MATCHES "ON") - SET(WHERE) +IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") + SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized) +ENDIF() + +IF(MYSQL_MAINTAINER_MODE MATCHES "OFF") + RETURN() ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO") SET(WHERE DEBUG) ENDIF() diff --git a/include/mysql/client_plugin.h b/include/mysql/client_plugin.h index b2df0019dfe..84fb3c6798d 100644 --- a/include/mysql/client_plugin.h +++ b/include/mysql/client_plugin.h @@ -32,17 +32,18 @@ */ #undef MYSQL_PLUGIN_EXPORT #if defined(_MSC_VER) - #ifdef __cplusplus - #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) - #else - #define MYSQL_PLUGIN_EXPORT __declspec(dllexport) - #endif + #define MYSQL_PLUGIN_EXPORT_C __declspec(dllexport) #else /*_MSC_VER */ - #ifdef __cplusplus - #define MYSQL_PLUGIN_EXPORT extern "C" - #else - #define MYSQL_PLUGIN_EXPORT - #endif + #define MYSQL_PLUGIN_EXPORT_C +#endif +#ifdef __cplusplus +#define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_PLUGIN_EXPORT_C +#define C_MODE_START extern "C" { +#define C_MODE_END } +#else +#define MYSQL_PLUGIN_EXPORT MYSQL_PLUGIN_EXPORT_C +#define C_MODE_START +#define C_MODE_END #endif #ifndef MYSQL_ABI_CHECK @@ -60,11 +61,12 @@ #define MYSQL_CLIENT_MAX_PLUGINS 3 #define mysql_declare_client_plugin(X) \ - MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \ + C_MODE_START MYSQL_PLUGIN_EXPORT_C \ + struct st_mysql_client_plugin_ ## X \ _mysql_client_plugin_declaration_ = { \ MYSQL_CLIENT_ ## X ## _PLUGIN, \ MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, -#define mysql_end_client_plugin } +#define mysql_end_client_plugin }; C_MODE_END /* generic plugin header structure */ #define MYSQL_CLIENT_PLUGIN_HEADER \ diff --git a/sql-common/client.c b/sql-common/client.c index 4fa167a21f1..60aa558dfb3 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1354,7 +1354,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, { uchar *pos; /* fields count may be wrong */ - if (field - result >= fields) + if (field - result >= (my_ptrdiff_t)fields) goto err; cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); @@ -1401,7 +1401,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, /* old protocol, for backward compatibility */ for (row=data->data; row ; row = row->next,field++) { - if (field - result >= fields) + if (field - result >= (my_ptrdiff_t)fields) goto err; cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); @@ -1439,7 +1439,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, } } #endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */ - if (field - result < fields) + if (field - result < (my_ptrdiff_t)fields) goto err; free_rows(data); /* Free old data */ DBUG_RETURN(result); diff --git a/sql/log.cc b/sql/log.cc index a1e7e5b218f..bab250223f3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -9593,9 +9593,9 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all, */ if (!xid || !need_unlog) DBUG_RETURN(BINLOG_COOKIE_DUMMY(cache_mngr->delayed_error)); - else - DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id, - cache_mngr->delayed_error)); + + DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id, + cache_mngr->delayed_error)); } /* diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index cbc9780d507..0ec6719037c 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -528,7 +528,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if (!table->table->part_info) { my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); - goto err2; + thd->resume_subsequent_commits(suspended_wfc); + DBUG_RETURN(TRUE); } if (set_part_state(alter_info, table->table->part_info, PART_ADMIN)) { @@ -1159,7 +1160,6 @@ err: } close_thread_tables(thd); // Shouldn't be needed thd->mdl_context.release_transactional_locks(); -err2: thd->resume_subsequent_commits(suspended_wfc); DBUG_RETURN(TRUE); } diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index e2c55583594..addbfeb99f6 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -231,7 +231,7 @@ bool wsrep_sst_wait () total_wtime += difftime(end_time, start_time); WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime); + "WSREP state transfer ongoing, current seqno: %" PRId64 " waited %f secs", local_seqno, total_wtime); } } @@ -294,9 +294,8 @@ void wsrep_sst_received (wsrep_t* const wsrep, } else if (local_seqno > seqno) { - WSREP_WARN("SST postion is in the past: %lld, current: %lld. " - "Can't continue.", - (long long)seqno, (long long)local_seqno); + WSREP_WARN("SST postion is in the past: %" PRId64 ", current: %" PRId64 + ". Can't continue.", seqno, local_seqno); unireg_abort(1); } @@ -1416,7 +1415,7 @@ void wsrep_SE_init_wait() total_wtime += difftime(end_time, start_time); WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime); + "WSREP state transfer ongoing, current seqno: %" PRId64 " waited %f secs", local_seqno, total_wtime); } } diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 0ca794df230..519e075aaaa 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -40,6 +40,10 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h) add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS) add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT ) +macro(DISABLE_WARNING W) + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-error=${W}") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-${W}" DEBUG) +endmacro() # # OS specific C flags, definitions and source files. @@ -47,14 +51,15 @@ add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT ) IF(UNIX) MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations") if(NOT WITH_WARNINGS) - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") + DISABLE_WARNING("unused-function") + DISABLE_WARNING("unused-variable") + DISABLE_WARNING("unused-value") + DISABLE_WARNING("parentheses") + DISABLE_WARNING("strict-aliasing") + DISABLE_WARNING("misleading-indentation") + DISABLE_WARNING("format-truncation") + DISABLE_WARNING("implicit-fallthrough") + DISABLE_WARNING("type-limits") endif(NOT WITH_WARNINGS) add_definitions( -DUNIX -DLINUX -DUBUNTU ) diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 07b1c2d2e7d..13c9aa4835b 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -32,6 +32,10 @@ /****************************************************************************/ #include "mycat.h" +#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) +bool MongoEnabled(void); +#endif // JAVA_SUPPORT || CMGO_SUPPORT + /****************************************************************************/ /* Structures used to pass info between CONNECT and ha_connect. */ /****************************************************************************/ diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index cc5675db5c8..9fb8fc8367d 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -102,10 +102,6 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #endif // !__WIN__ -#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) -bool MongoEnabled(void); -#endif // JAVA_SUPPORT || CMGO_SUPPORT - PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); /***********************************************************************/ diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index 2e667e64d0b..0e7c0d5b061 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -145,10 +145,10 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table, time_t now = time(0); if (now >= last + 30) { fprintf(stderr, - "WARNING: %s:%u waited " TIMETPF " seconds for" + "WARNING: %s:%u waited %ld seconds for" " dict_sys lock, space: %lu" " lock_to_close_table: %d\n", - file, line, now - start, space_id, + file, line, (long)(now - start), space_id, lock_to_close_table); last = now; diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index fb84b5703bf..296096e44d0 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2453,9 +2453,9 @@ fil_space_crypt_close_tablespace( if (now >= last + 30) { ib_logf(IB_LOG_LEVEL_WARN, - "Waited " TIMETPF " seconds to drop space: %s (" ULINTPF + "Waited %ld seconds to drop space: %s (" ULINTPF ") active threads %u flushing=%d.", - now - start, space->name, space->id, cnt, flushing); + (long)(now - start), space->name, space->id, cnt, flushing); last = now; } } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c670839b5cd..cd605b6b791 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -10520,7 +10520,7 @@ wsrep_append_foreign_key( key_type, copy); if (rcode) { - DBUG_PRINT("wsrep", ("row key failed: %zu", rcode)); + DBUG_PRINT("wsrep", ("row key failed: %lu", rcode)); WSREP_ERROR("Appending cascaded fk row key failed: %s, %lu", (wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", rcode); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 8807e2bf9e9..58ff9e1b5e4 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -454,7 +454,6 @@ macro ULINTPF. */ # define INT64PF "%lld" # define UINT64PF "%llu" # define UINT64PFx "%016llx" -# define TIMETPF "%ld" typedef __int64 ib_int64_t; typedef unsigned __int64 ib_uint64_t; typedef unsigned __int32 ib_uint32_t; @@ -464,7 +463,6 @@ typedef unsigned __int32 ib_uint32_t; # define INT64PF "%" PRId64 # define UINT64PF "%" PRIu64 # define UINT64PFx "%016" PRIx64 -# define TIMETPF "%" PRIdFAST32 typedef int64_t ib_int64_t; typedef uint64_t ib_uint64_t; typedef uint32_t ib_uint32_t; diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 3970a559a4c..f06fcd6c4d8 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -5350,7 +5350,7 @@ lock_table( lock_mutex_enter(); DBUG_EXECUTE_IF("fatal-semaphore-timeout", - { os_thread_sleep(3600000000); }); + { os_thread_sleep(3600000000U); }); /* We have to check if the new lock is compatible with any locks other transactions have in the table lock queue. */ diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 5aa9b6040f8..a417de1261f 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -6183,7 +6183,7 @@ os_file_trim( size_t len = slot->len; size_t trim_len = slot->page_size - len; - os_offset_t off = slot->offset + len; + os_offset_t off __attribute__((unused)) = slot->offset + len; size_t bsize = slot->file_block_size; #ifdef UNIV_TRIM_DEBUG diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 5d0d2d3ea2e..542e2570cb1 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3316,17 +3316,17 @@ fil_wait_crypt_bg_threads( time_t now = time(0); if (now >= last + 30) { fprintf(stderr, - "WARNING: waited " TIMETPF " seconds " + "WARNING: waited %ld seconds " "for ref-count on table: %s space: %u\n", - now - start, table->name, table->space); + (long)(now - start), table->name, table->space); last = now; } if (now >= start + 300) { fprintf(stderr, - "WARNING: after " TIMETPF " seconds, gave up waiting " + "WARNING: after %ld seconds, gave up waiting " "for ref-count on table: %s space: %u\n", - now - start, table->name, table->space); + (long)(now - start), table->name, table->space); break; } } diff --git a/storage/mroonga/lib/mrn_context_pool.cpp b/storage/mroonga/lib/mrn_context_pool.cpp index d297ee9a338..a26005b16c0 100644 --- a/storage/mroonga/lib/mrn_context_pool.cpp +++ b/storage/mroonga/lib/mrn_context_pool.cpp @@ -77,7 +77,7 @@ namespace mrn { } private: - static const unsigned int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5; + static const int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5; mysql_mutex_t *mutex_; LIST *pool_; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 130edc5ee8a..5f7e59b47da 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7027,7 +7027,7 @@ int spider_get_sts( int sts_sync_level, uint flag ) { - int get_type; + int get_type __attribute__ ((unused)); int error_num = 0; DBUG_ENTER("spider_get_sts"); @@ -7149,7 +7149,7 @@ int spider_get_crd( #endif int crd_sync_level ) { - int get_type; + int get_type __attribute__ ((unused)); int error_num = 0; DBUG_ENTER("spider_get_crd"); @@ -8379,7 +8379,7 @@ int spider_discover_table_structure( #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *part_info = thd->work_part_info; #endif - uint str_len; + uint str_len __attribute__ ((unused)); char buf[MAX_FIELD_WIDTH]; spider_string str(buf, sizeof(buf), system_charset_info); DBUG_ENTER("spider_discover_table_structure"); diff --git a/storage/xtradb/btr/btr0scrub.cc b/storage/xtradb/btr/btr0scrub.cc index 2e667e64d0b..0e7c0d5b061 100644 --- a/storage/xtradb/btr/btr0scrub.cc +++ b/storage/xtradb/btr/btr0scrub.cc @@ -145,10 +145,10 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table, time_t now = time(0); if (now >= last + 30) { fprintf(stderr, - "WARNING: %s:%u waited " TIMETPF " seconds for" + "WARNING: %s:%u waited %ld seconds for" " dict_sys lock, space: %lu" " lock_to_close_table: %d\n", - file, line, now - start, space_id, + file, line, (long)(now - start), space_id, lock_to_close_table); last = now; diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index fb84b5703bf..296096e44d0 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -2453,9 +2453,9 @@ fil_space_crypt_close_tablespace( if (now >= last + 30) { ib_logf(IB_LOG_LEVEL_WARN, - "Waited " TIMETPF " seconds to drop space: %s (" ULINTPF + "Waited %ld seconds to drop space: %s (" ULINTPF ") active threads %u flushing=%d.", - now - start, space->name, space->id, cnt, flushing); + (long)(now - start), space->name, space->id, cnt, flushing); last = now; } } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index d943a87ab78..a0df23b60d4 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -11088,7 +11088,7 @@ wsrep_append_foreign_key( key_type, copy); if (rcode) { - DBUG_PRINT("wsrep", ("row key failed: %zu", rcode)); + DBUG_PRINT("wsrep", ("row key failed: %lu", rcode)); WSREP_ERROR("Appending cascaded fk row key failed: %s, %lu", (wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", rcode); diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 6d1520bc6a3..c35ec40e381 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -471,7 +471,6 @@ macro ULINTPF. */ # define INT64PF "%lld" # define UINT64PF "%llu" # define UINT64PFx "%016llx" -# define TIMETPF "%ld" typedef __int64 ib_int64_t; typedef unsigned __int64 ib_uint64_t; typedef unsigned __int32 ib_uint32_t; @@ -481,7 +480,6 @@ typedef unsigned __int32 ib_uint32_t; # define INT64PF "%" PRId64 # define UINT64PF "%" PRIu64 # define UINT64PFx "%016" PRIx64 -# define TIMETPF "%" PRIdFAST32 typedef int64_t ib_int64_t; typedef uint64_t ib_uint64_t; typedef uint32_t ib_uint32_t; diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 2183d281b78..9daa2cc906f 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -5401,7 +5401,7 @@ lock_table( lock_mutex_enter(); DBUG_EXECUTE_IF("fatal-semaphore-timeout", - { os_thread_sleep(3600000000); }); + { os_thread_sleep(3600000000U); }); /* We have to check if the new lock is compatible with any locks other transactions have in the table lock queue. */ diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 47075c6cbc8..5e7ff6e910b 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -3320,17 +3320,17 @@ fil_wait_crypt_bg_threads( time_t now = time(0); if (now >= last + 30) { fprintf(stderr, - "WARNING: waited " TIMETPF " seconds " + "WARNING: waited %ld seconds " "for ref-count on table: %s space: %u\n", - now - start, table->name, table->space); + (long)(now - start), table->name, table->space); last = now; } if (now >= start + 300) { fprintf(stderr, - "WARNING: after " TIMETPF " seconds, gave up waiting " + "WARNING: after %ld seconds, gave up waiting " "for ref-count on table: %s space: %u\n", - now - start, table->name, table->space); + (long)(now - start), table->name, table->space); break; } } diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc index 97b2ef0f80f..51656c02e57 100644 --- a/unittest/sql/mf_iocache-t.cc +++ b/unittest/sql/mf_iocache-t.cc @@ -356,7 +356,7 @@ void mdev17133() // random size 2nd read res= my_b_read(&info, buf_i + total + MY_MIN(19, curr_read_size), 19 >= curr_read_size ? 0 : curr_read_size - 19); - ok(res == 0, "rest of read %lu", curr_read_size - 19); + ok(res == 0, "rest of read %zu", curr_read_size - 19); // mark read bytes in the used part of the cache buffer memset(info.buffer, 0, info.read_pos - info.buffer); |