diff options
author | Monty <monty@mariadb.org> | 2017-05-07 18:26:10 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-05-08 02:33:35 +0300 |
commit | 1e04ad284c6ac0a9ce433f827bc6dbfbd6029007 (patch) | |
tree | ff59557c55b06495d93a3420e8aac09588a87a9d | |
parent | 276b0c8ef03046cc210e4eeab7231cb8d9f16bac (diff) | |
download | mariadb-git-1e04ad284c6ac0a9ce433f827bc6dbfbd6029007.tar.gz |
Fixed compiler warnings and warnings from build.tags
Other things
- Ensure that ut_d() is set to EXPR if ut_ad() is DEBUG_ASSERT()
If not, we will get a crash in purge_sys_t::~purge_sys_t() as
this ut_ad() code expect's that the ut_d() codes has been executed
-rw-r--r-- | client/mysqlcheck.c | 2 | ||||
-rw-r--r-- | include/mysql/service_my_snprintf.h | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 3 | ||||
-rw-r--r-- | sql/item_jsonfunc.cc | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 3 | ||||
-rw-r--r-- | sql/sql_admin.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.ic | 2 | ||||
-rw-r--r-- | sql/table.cc | 6 | ||||
-rw-r--r-- | sql/wsrep_binlog.cc | 2 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 2 | ||||
-rw-r--r-- | storage/connect/tabext.cpp | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 2 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 | ||||
-rw-r--r-- | storage/innobase/include/ut0dbg.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/ut0stage.h | 2 | ||||
-rw-r--r-- | storage/maria/ma_create.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_ft_update.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_update.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_create.c | 2 | ||||
-rwxr-xr-x | support-files/build-tags | 2 |
22 files changed, 33 insertions, 19 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index b47b9c98510..8bc6334448f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -19,6 +19,8 @@ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */ #define CHECK_VERSION "2.7.4-MariaDB" +/* Avoid warnings from %'s format */ +#define USING_MARIADB_SNPRINTF_EXTENSIONS #include "client_priv.h" #include <m_ctype.h> diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h index 586a539d48c..1b2ee2ca202 100644 --- a/include/mysql/service_my_snprintf.h +++ b/include/mysql/service_my_snprintf.h @@ -96,7 +96,7 @@ extern struct my_snprintf_service_st { #define ATTRIBUTE_FORMAT_DEFINED #define ATTRIBUTE_FORMAT(A,B,C) #endif -#ifdef MYSQL_ABI_CHECK +#if defined(MYSQL_ABI_CHECK) || defined(USING_MARIADB_SNPRINTF_EXTENSIONS) #undef ATTRIBUTE_FORMAT #define ATTRIBUTE_FORMAT(A,B,C) #endif diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 891a0c0f594..18c55d872db 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -479,7 +479,6 @@ void Item_bool_rowready_func2::fix_length_and_dec() int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg, Item **a1, Item **a2) { - THD *thd= current_thd; owner= owner_arg; set_null= set_null && owner_arg; a= a1; @@ -488,7 +487,7 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg, Type_handler_hybrid_field_type tmp; if (tmp.aggregate_for_comparison(owner_arg->func_name(), tmp_args, 2, false)) { - DBUG_ASSERT(thd->is_error()); + DBUG_ASSERT(current_thd->is_error()); return 1; } m_compare_handler= tmp.type_handler(); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index c7639bc2513..fd5b4a98e0e 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -1258,6 +1258,7 @@ longlong Item_func_json_contains_path::val_int() longlong result; json_path_t p; int n_found; + LINT_INIT(n_found); if ((null_value= args[0]->null_value)) return 0; @@ -1985,6 +1986,7 @@ String *Item_func_json_merge::val_str(String *str) json_engine_t je1, je2; String *js1= args[0]->val_json(&tmp_js1), *js2; uint n_arg; + LINT_INIT(js2); if (args[0]->null_value) goto null_return; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 87cb16c96fe..284f4348080 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7501,6 +7501,8 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param, param->current_table); #ifdef HAVE_SPATIAL Field::geometry_type sav_geom_type; + LINT_INIT(sav_geom_type); + if (field_item->field->type() == MYSQL_TYPE_GEOMETRY) { sav_geom_type= ((Field_geom*) field_item->field)->geom_type; diff --git a/sql/slave.cc b/sql/slave.cc index b28bc1d8dc5..b2cbac44c1b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3728,8 +3728,7 @@ int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, rpl_group_info *rgi) { - Relay_log_info* rli= rgi->rli; - mysql_mutex_assert_not_owner(&rli->data_lock); + mysql_mutex_assert_not_owner(&rgi->rli->data_lock); int reason= apply_event_and_update_pos_setup(ev, thd, rgi); /* In parallel replication, sql_slave_skip_counter is handled in the SQL diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index f3ecee89a79..31933e63b4e 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -394,7 +394,9 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table, open_and_lock_tables(thd, table, TRUE, 0)); } +#ifndef DBUG_OFF dbug_err: +#endif thd->prepare_derived_at_open= FALSE; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 813c74b60b2..2ad8c2d5562 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2193,7 +2193,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0; bool non_tmp_table_deleted= 0; bool is_drop_tmp_if_exists_added= 0; - bool was_view= 0, was_table, is_sequence; + bool was_view= 0, was_table= 0, is_sequence; String built_query; String built_trans_tmp_query, built_non_trans_tmp_query; DBUG_ENTER("mysql_rm_table_no_locks"); diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index a157538d528..f9acfb3b657 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -612,7 +612,9 @@ public: /* parse and feel list with default values */ if (thd) { +#ifndef DBUG_OFF bool res= +#endif sysvartrack_validate_value(thd, var->save_result.string_value.str, var->save_result.string_value.length); diff --git a/sql/table.cc b/sql/table.cc index fa8ed3c2587..9c3613a879c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1177,7 +1177,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, char *keynames, *names, *comment_pos; const uchar *forminfo, *extra2; const uchar *frm_image_end = frm_image + frm_length; - uchar *record, *null_flags, *null_pos, *mysql57_vcol_null_pos; + uchar *record, *null_flags, *null_pos, *mysql57_vcol_null_pos= 0; const uchar *disk_buff, *strpos; ulong pos, record_offset; ulong rec_buff_length; @@ -2387,6 +2387,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, DBUG_ASSERT(field_nr < share->fields); reg_field= share->field[field_nr]; } + else + reg_field= 0; // Safety vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE; vcol_info->set_vcol_type((enum_vcol_info_type) type); @@ -7368,7 +7370,7 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) DBUG_ASSERT(vcol_info); DBUG_ASSERT(vcol_info->expr); - bool update, swap_values= 0; + bool update= 0, swap_values= 0; switch (update_mode) { case VCOL_UPDATE_FOR_READ: update= !vcol_info->stored_in_db diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 42b7bc81261..ad5ef9c5c55 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -452,7 +452,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, File file; IO_CACHE cache; Log_event_writer writer(&cache, 0); - Format_description_log_event *ev; + Format_description_log_event *ev= 0; int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld_v2.log", wsrep_data_home_dir, (longlong) thd->thread_id, diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 09681d4daa4..1b6078cc3d9 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -2692,7 +2692,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) htrc("Cond type=%d\n", cond->type()); if (cond->type() == COND::COND_ITEM) { - char *pb0, *pb1, *pb2, *ph0, *ph1, *ph2; + char *pb0, *pb1, *pb2, *ph0= 0, *ph1= 0, *ph2= 0; bool bb = false, bh = false; Item_cond *cond_item= (Item_cond *)cond; diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp index e3518126a49..b099321eff5 100644 --- a/storage/connect/tabext.cpp +++ b/storage/connect/tabext.cpp @@ -293,7 +293,7 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt) if (Srcdef) { if ((catp = strstr(Srcdef, "%s"))) { - char *fil1, *fil2; + char *fil1= 0, *fil2; PSZ ph = ((EXTDEF*)To_Def)->Phpos; if (!ph) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index d0c0316bf13..7b0597f27ea 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1873,7 +1873,7 @@ buf_flush_batch( buf_pool_mutex_enter(buf_pool); - ulint count = 0; + ulint count __attribute__((unused))= 0; /* Note: The buffer pool mutex is released and reacquired within the flush functions. */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 37c4c09e553..45d00e9a2ff 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2046,7 +2046,7 @@ innobase_release_temporary_latches( DBUG_ASSERT(hton == innodb_hton_ptr); if (!srv_was_started) { - } else if (trx_t* trx = thd_to_trx(thd)) { + } else if (trx_t* trx __attribute__((unused))= thd_to_trx(thd)) { trx_assert_no_search_latch(trx); } @@ -13107,7 +13107,7 @@ create_table_info_t::set_tablespace_type( int create_table_info_t::initialize() { - trx_t* parent_trx; + trx_t* parent_trx __attribute__((unused)); DBUG_ENTER("create_table_info_t::initialize"); diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 706579a3b9f..a860196e3db 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -62,7 +62,7 @@ ut_dbg_assertion_failed( /** Debug assertion */ #define ut_ad DBUG_ASSERT -#ifdef UNIV_DEBUG +#if defined(UNIV_DEBUG) || !defined(DBUG_OFF) /** Debug statement. Does nothing unless UNIV_DEBUG is defined. */ #define ut_d(EXPR) EXPR #else diff --git a/storage/innobase/include/ut0stage.h b/storage/innobase/include/ut0stage.h index baad5cd77b4..a4ff0a1c874 100644 --- a/storage/innobase/include/ut0stage.h +++ b/storage/innobase/include/ut0stage.h @@ -272,7 +272,7 @@ current phase. inline void ut_stage_alter_t::inc( - ulint inc_val /* = 1 */) + ulint inc_val __attribute__((unused)) /* = 1 */) { if (m_progress == NULL) { return; diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 0ddd8b226e2..959e31c3598 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -55,7 +55,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, uint internal_table= flags & HA_CREATE_INTERNAL_TABLE; ulong reclength, real_reclength,min_pack_length; char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr; - char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr; + char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr= 0; ulong pack_reclength; ulonglong tot_length,max_rows, tmp; enum en_fieldtype type; diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c index 51f27520dc1..ddf2a7251ab 100644 --- a/storage/maria/ma_ft_update.c +++ b/storage/maria/ma_ft_update.c @@ -28,6 +28,8 @@ void _ma_ft_segiterator_init(MARIA_HA *info, uint keynr, const uchar *record, ftsi->num=info->s->keyinfo[keynr].keysegs; ftsi->seg=info->s->keyinfo[keynr].seg; ftsi->rec=record; + ftsi->pos= 0; /* Avoid warnings from gcc */ + ftsi->len= 0; /* Avoid warnings from gcc */ DBUG_VOID_RETURN; } diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index 8f437476121..f851c0236ae 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -28,6 +28,8 @@ void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const uchar *record, ftsi->num=info->s->keyinfo[keynr].keysegs; ftsi->seg=info->s->keyinfo[keynr].seg; ftsi->rec=record; + ftsi->pos= 0; /* Avoid warnings from gcc */ + ftsi->len= 0; /* Avoid warnings from gcc */ DBUG_VOID_RETURN; } diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c0967a60d13..ab45a16a96c 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -47,7 +47,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, uint internal_table= flags & HA_CREATE_INTERNAL_TABLE; ulong reclength, real_reclength,min_pack_length; char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr; - char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr; + char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0; ulong pack_reclength; ulonglong tot_length,max_rows, tmp; enum en_fieldtype type; diff --git a/support-files/build-tags b/support-files/build-tags index e0616661a75..8e8ed251cd7 100755 --- a/support-files/build-tags +++ b/support-files/build-tags @@ -8,7 +8,7 @@ then echo sql mysys strings client storage dbug libmysql sql-common \ extra mysys_ssl strings regex pcre vio include \ tools unittest plugin libmysqld | \ - xargs -n1 git ls-files | grep -v '\.jar$' | \ + xargs -n1 git ls-files | grep -v '\.jar$' | grep -v '\xz$' | xargs etags -o TAGS --append else find . -type f ! -name "*.jar" | |