Skip to content

Commit

Permalink
Fixed compiler warnings and warnings from build.tags
Browse files Browse the repository at this point in the history
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
  • Loading branch information
montywi committed May 7, 2017
1 parent 276b0c8 commit 1e04ad2
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 19 deletions.
2 changes: 2 additions & 0 deletions client/mysqlcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/service_my_snprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions sql/item_cmpfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions sql/item_jsonfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions sql/opt_range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions sql/sql_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions sql/sys_vars.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/wsrep_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion storage/connect/tabext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/ut0dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/ut0stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions storage/maria/ma_ft_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions storage/myisam/ft_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion storage/myisam/mi_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion support-files/build-tags
Original file line number Diff line number Diff line change
Expand Up @@ -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" |
Expand Down

0 comments on commit 1e04ad2

Please sign in to comment.